summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann <sandmann@redhat.com>2005-01-21 19:39:58 +0000
committerSøren Sandmann Pedersen <ssp@src.gnome.org>2005-01-21 19:39:58 +0000
commit33bf5ac8ee0db449d512f2f7d14a22f592cb71bc (patch)
treec992d57f55b4e47b0b898ec9264e28ee3f7f81aa
parent98442a04674f5512340019e7b969a6a8d0615a33 (diff)
downloadmetacity-33bf5ac8ee0db449d512f2f7d14a22f592cb71bc.tar.gz
s/new_h/new_y/
Fri Jan 21 14:36:32 2005 Søren Sandmann <sandmann@redhat.com> * src/window.c (update_resize): s/new_h/new_y/ * src/display.c (use_this_motion_notify): Use this code here from window.c
-rw-r--r--ChangeLog12
-rw-r--r--src/display.c107
-rw-r--r--src/display.h1
-rw-r--r--src/window.c85
4 files changed, 109 insertions, 96 deletions
diff --git a/ChangeLog b/ChangeLog
index 56abaea2..dc9c1484 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+Fri Jan 21 14:36:32 2005 Søren Sandmann <sandmann@redhat.com>
+
+ * src/window.c (update_resize): s/new_h/new_y/
+
+ * src/display.c (use_this_motion_notify): Use this code here from window.c
+
+Fri Jan 21 11:26:27 2005 Søren Sandmann <sandmann@redhat.com>
+
+ * src/window.c: Some cleanups
+ * src/ui.c: Make frame windows override redirect so clients can
+ resize them.
+
Thu Jan 20 16:13:47 2005 Søren Sandmann <sandmann@redhat.com>
* src/compositor.c, src/cwindow.c: Remove old, unsued code. Add a
diff --git a/src/display.c b/src/display.c
index 430267d7..7b498a86 100644
--- a/src/display.c
+++ b/src/display.c
@@ -1107,17 +1107,6 @@ meta_grab_op_is_resizing_west (MetaGrabOp op)
}
gboolean
-meta_grab_op_is_resizing_south (MetaGrabOp op)
-{
- return (op == META_GRAB_OP_RESIZING_SW ||
- op == META_GRAB_OP_RESIZING_SE ||
- op == META_GRAB_OP_RESIZING_S ||
- op == META_GRAB_OP_KEYBOARD_RESIZING_SW ||
- op == META_GRAB_OP_KEYBOARD_RESIZING_SE ||
- op == META_GRAB_OP_KEYBOARD_RESIZING_S);
-}
-
-gboolean
meta_grab_op_is_resizing_north (MetaGrabOp op)
{
return (op == META_GRAB_OP_RESIZING_NW ||
@@ -1129,6 +1118,17 @@ meta_grab_op_is_resizing_north (MetaGrabOp op)
}
gboolean
+meta_grab_op_is_resizing_south (MetaGrabOp op)
+{
+ return (op == META_GRAB_OP_RESIZING_SW ||
+ op == META_GRAB_OP_RESIZING_SE ||
+ op == META_GRAB_OP_RESIZING_S ||
+ op == META_GRAB_OP_KEYBOARD_RESIZING_SW ||
+ op == META_GRAB_OP_KEYBOARD_RESIZING_SE ||
+ op == META_GRAB_OP_KEYBOARD_RESIZING_S);
+}
+
+gboolean
meta_grab_op_is_moving (MetaGrabOp op)
{
switch (op)
@@ -1431,6 +1431,84 @@ handle_net_restack_window (MetaDisplay* display,
}
#endif
+
+typedef struct
+{
+ const XEvent *current_event;
+ int count;
+ Time last_time;
+} EventScannerData;
+
+static Bool
+find_last_time_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)
+ {
+ esd->count += 1;
+ esd->last_time = xevent->xmotion.time;
+ }
+
+ return False;
+}
+
+static gboolean
+use_this_motion_notify (MetaDisplay *display,
+ XEvent *event)
+{
+ EventScannerData esd;
+ XEvent useless;
+
+ /* This code is copied from Owen's GDK code. */
+
+ if (display->grab_motion_notify_time != 0)
+ {
+ /* == is really the right test, but I'm all for paranoia */
+ if (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) display->grab_motion_notify_time);
+ 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;
+
+ /* "useless" isn't filled in because the predicate never returns True */
+ XCheckIfEvent (display->xdisplay,
+ &useless,
+ find_last_time_predicate,
+ (XPointer) &esd);
+
+ 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
+ {
+ /* Save this timestamp, and ignore all motion notify
+ * until we get to the one with this stamp.
+ */
+ display->grab_motion_notify_time = esd.last_time;
+ return FALSE;
+ }
+}
+
static gboolean
event_callback (XEvent *event,
gpointer data)
@@ -1778,8 +1856,11 @@ event_callback (XEvent *event,
case MotionNotify:
if (display->grab_window == window &&
event->xany.serial >= display->grab_start_serial &&
- grab_op_is_mouse (display->grab_op))
- meta_window_handle_mouse_grab_op_event (window, event);
+ grab_op_is_mouse (display->grab_op) &&
+ use_this_motion_notify (display, event))
+ {
+ meta_window_handle_mouse_grab_op_event (window, event);
+ }
break;
case EnterNotify:
if (display->grab_window == window &&
diff --git a/src/display.h b/src/display.h
index 506e7caa..58c43150 100644
--- a/src/display.h
+++ b/src/display.h
@@ -528,5 +528,4 @@ void meta_display_focus_the_no_focus_window (MetaDisplay *display,
void meta_display_queue_autoraise_callback (MetaDisplay *display,
MetaWindow *window);
void meta_display_remove_autoraise_callback (MetaDisplay *display);
-
#endif
diff --git a/src/window.c b/src/window.c
index 03d844a7..9def4ac4 100644
--- a/src/window.c
+++ b/src/window.c
@@ -6223,7 +6223,7 @@ update_resize (MetaWindow *window,
else if (meta_grab_op_is_resizing_north (window->display->grab_op))
{
new_h -= dy;
- new_h += dy;
+ new_y += dy;
}
if (!check_moveresize_frequency (window, &remaining) && !force)
@@ -6300,83 +6300,6 @@ update_resize (MetaWindow *window,
}
}
-typedef struct
-{
- const XEvent *current_event;
- int count;
- Time last_time;
-} EventScannerData;
-
-static Bool
-find_last_time_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)
- {
- esd->count += 1;
- esd->last_time = xevent->xmotion.time;
- }
-
- return False;
-}
-
-static gboolean
-check_use_this_motion_notify (MetaWindow *window,
- XEvent *event)
-{
- EventScannerData esd;
- XEvent useless;
-
- /* This code is copied from Owen's GDK code. */
-
- 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;
-
- /* "useless" isn't filled in because the predicate never returns True */
- XCheckIfEvent (window->display->xdisplay,
- &useless,
- find_last_time_predicate,
- (XPointer) &esd);
-
- 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
- {
- /* 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;
- }
-}
-
static void
handle_moving_event (MetaWindow *window, XEvent *event)
{
@@ -6389,8 +6312,7 @@ handle_moving_event (MetaWindow *window, XEvent *event)
meta_display_end_grab_op (window->display, event->xbutton.time);
}
else if (event->type == MotionNotify &&
- event->xmotion.root == window->screen->xroot &&
- check_use_this_motion_notify (window, event))
+ event->xmotion.root == window->screen->xroot)
{
update_move (window,
event->xmotion.state,
@@ -6422,8 +6344,7 @@ handle_resizing_event (MetaWindow *window, XEvent *event)
meta_display_end_grab_op (window->display, event->xbutton.time);
}
else if (event->type == MotionNotify &&
- event->xmotion.root == window->screen->xroot &&
- check_use_this_motion_notify (window, event))
+ event->xmotion.root == window->screen->xroot)
{
update_resize (window,
event->xmotion.x_root,