diff --git a/src/core/window-private.h b/src/core/window-private.h index fe4abf71a..fc673f64e 100644 --- a/src/core/window-private.h +++ b/src/core/window-private.h @@ -462,8 +462,6 @@ struct _MetaWindow /* Bypass compositor hints */ guint bypass_compositor; - - MetaResizePopup *grab_resize_popup; }; struct _MetaWindowClass @@ -479,6 +477,10 @@ struct _MetaWindowClass void (*kill) (MetaWindow *window); void (*focus) (MetaWindow *window, guint32 timestamp); + void (*grab_op_began) (MetaWindow *window, + MetaGrabOp op); + void (*grab_op_ended) (MetaWindow *window, + MetaGrabOp op); void (*move_resize_internal) (MetaWindow *window, int gravity, MetaRectangle requested_rect, diff --git a/src/core/window.c b/src/core/window.c index a10845e5d..b6628c22e 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -40,7 +40,6 @@ #include "place.h" #include #include -#include "resizepopup.h" #include "constraints.h" #include "mutter-enum-types.h" #include "core.h" @@ -194,6 +193,19 @@ prefs_changed_callback (MetaPreference pref, } } +static void +meta_window_real_grab_op_began (MetaWindow *window, + MetaGrabOp op) +{ +} + +static void +meta_window_real_grab_op_ended (MetaWindow *window, + MetaGrabOp op) +{ + window->shaken_loose = FALSE; +} + static gboolean meta_window_real_update_struts (MetaWindow *window) { @@ -365,6 +377,8 @@ meta_window_class_init (MetaWindowClass *klass) object_class->get_property = meta_window_get_property; object_class->set_property = meta_window_set_property; + klass->grab_op_began = meta_window_real_grab_op_began; + klass->grab_op_ended = meta_window_real_grab_op_ended; klass->update_struts = meta_window_real_update_struts; klass->get_default_skip_hints = meta_window_real_get_default_skip_hints; @@ -4141,23 +4155,6 @@ meta_window_update_monitor (MetaWindow *window) } } -static void -meta_window_refresh_resize_popup (MetaWindow *window) -{ - MetaRectangle rect; - - meta_window_get_client_root_coords (window, &rect); - - meta_ui_resize_popup_set (window->grab_resize_popup, - rect, - window->size_hints.base_width, - window->size_hints.base_height, - window->size_hints.width_inc, - window->size_hints.height_inc); - - meta_ui_resize_popup_set_showing (window->grab_resize_popup, TRUE); -} - void meta_window_move_resize_internal (MetaWindow *window, MetaMoveResizeFlags flags, @@ -4334,9 +4331,6 @@ meta_window_move_resize_internal (MetaWindow *window, meta_topic (META_DEBUG_GEOMETRY, "Size/position not modified\n"); } - if (window->grab_resize_popup) - meta_window_refresh_resize_popup (window); - meta_window_update_monitor (window); /* Invariants leaving this function are: @@ -8903,29 +8897,12 @@ void meta_window_grab_op_began (MetaWindow *window, MetaGrabOp op) { - if (meta_grab_op_is_resizing (op)) - { - if (window->sync_request_counter != None) - meta_window_create_sync_request_alarm (window); - - if (window->size_hints.width_inc > 1 || window->size_hints.height_inc > 1) - { - window->grab_resize_popup = meta_ui_resize_popup_new (window->display->xdisplay, - window->screen->number); - meta_window_refresh_resize_popup (window); - } - } + META_WINDOW_GET_CLASS (window)->grab_op_began (window, op); } void meta_window_grab_op_ended (MetaWindow *window, MetaGrabOp op) { - window->shaken_loose = FALSE; - - if (window->grab_resize_popup) - { - meta_ui_resize_popup_free (window->grab_resize_popup); - window->grab_resize_popup = NULL; - } + META_WINDOW_GET_CLASS (window)->grab_op_ended (window, op); } diff --git a/src/x11/window-x11-private.h b/src/x11/window-x11-private.h index e288439bb..9afbe8cf9 100644 --- a/src/x11/window-x11-private.h +++ b/src/x11/window-x11-private.h @@ -50,6 +50,8 @@ struct _MetaWindowX11Private guint using_net_wm_visible_name : 1; /* tracked so we can clear it */ Atom type_atom; + + MetaResizePopup *grab_resize_popup; }; G_END_DECLS diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c index 507822cee..21fb1e18c 100644 --- a/src/x11/window-x11.c +++ b/src/x11/window-x11.c @@ -44,6 +44,7 @@ #include "window-private.h" #include "window-props.h" #include "xprops.h" +#include "resizepopup.h" struct _MetaWindowX11Class { @@ -498,6 +499,60 @@ meta_window_x11_focus (MetaWindow *window, } } +static void +meta_window_refresh_resize_popup (MetaWindow *window) +{ + MetaWindowX11 *window_x11 = META_WINDOW_X11 (window); + MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11); + MetaRectangle rect; + + meta_window_get_client_root_coords (window, &rect); + + meta_ui_resize_popup_set (priv->grab_resize_popup, + rect, + window->size_hints.base_width, + window->size_hints.base_height, + window->size_hints.width_inc, + window->size_hints.height_inc); + + meta_ui_resize_popup_set_showing (priv->grab_resize_popup, TRUE); +} + +static void +meta_window_x11_grab_op_began (MetaWindow *window, + MetaGrabOp op) +{ + MetaWindowX11 *window_x11 = META_WINDOW_X11 (window); + MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11); + + if (meta_grab_op_is_resizing (op)) + { + if (window->sync_request_counter != None) + meta_window_create_sync_request_alarm (window); + + if (window->size_hints.width_inc > 1 || window->size_hints.height_inc > 1) + { + priv->grab_resize_popup = meta_ui_resize_popup_new (window->display->xdisplay, + window->screen->number); + meta_window_refresh_resize_popup (window); + } + } +} + +static void +meta_window_x11_grab_op_ended (MetaWindow *window, + MetaGrabOp op) +{ + MetaWindowX11 *window_x11 = META_WINDOW_X11 (window); + MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11); + + if (priv->grab_resize_popup) + { + meta_ui_resize_popup_free (priv->grab_resize_popup); + priv->grab_resize_popup = NULL; + } +} + static void update_net_frame_extents (MetaWindow *window) { @@ -619,6 +674,8 @@ meta_window_x11_move_resize_internal (MetaWindow *window, MetaMoveResizeFlags flags, MetaMoveResizeResultFlags *result) { + MetaWindowX11 *window_x11 = META_WINDOW_X11 (window); + MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11); int root_x_nw, root_y_nw; int w, h; int client_move_x, client_move_y; @@ -891,6 +948,9 @@ meta_window_x11_move_resize_internal (MetaWindow *window, if (need_configure_notify) send_configure_notify (window); + if (priv->grab_resize_popup) + meta_window_refresh_resize_popup (window); + if (frame_shape_changed) *result |= META_MOVE_RESIZE_RESULT_FRAME_SHAPE_CHANGED; if (need_move_client || need_move_frame) @@ -1085,6 +1145,8 @@ meta_window_x11_class_init (MetaWindowX11Class *klass) window_class->delete = meta_window_x11_delete; window_class->kill = meta_window_x11_kill; window_class->focus = meta_window_x11_focus; + window_class->grab_op_began = meta_window_x11_grab_op_began; + window_class->grab_op_ended = meta_window_x11_grab_op_ended; window_class->move_resize_internal = meta_window_x11_move_resize_internal; window_class->update_struts = meta_window_x11_update_struts; window_class->get_default_skip_hints = meta_window_x11_get_default_skip_hints;