Move position-changed / size-changed signals to the MetaWindow

They fit more appropriately over here...

https://bugzilla.gnome.org/show_bug.cgi?id=720631
This commit is contained in:
Jasper St. Pierre 2013-12-06 15:39:24 -05:00
parent e3a93db712
commit a538f36524
2 changed files with 42 additions and 35 deletions

View File

@ -35,15 +35,6 @@
#include "monitor-private.h"
#include "meta-cullable.h"
enum {
POSITION_CHANGED,
SIZE_CHANGED,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = {0};
struct _MetaWindowActorPrivate
{
MetaWindow *window;
@ -237,19 +228,6 @@ meta_window_actor_class_init (MetaWindowActorClass *klass)
g_object_class_install_property (object_class,
PROP_SHADOW_CLASS,
pspec);
signals[POSITION_CHANGED] =
g_signal_new ("position-changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL, NULL,
G_TYPE_NONE, 0);
signals[SIZE_CHANGED] =
g_signal_new ("size-changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL, NULL,
G_TYPE_NONE, 0);
}
static void
@ -1344,8 +1322,6 @@ meta_window_actor_sync_actor_geometry (MetaWindowActor *self,
window_rect.x, window_rect.y);
clutter_actor_set_size (CLUTTER_ACTOR (self),
window_rect.width, window_rect.height);
g_signal_emit (self, signals[POSITION_CHANGED], 0);
}
void
@ -1719,17 +1695,6 @@ check_needs_pixmap (MetaWindowActor *self)
g_warning ("NOTE: Not using GLX TFP!\n");
meta_shaped_texture_set_texture (META_SHAPED_TEXTURE (priv->actor), texture);
/* ::size-changed is supposed to refer to meta_window_get_frame_rect().
* Emitting it here works pretty much OK because a new value of the
* *input* rect (which is the outer rect with the addition of invisible
* borders) forces a new pixmap and we get here. In the rare case where
* a change to the window size was exactly balanced by a change to the
* invisible borders, we would miss emitting the signal. We would also
* emit spurious signals when we get a new pixmap without a new size,
* but that should be mostly harmless.
*/
g_signal_emit (self, signals[SIZE_CHANGED], 0);
}
priv->needs_pixmap = FALSE;

View File

@ -191,6 +191,8 @@ enum
FOCUS,
RAISED,
UNMANAGED,
SIZE_CHANGED,
POSITION_CHANGED,
LAST_SIGNAL
};
@ -595,6 +597,40 @@ meta_window_class_init (MetaWindowClass *klass)
G_STRUCT_OFFSET (MetaWindowClass, unmanaged),
NULL, NULL, NULL,
G_TYPE_NONE, 0);
/**
* MetaWindow::position-changed:
* @window: a #MetaWindow
*
* This is emitted when the position of a window might
* have changed. Specifically, this is emitted when the
* position of the toplevel window has changed, or when
* the position of the client window has changed.
*/
window_signals[POSITION_CHANGED] =
g_signal_new ("position-changed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 0);
/**
* MetaWindow::size-changed:
* @window: a #MetaWindow
*
* This is emitted when the position of a window might
* have changed. Specifically, this is emitted when the
* size of the toplevel window has changed, or when the
* size of the client window has changed.
*/
window_signals[SIZE_CHANGED] =
g_signal_new ("size-changed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 0);
}
static void
@ -5151,6 +5187,12 @@ meta_window_move_resize_internal (MetaWindow *window,
else if (is_user_action)
save_user_window_placement (window);
if (need_move_client || need_move_frame)
g_signal_emit (window, window_signals[POSITION_CHANGED], 0);
if (need_resize_client || need_resize_frame)
g_signal_emit (window, window_signals[SIZE_CHANGED], 0);
if (need_move_frame || need_resize_frame ||
need_move_client || need_resize_client ||
did_placement)