fix screen_get_bycoord()
This commit is contained in:
parent
328e5d0d4e
commit
960d870b0b
|
@ -77,7 +77,6 @@ scan()
|
||||||
{
|
{
|
||||||
if(XQueryTree(globalconf.display, RootWindow(globalconf.display, screen), &d1, &d2, &wins, &num))
|
if(XQueryTree(globalconf.display, RootWindow(globalconf.display, screen), &d1, &d2, &wins, &num))
|
||||||
{
|
{
|
||||||
real_screen = screen;
|
|
||||||
for(i = 0; i < num; i++)
|
for(i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
/* XGetWindowAttributes return 1 on success */
|
/* XGetWindowAttributes return 1 on success */
|
||||||
|
@ -87,8 +86,7 @@ scan()
|
||||||
continue;
|
continue;
|
||||||
if(wa.map_state == IsViewable || window_getstate(wins[i]) == IconicState)
|
if(wa.map_state == IsViewable || window_getstate(wins[i]) == IconicState)
|
||||||
{
|
{
|
||||||
if(screen == 0)
|
real_screen = screen_get_bycoord(screen, 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,8 +98,7 @@ scan()
|
||||||
if(XGetTransientForHint(globalconf.display, wins[i], &d1)
|
if(XGetTransientForHint(globalconf.display, wins[i], &d1)
|
||||||
&& (wa.map_state == IsViewable || window_getstate(wins[i]) == IconicState))
|
&& (wa.map_state == IsViewable || window_getstate(wins[i]) == IconicState))
|
||||||
{
|
{
|
||||||
if(screen == 0)
|
real_screen = screen_get_bycoord(screen, 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
5
client.c
5
client.c
|
@ -22,6 +22,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
#include <X11/extensions/shape.h>
|
#include <X11/extensions/shape.h>
|
||||||
|
#include <X11/extensions/Xinerama.h>
|
||||||
|
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "tag.h"
|
#include "tag.h"
|
||||||
|
@ -253,7 +254,7 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
|
||||||
|
|
||||||
c = p_new(Client, 1);
|
c = p_new(Client, 1);
|
||||||
|
|
||||||
c->screen = screen_get_bycoord(wa->x, wa->y);
|
c->screen = screen_get_bycoord(screen, wa->x, wa->y);
|
||||||
|
|
||||||
screen_geom = screen_get_area(c->screen,
|
screen_geom = screen_get_area(c->screen,
|
||||||
globalconf.screens[screen].statusbar,
|
globalconf.screens[screen].statusbar,
|
||||||
|
@ -447,7 +448,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 = screen_get_bycoord(geometry.x, geometry.y);
|
new_screen = screen_get_bycoord(c->screen, 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;
|
||||||
|
|
19
event.c
19
event.c
|
@ -24,6 +24,7 @@
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
#include <X11/extensions/shape.h>
|
#include <X11/extensions/shape.h>
|
||||||
#include <X11/extensions/Xrandr.h>
|
#include <X11/extensions/Xrandr.h>
|
||||||
|
#include <X11/extensions/Xinerama.h>
|
||||||
|
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "event.h"
|
#include "event.h"
|
||||||
|
@ -134,7 +135,7 @@ handle_event_buttonpress(XEvent *e)
|
||||||
&wdummy, &x, &y, &i,
|
&wdummy, &x, &y, &i,
|
||||||
&i, &udummy))
|
&i, &udummy))
|
||||||
{
|
{
|
||||||
screen = screen_get_bycoord(x, y);
|
screen = screen_get_bycoord(screen, 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;
|
||||||
|
@ -273,8 +274,7 @@ handle_event_keypress(XEvent * e)
|
||||||
* 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 screen_get_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)
|
screen = screen_get_bycoord(screen, x, y);
|
||||||
screen = screen_get_bycoord(x, y);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,7 +315,7 @@ handle_event_maprequest(XEvent *e)
|
||||||
{
|
{
|
||||||
static XWindowAttributes wa;
|
static XWindowAttributes wa;
|
||||||
XMapRequestEvent *ev = &e->xmaprequest;
|
XMapRequestEvent *ev = &e->xmaprequest;
|
||||||
int screen, x, y, d;
|
int screen = 0, x, y, d;
|
||||||
unsigned int m;
|
unsigned int m;
|
||||||
Window dummy;
|
Window dummy;
|
||||||
|
|
||||||
|
@ -325,10 +325,13 @@ handle_event_maprequest(XEvent *e)
|
||||||
return;
|
return;
|
||||||
if(!client_get_bywin(globalconf.clients, ev->window))
|
if(!client_get_bywin(globalconf.clients, ev->window))
|
||||||
{
|
{
|
||||||
for(screen = 0; wa.screen != ScreenOfDisplay(e->xany.display, screen); screen++);
|
if(XineramaIsActive(globalconf.display)
|
||||||
if(screen == 0 && XQueryPointer(e->xany.display, RootWindow(e->xany.display, screen),
|
&& XQueryPointer(e->xany.display, RootWindow(e->xany.display, screen),
|
||||||
&dummy, &dummy, &x, &y, &d, &d, &m))
|
&dummy, &dummy, &x, &y, &d, &d, &m))
|
||||||
screen = screen_get_bycoord(x, y);
|
screen = screen_get_bycoord(screen, x, y);
|
||||||
|
else
|
||||||
|
for(screen = 0; wa.screen != ScreenOfDisplay(e->xany.display, screen); screen++);
|
||||||
|
|
||||||
client_manage(ev->window, &wa, screen);
|
client_manage(ev->window, &wa, screen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
6
ewmh.c
6
ewmh.c
|
@ -149,10 +149,9 @@ ewmh_update_net_client_list(int phys_screen)
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
for(c = globalconf.clients; c; c = c->next)
|
for(c = globalconf.clients; c; c = c->next)
|
||||||
if(get_phys_screen(c->screen) == phys_screen)
|
n++;
|
||||||
n++;
|
|
||||||
|
|
||||||
wins = p_new(Window, n + 1);
|
wins = p_new(Window, n);
|
||||||
|
|
||||||
for(n = 0, c = globalconf.clients; c; c = c->next, n++)
|
for(n = 0, c = globalconf.clients; c; c = c->next, n++)
|
||||||
if(get_phys_screen(c->screen) == phys_screen)
|
if(get_phys_screen(c->screen) == phys_screen)
|
||||||
|
@ -162,7 +161,6 @@ ewmh_update_net_client_list(int phys_screen)
|
||||||
net_client_list, XA_WINDOW, 32, PropModeReplace, (unsigned char *) wins, n);
|
net_client_list, XA_WINDOW, 32, PropModeReplace, (unsigned char *) wins, n);
|
||||||
|
|
||||||
p_delete(&wins);
|
p_delete(&wins);
|
||||||
XFlush(globalconf.display);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
2
mouse.c
2
mouse.c
|
@ -116,7 +116,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 = screen_get_bycoord(x, y)) != c->screen)
|
if((newscreen = screen_get_bycoord(c->screen, 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;
|
||||||
|
|
4
screen.c
4
screen.c
|
@ -110,14 +110,14 @@ 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
|
||||||
screen_get_bycoord(int x, int y)
|
screen_get_bycoord(int screen, int x, int y)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
Area area;
|
Area area;
|
||||||
|
|
||||||
/* don't waste our time */
|
/* don't waste our time */
|
||||||
if(!XineramaIsActive(globalconf.display))
|
if(!XineramaIsActive(globalconf.display))
|
||||||
return DefaultScreen(globalconf.display);
|
return screen;
|
||||||
|
|
||||||
for(i = 0; i < globalconf.nscreen; i++)
|
for(i = 0; i < globalconf.nscreen; i++)
|
||||||
{
|
{
|
||||||
|
|
2
screen.h
2
screen.h
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
Area screen_get_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 screen_get_bycoord(int, int);
|
int screen_get_bycoord(int, 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);
|
||||||
|
|
Loading…
Reference in New Issue