grab the pointer when windows move them selves so no enter events happen. i wonder if this will cause but reports. it still does for restacking though..

little cleanup in client.c, and remove client_configure macro which was now
redundant
This commit is contained in:
Dana Jansens 2007-05-17 01:38:01 +00:00
parent 619eeaa962
commit 2ca83f6713
4 changed files with 40 additions and 30 deletions

View file

@ -1771,8 +1771,8 @@ void client_reconfigure(ObClient *self)
/* by making this pass FALSE for user, we avoid the emacs event storm where /* by making this pass FALSE for user, we avoid the emacs event storm where
every configurenotify causes an update in its normal hints, i think this every configurenotify causes an update in its normal hints, i think this
is generally what we want anyways... */ is generally what we want anyways... */
client_configure(self, self->area.x, self->area.y, client_configure_full(self, self->area.x, self->area.y,
self->area.width, self->area.height, FALSE, TRUE); self->area.width, self->area.height, FALSE, TRUE);
} }
void client_update_wmhints(ObClient *self) void client_update_wmhints(ObClient *self)
@ -2710,6 +2710,7 @@ void client_configure_full(ObClient *self, gint x, gint y, gint w, gint h,
gint oldw, oldh; gint oldw, oldh;
gboolean send_resize_client; gboolean send_resize_client;
gboolean moved = FALSE, resized = FALSE; gboolean moved = FALSE, resized = FALSE;
gboolean fmoved, fresized;
guint fdecor = self->frame->decorations; guint fdecor = self->frame->decorations;
gboolean fhorz = self->frame->max_horz; gboolean fhorz = self->frame->max_horz;
gint logicalw, logicalh; gint logicalw, logicalh;
@ -2745,10 +2746,12 @@ void client_configure_full(ObClient *self, gint x, gint y, gint w, gint h,
} }
/* find the frame's dimensions and move/resize it */ /* find the frame's dimensions and move/resize it */
fmoved = moved;
fresized = resized;
if (self->decorations != fdecor || self->max_horz != fhorz) if (self->decorations != fdecor || self->max_horz != fhorz)
moved = resized = TRUE; fmoved = fresized = TRUE;
if (moved || resized) if (fmoved || fresized)
frame_adjust_area(self->frame, moved, resized, FALSE); frame_adjust_area(self->frame, fmoved, fresized, FALSE);
if ((!user || (user && final)) && !resized) if ((!user || (user && final)) && !resized)
{ {
@ -3304,19 +3307,26 @@ void client_set_state(ObClient *self, Atom action, glong data1, glong data2)
client_calc_layer(self); client_calc_layer(self);
} }
/* These things below can change focus so we can't grab pointer for them */
ungrab_pointer();
if (modal != self->modal) { if (modal != self->modal) {
self->modal = modal; self->modal = modal;
/* when a window changes modality, then its stacking order with its /* when a window changes modality, then its stacking order with its
transients needs to change */ transients needs to change */
stacking_raise(CLIENT_AS_WINDOW(self)); stacking_raise(CLIENT_AS_WINDOW(self));
/* These things below can change focus so we can't grab pointer for
them. Note how we have two ungrab_pointers.. */
ungrab_pointer();
/* it also may get focused. if something is focused that shouldn't /* it also may get focused. if something is focused that shouldn't
be focused anymore, then move the focus */ be focused anymore, then move the focus */
if (focus_client && client_focus_target(focus_client) != focus_client) if (focus_client && client_focus_target(focus_client) != focus_client)
client_focus(focus_client); client_focus(focus_client);
} }
else
/* These things below can change focus so we can't grab pointer for
them. Note how we have two ungrab_pointers.. */
ungrab_pointer();
if (iconic != self->iconic) if (iconic != self->iconic)
client_iconify(self, iconic, FALSE, FALSE); client_iconify(self, iconic, FALSE, FALSE);
@ -3576,13 +3586,6 @@ void client_set_undecorated(ObClient *self, gboolean undecorated)
if (self->undecorated != undecorated) { if (self->undecorated != undecorated) {
self->undecorated = undecorated; self->undecorated = undecorated;
client_setup_decor_and_functions(self); client_setup_decor_and_functions(self);
/* Make sure the client knows it might have moved. Maybe there is a
* better way of doing this so only one client_configure is sent, but
* since 125 of these are sent per second when moving the window (with
* user = FALSE) i doubt it matters much.
*/
client_configure(self, self->area.x, self->area.y,
self->area.width, self->area.height, TRUE, TRUE);
client_change_state(self); /* reflect this in the state hints */ client_change_state(self); /* reflect this in the state hints */
} }
} }

View file

@ -369,15 +369,12 @@ void client_convert_gravity(ObClient *self, gint gravity, gint *x, gint *y,
gint w, gint h); gint w, gint h);
#define client_move(self, x, y) \ #define client_move(self, x, y) \
client_configure(self, x, y, self->area.width, self->area.height, \ client_configure_full(self, x, y, self->area.width, self->area.height, \
TRUE, TRUE) TRUE, TRUE)
#define client_resize(self, w, h) \ #define client_resize(self, w, h) \
client_configure(self, self->area.x, self->area.y, w, h, TRUE, TRUE) client_configure_full(self, self->area.x, self->area.y, w, h, TRUE, TRUE)
#define client_move_resize(self, x, y, w, h) \ #define client_move_resize(self, x, y, w, h) \
client_configure(self, x, y, w, h, TRUE, TRUE) client_configure_full(self, x, y, w, h, TRUE, TRUE)
#define client_configure(self, x, y, w, h, user, final) \
client_configure_full(self, x, y, w, h, user, final)
/*! Figure out where a window will end up and what size it will be if you /*! Figure out where a window will end up and what size it will be if you
told it to move/resize to these coordinates. told it to move/resize to these coordinates.

View file

@ -28,6 +28,7 @@
#include "config.h" #include "config.h"
#include "screen.h" #include "screen.h"
#include "frame.h" #include "frame.h"
#include "grab.h"
#include "menu.h" #include "menu.h"
#include "menuframe.h" #include "menuframe.h"
#include "keyboard.h" #include "keyboard.h"
@ -1081,7 +1082,11 @@ static void event_handle_client(ObClient *client, XEvent *e)
if (config) { if (config) {
client_find_onscreen(client, &x, &y, w, h, FALSE); client_find_onscreen(client, &x, &y, w, h, FALSE);
/* don't create enter events from clients moving themselves */
grab_pointer(FALSE, FALSE, OB_CURSOR_NONE);
client_configure_full(client, x, y, w, h, FALSE, TRUE); client_configure_full(client, x, y, w, h, FALSE, TRUE);
ungrab_pointer();
} }
break; break;
} }
@ -1258,7 +1263,11 @@ static void event_handle_client(ObClient *client, XEvent *e)
e->xclient.data.l[0] & 1 << 9, y); e->xclient.data.l[0] & 1 << 9, y);
client_convert_gravity(client, grav, &x, &y, w, h); client_convert_gravity(client, grav, &x, &y, w, h);
client_find_onscreen(client, &x, &y, w, h, FALSE); client_find_onscreen(client, &x, &y, w, h, FALSE);
client_configure(client, x, y, w, h, FALSE, TRUE);
/* don't create enter events from clients moving themselves */
grab_pointer(FALSE, FALSE, OB_CURSOR_NONE);
client_configure_full(client, x, y, w, h, FALSE, TRUE);
ungrab_pointer();
} else if (msgtype == prop_atoms.net_restack_window) { } else if (msgtype == prop_atoms.net_restack_window) {
if (e->xclient.data.l[0] != 2) { if (e->xclient.data.l[0] != 2) {
ob_debug_type(OB_DEBUG_APP_BUGS, ob_debug_type(OB_DEBUG_APP_BUGS,

View file

@ -295,9 +295,9 @@ void moveresize_end(gboolean cancel)
#endif #endif
get_resize_position(&x, &y, cancel); get_resize_position(&x, &y, cancel);
client_configure(moveresize_client, x, y, client_configure_full(moveresize_client, x, y,
(cancel ? start_cw : cur_x), (cancel ? start_cw : cur_x),
(cancel ? start_ch : cur_y), TRUE, TRUE); (cancel ? start_ch : cur_y), TRUE, TRUE);
} }
moveresize_in_progress = FALSE; moveresize_in_progress = FALSE;
@ -314,9 +314,9 @@ static void do_move(gboolean keyboard)
if (!keyboard) resist = config_resist_edge; if (!keyboard) resist = config_resist_edge;
resist_move_monitors(moveresize_client, resist, &cur_x, &cur_y); resist_move_monitors(moveresize_client, resist, &cur_x, &cur_y);
client_configure(moveresize_client, cur_x, cur_y, client_configure_full(moveresize_client, cur_x, cur_y,
moveresize_client->area.width, moveresize_client->area.width,
moveresize_client->area.height, TRUE, FALSE); moveresize_client->area.height, TRUE, FALSE);
if (config_resize_popup_show == 2) /* == "Always" */ if (config_resize_popup_show == 2) /* == "Always" */
popup_coords(moveresize_client, "%d x %d", popup_coords(moveresize_client, "%d x %d",
moveresize_client->frame->area.x, moveresize_client->frame->area.x,
@ -375,7 +375,8 @@ static void do_resize()
{ {
gint x, y; gint x, y;
get_resize_position(&x, &y, FALSE); get_resize_position(&x, &y, FALSE);
client_configure(moveresize_client, x, y, cur_x, cur_y, TRUE, FALSE); client_configure_full(moveresize_client,
x, y, cur_x, cur_y, TRUE, FALSE);
} }
/* this would be better with a fixed width font ... XXX can do it better /* this would be better with a fixed width font ... XXX can do it better