summaryrefslogtreecommitdiff
path: root/src/window.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c139
1 files changed, 49 insertions, 90 deletions
diff --git a/src/window.c b/src/window.c
index 41e8287b..cd46f6c9 100644
--- a/src/window.c
+++ b/src/window.c
@@ -5173,20 +5173,6 @@ update_struts (MetaWindow *window)
window->top_strut = struts[2];
window->bottom_strut = struts[3];
- meta_verbose ("_NET_WM_STRUT struts %d %d %d %d for window %s\n",
- window->left_strut, window->right_strut,
- window->top_strut, window->bottom_strut,
- window->desc);
-
- if (window->left_strut < 0)
- window->left_strut = 0;
- if (window->right_strut < 0)
- window->right_strut = 0;
- if (window->top_strut < 0)
- window->top_strut = 0;
- if (window->bottom_strut < 0)
- window->bottom_strut = 0;
-
meta_verbose ("Using _NET_WM_STRUT struts %d %d %d %d for window %s\n",
window->left_strut, window->right_strut,
window->top_strut, window->bottom_strut,
@@ -5894,14 +5880,6 @@ constrain_position (MetaWindow *window,
/* Now change NW limit to reflect amount offscreen in SE direction */
if (offscreen_w > 0)
nw_x -= offscreen_w;
-
- /* do it for top of window for undecorated windows,
- * since losing the titlebar isn't really an issue anyway,
- * and it fixes fullscreen mode for stuff like Xine.
- * but don't lose the titlebar on decorated windows.
- */
- if (!window->decorated && offscreen_h > 0)
- nw_y -= offscreen_h;
/* Limit movement off the right/bottom.
* Remember, we're constraining StaticGravity position.
@@ -6337,78 +6315,61 @@ update_resize (MetaWindow *window,
typedef struct
{
- const XEvent *current_event;
+ XEvent prev_event;
+ gboolean done;
int count;
- Time last_time;
-} EventScannerData;
+} CompressEventData;
static Bool
-find_last_time_predicate (Display *display,
+compress_event_predicate (Display *display,
XEvent *xevent,
XPointer arg)
{
- EventScannerData *esd = (void*) arg;
-
- if (esd->current_event->type == xevent->type &&
- esd->current_event->xany.window == xevent->xany.window)
+ CompressEventData *ced = (void*) arg;
+
+ if (ced->done)
+ return False;
+ else if (ced->prev_event.type == xevent->type &&
+ ced->prev_event.xany.window == xevent->xany.window)
{
- esd->count += 1;
- esd->last_time = xevent->xmotion.time;
+ ced->count += 1;
+ return True;
}
-
- return False;
+ else if (xevent->type != Expose &&
+ xevent->type != ConfigureNotify &&
+ xevent->type != PropertyNotify)
+ {
+ /* Don't compress across most unrelated events, just to be safe */
+ ced->done = TRUE;
+ return False;
+ }
+ else
+ return False;
}
-static gboolean
-check_use_this_motion_notify (MetaWindow *window,
- XEvent *event)
+static void
+maybe_replace_with_newer_event (MetaWindow *window,
+ XEvent *event)
{
- EventScannerData esd;
- XEvent useless;
-
- /* This code is copied from Owen's GDK code. */
+ XEvent new_event;
+ CompressEventData ced;
- if (window->display->grab_motion_notify_time != 0)
- {
- /* == is really the right test, but I'm all for paranoia */
- if (window->display->grab_motion_notify_time <=
- event->xmotion.time)
- {
- meta_topic (META_DEBUG_RESIZING,
- "Arrived at event with time %lu (waiting for %lu), using it\n",
- (unsigned long) event->xmotion.time,
- (unsigned long) window->display->grab_motion_notify_time);
- window->display->grab_motion_notify_time = 0;
- return TRUE;
- }
- else
- return FALSE; /* haven't reached the saved timestamp yet */
- }
-
- esd.current_event = event;
- esd.count = 0;
- esd.last_time = 0;
+ /* Chew up all events of the same type on the same window */
- /* "useless" isn't filled in because the predicate never returns True */
- XCheckIfEvent (window->display->xdisplay,
- &useless,
- find_last_time_predicate,
- (XPointer) &esd);
+ ced.count = 0;
+ ced.done = FALSE;
+ ced.prev_event = *event;
+ while (XCheckIfEvent (window->display->xdisplay,
+ &new_event,
+ compress_event_predicate,
+ (void*) &ced.prev_event))
+ ced.prev_event = new_event;
- if (esd.count > 0)
- meta_topic (META_DEBUG_RESIZING,
- "Will skip %d motion events and use the event with time %lu\n",
- esd.count, (unsigned long) esd.last_time);
-
- if (esd.last_time == 0)
- return TRUE;
- else
+ if (ced.count > 0)
{
- /* Save this timestamp, and ignore all motion notify
- * until we get to the one with this stamp.
- */
- window->display->grab_motion_notify_time = esd.last_time;
- return FALSE;
+ meta_topic (META_DEBUG_RESIZING,
+ "Compressed %d motion events\n", ced.count);
+ *event = ced.prev_event;
}
}
@@ -6482,23 +6443,21 @@ meta_window_handle_mouse_grab_op_event (MetaWindow *window,
{
if (event->xmotion.root == window->screen->xroot)
{
- if (check_use_this_motion_notify (window,
- event))
- update_move (window,
- event->xmotion.state,
- event->xmotion.x_root,
- event->xmotion.y_root);
+ maybe_replace_with_newer_event (window, event);
+ update_move (window,
+ event->xmotion.state,
+ event->xmotion.x_root,
+ event->xmotion.y_root);
}
}
else if (meta_grab_op_is_resizing (window->display->grab_op))
{
if (event->xmotion.root == window->screen->xroot)
{
- if (check_use_this_motion_notify (window,
- event))
- update_resize (window,
- event->xmotion.x_root,
- event->xmotion.y_root);
+ maybe_replace_with_newer_event (window, event);
+ update_resize (window,
+ event->xmotion.x_root,
+ event->xmotion.y_root);
}
}
break;