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))
|
||||
{
|
||||
real_screen = screen;
|
||||
for(i = 0; i < num; i++)
|
||||
{
|
||||
/* XGetWindowAttributes return 1 on success */
|
||||
|
@ -87,8 +86,7 @@ scan()
|
|||
continue;
|
||||
if(wa.map_state == IsViewable || window_getstate(wins[i]) == IconicState)
|
||||
{
|
||||
if(screen == 0)
|
||||
real_screen = screen_get_bycoord(wa.x, wa.y);
|
||||
real_screen = screen_get_bycoord(screen, wa.x, wa.y);
|
||||
client_manage(wins[i], &wa, real_screen);
|
||||
}
|
||||
}
|
||||
|
@ -100,8 +98,7 @@ scan()
|
|||
if(XGetTransientForHint(globalconf.display, wins[i], &d1)
|
||||
&& (wa.map_state == IsViewable || window_getstate(wins[i]) == IconicState))
|
||||
{
|
||||
if(screen == 0)
|
||||
real_screen = screen_get_bycoord(wa.x, wa.y);
|
||||
real_screen = screen_get_bycoord(screen, wa.x, wa.y);
|
||||
client_manage(wins[i], &wa, real_screen);
|
||||
}
|
||||
}
|
||||
|
|
5
client.c
5
client.c
|
@ -22,6 +22,7 @@
|
|||
#include <stdio.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/extensions/shape.h>
|
||||
#include <X11/extensions/Xinerama.h>
|
||||
|
||||
#include "client.h"
|
||||
#include "tag.h"
|
||||
|
@ -253,7 +254,7 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
|
|||
|
||||
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,
|
||||
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
|
||||
|| 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.y = wc.y = geometry.y;
|
||||
|
|
19
event.c
19
event.c
|
@ -24,6 +24,7 @@
|
|||
#include <X11/Xutil.h>
|
||||
#include <X11/extensions/shape.h>
|
||||
#include <X11/extensions/Xrandr.h>
|
||||
#include <X11/extensions/Xinerama.h>
|
||||
|
||||
#include "screen.h"
|
||||
#include "event.h"
|
||||
|
@ -134,7 +135,7 @@ handle_event_buttonpress(XEvent *e)
|
|||
&wdummy, &x, &y, &i,
|
||||
&i, &udummy))
|
||||
{
|
||||
screen = screen_get_bycoord(x, y);
|
||||
screen = screen_get_bycoord(screen, x, y);
|
||||
handle_mouse_button_press(screen, ev->button, ev->state,
|
||||
globalconf.buttons.root, NULL);
|
||||
return;
|
||||
|
@ -273,8 +274,7 @@ handle_event_keypress(XEvent * e)
|
|||
* only screen in Xinerama, so we can ask for a better screen
|
||||
* number with screen_get_bycoord: we'll get 0 in Zaphod mode
|
||||
* so it's the same, or maybe the real Xinerama screen */
|
||||
if(screen == 0)
|
||||
screen = screen_get_bycoord(x, y);
|
||||
screen = screen_get_bycoord(screen, x, y);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -315,7 +315,7 @@ handle_event_maprequest(XEvent *e)
|
|||
{
|
||||
static XWindowAttributes wa;
|
||||
XMapRequestEvent *ev = &e->xmaprequest;
|
||||
int screen, x, y, d;
|
||||
int screen = 0, x, y, d;
|
||||
unsigned int m;
|
||||
Window dummy;
|
||||
|
||||
|
@ -325,10 +325,13 @@ handle_event_maprequest(XEvent *e)
|
|||
return;
|
||||
if(!client_get_bywin(globalconf.clients, ev->window))
|
||||
{
|
||||
for(screen = 0; wa.screen != ScreenOfDisplay(e->xany.display, screen); screen++);
|
||||
if(screen == 0 && XQueryPointer(e->xany.display, RootWindow(e->xany.display, screen),
|
||||
&dummy, &dummy, &x, &y, &d, &d, &m))
|
||||
screen = screen_get_bycoord(x, y);
|
||||
if(XineramaIsActive(globalconf.display)
|
||||
&& XQueryPointer(e->xany.display, RootWindow(e->xany.display, screen),
|
||||
&dummy, &dummy, &x, &y, &d, &d, &m))
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
6
ewmh.c
6
ewmh.c
|
@ -149,10 +149,9 @@ ewmh_update_net_client_list(int phys_screen)
|
|||
int n = 0;
|
||||
|
||||
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++)
|
||||
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);
|
||||
|
||||
p_delete(&wins);
|
||||
XFlush(globalconf.display);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
2
mouse.c
2
mouse.c
|
@ -116,7 +116,7 @@ uicb_client_movemouse(int screen, char *arg __attribute__ ((unused)))
|
|||
XQueryPointer(globalconf.display,
|
||||
RootWindow(globalconf.display, phys_screen),
|
||||
&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);
|
||||
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
|
||||
*/
|
||||
int
|
||||
screen_get_bycoord(int x, int y)
|
||||
screen_get_bycoord(int screen, int x, int y)
|
||||
{
|
||||
int i;
|
||||
Area area;
|
||||
|
||||
/* don't waste our time */
|
||||
if(!XineramaIsActive(globalconf.display))
|
||||
return DefaultScreen(globalconf.display);
|
||||
return screen;
|
||||
|
||||
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 get_display_area(int, Statusbar *, Padding *);
|
||||
int screen_get_bycoord(int, int);
|
||||
int screen_get_bycoord(int, int, int);
|
||||
void screen_build_screens(void);
|
||||
int get_phys_screen(int);
|
||||
void move_client_to_screen(Client *, int, Bool);
|
||||
|
|
Loading…
Reference in New Issue