rename some screens function

This commit is contained in:
Julien Danjou 2008-01-29 19:06:44 +01:00
parent c02760531c
commit 606d157e31
11 changed files with 32 additions and 32 deletions

View file

@ -83,7 +83,7 @@ scan()
if(wa.map_state == IsViewable || window_getstate(wins[i]) == IconicState) if(wa.map_state == IsViewable || window_getstate(wins[i]) == IconicState)
{ {
if(screen == 0) if(screen == 0)
real_screen = get_screen_bycoord(wa.x, wa.y); real_screen = screen_get_bycoord(wa.x, wa.y);
client_manage(wins[i], &wa, real_screen); client_manage(wins[i], &wa, real_screen);
} }
} }
@ -96,7 +96,7 @@ scan()
&& (wa.map_state == IsViewable || window_getstate(wins[i]) == IconicState)) && (wa.map_state == IsViewable || window_getstate(wins[i]) == IconicState))
{ {
if(screen == 0) if(screen == 0)
real_screen = get_screen_bycoord(wa.x, wa.y); real_screen = screen_get_bycoord(wa.x, wa.y);
client_manage(wins[i], &wa, real_screen); client_manage(wins[i], &wa, real_screen);
} }
} }

View file

@ -227,7 +227,7 @@ client_get_smart_geometry(Area geometry, int border, int screen)
screen_geometry = p_new(Area, 1); screen_geometry = p_new(Area, 1);
*screen_geometry = get_screen_area(screen, *screen_geometry = screen_get_area(screen,
globalconf.screens[screen].statusbar, globalconf.screens[screen].statusbar,
&globalconf.screens[screen].padding); &globalconf.screens[screen].padding);
@ -297,9 +297,9 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
c = p_new(Client, 1); c = p_new(Client, 1);
c->screen = get_screen_bycoord(wa->x, wa->y); c->screen = screen_get_bycoord(wa->x, wa->y);
screen_geom = get_screen_area(c->screen, screen_geom = screen_get_area(c->screen,
globalconf.screens[screen].statusbar, globalconf.screens[screen].statusbar,
&globalconf.screens[screen].padding); &globalconf.screens[screen].padding);
/* Initial values */ /* Initial values */
@ -473,7 +473,7 @@ client_resize(Client *c, Area geometry, Bool sizehints)
if(c->geometry.x != geometry.x || c->geometry.y != geometry.y if(c->geometry.x != geometry.x || c->geometry.y != geometry.y
|| c->geometry.width != geometry.width || c->geometry.height != geometry.height) || c->geometry.width != geometry.width || c->geometry.height != geometry.height)
{ {
new_screen = get_screen_bycoord(geometry.x, geometry.y); new_screen = screen_get_bycoord(geometry.x, geometry.y);
c->geometry.x = wc.x = geometry.x; c->geometry.x = wc.x = geometry.x;
c->geometry.y = wc.y = geometry.y; c->geometry.y = wc.y = geometry.y;
@ -926,7 +926,7 @@ void
uicb_client_togglemax(int screen, char *arg __attribute__ ((unused))) uicb_client_togglemax(int screen, char *arg __attribute__ ((unused)))
{ {
Client *sel = globalconf.focus->client; Client *sel = globalconf.focus->client;
Area area = get_screen_area(screen, Area area = screen_get_area(screen,
globalconf.screens[screen].statusbar, globalconf.screens[screen].statusbar,
&globalconf.screens[screen].padding); &globalconf.screens[screen].padding);
@ -947,7 +947,7 @@ void
uicb_client_toggleverticalmax(int screen, char *arg __attribute__ ((unused))) uicb_client_toggleverticalmax(int screen, char *arg __attribute__ ((unused)))
{ {
Client *sel = globalconf.focus->client; Client *sel = globalconf.focus->client;
Area area = get_screen_area(screen, Area area = screen_get_area(screen,
globalconf.screens[screen].statusbar, globalconf.screens[screen].statusbar,
&globalconf.screens[screen].padding); &globalconf.screens[screen].padding);
@ -970,7 +970,7 @@ void
uicb_client_togglehorizontalmax(int screen, char *arg __attribute__ ((unused))) uicb_client_togglehorizontalmax(int screen, char *arg __attribute__ ((unused)))
{ {
Client *sel = globalconf.focus->client; Client *sel = globalconf.focus->client;
Area area = get_screen_area(screen, Area area = screen_get_area(screen,
globalconf.screens[screen].statusbar, globalconf.screens[screen].statusbar,
&globalconf.screens[screen].padding); &globalconf.screens[screen].padding);

View file

@ -134,7 +134,7 @@ handle_event_buttonpress(XEvent *e)
&wdummy, &x, &y, &i, &wdummy, &x, &y, &i,
&i, &udummy)) &i, &udummy))
{ {
screen = get_screen_bycoord(x, y); screen = screen_get_bycoord(x, y);
handle_mouse_button_press(screen, ev->button, ev->state, handle_mouse_button_press(screen, ev->button, ev->state,
globalconf.buttons.root, NULL); globalconf.buttons.root, NULL);
return; return;
@ -272,10 +272,10 @@ handle_event_keypress(XEvent * e)
{ {
/* if screen is 0, we are on first Zaphod screen or on the /* if screen is 0, we are on first Zaphod screen or on the
* only screen in Xinerama, so we can ask for a better screen * only screen in Xinerama, so we can ask for a better screen
* number with get_screen_bycoord: we'll get 0 in Zaphod mode * number with screen_get_bycoord: we'll get 0 in Zaphod mode
* so it's the same, or maybe the real Xinerama screen */ * so it's the same, or maybe the real Xinerama screen */
if(screen == 0) if(screen == 0)
screen = get_screen_bycoord(x, y); screen = screen_get_bycoord(x, y);
break; break;
} }
@ -329,7 +329,7 @@ handle_event_maprequest(XEvent *e)
for(screen = 0; wa.screen != ScreenOfDisplay(e->xany.display, screen); screen++); for(screen = 0; wa.screen != ScreenOfDisplay(e->xany.display, screen); screen++);
if(screen == 0 && XQueryPointer(e->xany.display, RootWindow(e->xany.display, screen), if(screen == 0 && XQueryPointer(e->xany.display, RootWindow(e->xany.display, screen),
&dummy, &dummy, &x, &y, &d, &d, &m)) &dummy, &dummy, &x, &y, &d, &d, &m))
screen = get_screen_bycoord(x, y); screen = screen_get_bycoord(x, y);
client_manage(ev->window, &wa, screen); client_manage(ev->window, &wa, screen);
} }
} }

2
ewmh.c
View file

@ -262,7 +262,7 @@ ewmh_process_state_atom(Client *c, Atom state, int set)
} }
else if(set == _NET_WM_STATE_ADD) else if(set == _NET_WM_STATE_ADD)
{ {
geometry = get_screen_area(c->screen, NULL, &globalconf.screens[c->screen].padding); geometry = screen_get_area(c->screen, NULL, &globalconf.screens[c->screen].padding);
/* save geometry */ /* save geometry */
c->m_geometry = c->geometry; c->m_geometry = c->geometry;
c->wasfloating = c->isfloating; c->wasfloating = c->isfloating;

View file

@ -33,7 +33,7 @@ layout_fibonacci(int screen, int shape)
int n = 0, i = 0; int n = 0, i = 0;
Client *c; Client *c;
Area geometry, area; Area geometry, area;
geometry = area = get_screen_area(screen, geometry = area = screen_get_area(screen,
globalconf.screens[screen].statusbar, globalconf.screens[screen].statusbar,
&globalconf.screens[screen].padding); &globalconf.screens[screen].padding);

View file

@ -31,7 +31,7 @@ void
layout_max(int screen) layout_max(int screen)
{ {
Client *c; Client *c;
Area area = get_screen_area(screen, Area area = screen_get_area(screen,
globalconf.screens[screen].statusbar, globalconf.screens[screen].statusbar,
&globalconf.screens[screen].padding); &globalconf.screens[screen].padding);

View file

@ -116,7 +116,7 @@ _tile(int screen, const Position position)
Client *c; Client *c;
Tag **curtags = tags_get_current(screen); Tag **curtags = tags_get_current(screen);
area = get_screen_area(screen, area = screen_get_area(screen,
globalconf.screens[screen].statusbar, globalconf.screens[screen].statusbar,
&globalconf.screens[screen].padding); &globalconf.screens[screen].padding);

View file

@ -57,7 +57,7 @@ uicb_client_movemouse(int screen, char *arg __attribute__ ((unused)))
/* go above everybody */ /* go above everybody */
XMapRaised(globalconf.display, c->win); XMapRaised(globalconf.display, c->win);
area = get_screen_area(c->screen, area = screen_get_area(c->screen,
globalconf.screens[screen].statusbar, globalconf.screens[screen].statusbar,
&globalconf.screens[screen].padding); &globalconf.screens[screen].padding);
@ -119,7 +119,7 @@ uicb_client_movemouse(int screen, char *arg __attribute__ ((unused)))
XQueryPointer(globalconf.display, XQueryPointer(globalconf.display,
RootWindow(globalconf.display, phys_screen), RootWindow(globalconf.display, phys_screen),
&dummy, &child, &x, &y, &di, &di, &dui); &dummy, &child, &x, &y, &di, &di, &dui);
if((newscreen = get_screen_bycoord(x, y)) != c->screen) if((newscreen = screen_get_bycoord(x, y)) != c->screen)
{ {
move_client_to_screen(c, newscreen, True); move_client_to_screen(c, newscreen, True);
globalconf.screens[c->screen].need_arrange = True; globalconf.screens[c->screen].need_arrange = True;
@ -176,7 +176,7 @@ uicb_client_resizemouse(int screen, char *arg __attribute__ ((unused)))
for(c = globalconf.clients; c && !IS_TILED(c, screen); c = c->next); for(c = globalconf.clients; c && !IS_TILED(c, screen); c = c->next);
if(!c) return; if(!c) return;
area = get_screen_area(screen, area = screen_get_area(screen,
globalconf.screens[c->screen].statusbar, globalconf.screens[c->screen].statusbar,
&globalconf.screens[c->screen].padding); &globalconf.screens[c->screen].padding);
} }

View file

@ -36,7 +36,7 @@ extern AwesomeConf globalconf;
* \return Area * \return Area
*/ */
Area Area
get_screen_area(int screen, Statusbar *statusbar, Padding *padding) screen_get_area(int screen, Statusbar *statusbar, Padding *padding)
{ {
Area area; Area area;
Statusbar *sb; Statusbar *sb;
@ -110,7 +110,7 @@ get_display_area(int screen, Statusbar *statusbar, Padding *padding)
* \return screen number or DefaultScreen of disp on no match * \return screen number or DefaultScreen of disp on no match
*/ */
int int
get_screen_bycoord(int x, int y) screen_get_bycoord(int x, int y)
{ {
int i; int i;
Area area; Area area;
@ -121,7 +121,7 @@ get_screen_bycoord(int x, int y)
for(i = 0; i < globalconf.nscreen; i++) for(i = 0; i < globalconf.nscreen; i++)
{ {
area = get_screen_area(i, NULL, NULL); area = screen_get_area(i, NULL, NULL);
if((x < 0 || (x >= area.x && x < area.x + area.width)) if((x < 0 || (x >= area.x && x < area.x + area.width))
&& (y < 0 || (y >= area.y && y < area.y + area.height))) && (y < 0 || (y >= area.y && y < area.y + area.height)))
return i; return i;
@ -245,8 +245,8 @@ move_client_to_screen(Client *c, int new_screen, Bool doresize)
Area new_geometry, new_f_geometry; Area new_geometry, new_f_geometry;
new_f_geometry = c->f_geometry; new_f_geometry = c->f_geometry;
to = get_screen_area(c->screen, NULL, NULL); to = screen_get_area(c->screen, NULL, NULL);
from = get_screen_area(old_screen, NULL, NULL); from = screen_get_area(old_screen, NULL, NULL);
/* compute new coords in new screen */ /* compute new coords in new screen */
new_f_geometry.x = (c->f_geometry.x - from.x) + to.x; new_f_geometry.x = (c->f_geometry.x - from.x) + to.x;
@ -317,7 +317,7 @@ move_mouse_pointer_to_screen(int screen)
{ {
if(XineramaIsActive(globalconf.display)) if(XineramaIsActive(globalconf.display))
{ {
Area area = get_screen_area(screen, NULL, NULL); Area area = screen_get_area(screen, NULL, NULL);
XWarpPointer(globalconf.display, XWarpPointer(globalconf.display,
None, None,
DefaultRootWindow(globalconf.display), DefaultRootWindow(globalconf.display),

View file

@ -1,7 +1,7 @@
/* /*
* screen.h - screen management header * screen.h - screen management header
* *
* Copyright © 2007 Julien Danjou <julien@danjou.info> * Copyright © 2007-2008 Julien Danjou <julien@danjou.info>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -24,9 +24,9 @@
#include "structs.h" #include "structs.h"
Area get_screen_area(int, Statusbar *, Padding *); Area screen_get_area(int, Statusbar *, Padding *);
Area get_display_area(int, Statusbar *, Padding *); Area get_display_area(int, Statusbar *, Padding *);
int get_screen_bycoord(int, int); int screen_get_bycoord(int, int);
void screen_build_screens(void); void screen_build_screens(void);
int get_phys_screen(int); int get_phys_screen(int);
void move_client_to_screen(Client *, int, Bool); void move_client_to_screen(Client *, int, Bool);

View file

@ -39,11 +39,11 @@ statusbar_update_position(Statusbar *statusbar)
/* Top and Bottom Statusbar have prio */ /* Top and Bottom Statusbar have prio */
if(statusbar->position == Top || statusbar->position == Bottom) if(statusbar->position == Top || statusbar->position == Bottom)
area = get_screen_area(statusbar->screen, area = screen_get_area(statusbar->screen,
NULL, NULL,
&globalconf.screens[statusbar->screen].padding); &globalconf.screens[statusbar->screen].padding);
else else
area = get_screen_area(statusbar->screen, area = screen_get_area(statusbar->screen,
globalconf.screens[statusbar->screen].statusbar, globalconf.screens[statusbar->screen].statusbar,
&globalconf.screens[statusbar->screen].padding); &globalconf.screens[statusbar->screen].padding);
@ -184,7 +184,7 @@ statusbar_init(Statusbar *statusbar)
{ {
Statusbar *sb; Statusbar *sb;
int phys_screen = get_phys_screen(statusbar->screen); int phys_screen = get_phys_screen(statusbar->screen);
Area area = get_screen_area(statusbar->screen, Area area = screen_get_area(statusbar->screen,
globalconf.screens[statusbar->screen].statusbar, globalconf.screens[statusbar->screen].statusbar,
&globalconf.screens[statusbar->screen].padding); &globalconf.screens[statusbar->screen].padding);