summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdel Gadllah <adel.gadllah@gmail.com>2010-09-30 18:35:12 +0200
committerAdel Gadllah <adel.gadllah@gmail.com>2010-09-30 18:35:12 +0200
commitf2ccf70f8dc19604dcd52892f3269461165cd293 (patch)
tree02e15f186c05736dc7d5dbfbc6d87953d33a9ef2
parentff04e383261330395a2e53fb4060ef26f9fa010c (diff)
downloadmutter-f2ccf70f8dc19604dcd52892f3269461165cd293.tar.gz
mutter-window: Don't track the window type twice
Currently mutter-window has its own type field, even though the same information is already present in meta_window. And while at it get rid of MetaCompWindowType, it is equally redundant. https://bugzilla.gnome.org/show_bug.cgi?id=630363
-rw-r--r--src/compositor/compositor.c8
-rw-r--r--src/compositor/mutter-window-private.h1
-rw-r--r--src/compositor/mutter-window.c46
-rw-r--r--src/compositor/plugins/default.c35
-rw-r--r--src/include/compositor.h23
-rw-r--r--src/include/mutter-window.h1
6 files changed, 37 insertions, 77 deletions
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index 918859daf..80435ab81 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -150,13 +150,7 @@ process_property_notify (MetaCompositor *compositor,
DEBUG_TRACE ("process_property_notify: net_wm_window_opacity\n");
return;
}
- else if (event->atom == meta_display_get_atom (display,
- META_ATOM__NET_WM_WINDOW_TYPE))
- {
- mutter_window_update_window_type (cw);
- DEBUG_TRACE ("process_property_notify: net_wm_type\n");
- return;
- }
+
DEBUG_TRACE ("process_property_notify: unknown\n");
}
diff --git a/src/compositor/mutter-window-private.h b/src/compositor/mutter-window-private.h
index 9b55f9823..c562f9389 100644
--- a/src/compositor/mutter-window-private.h
+++ b/src/compositor/mutter-window-private.h
@@ -32,7 +32,6 @@ void mutter_window_pre_paint (MutterWindow *self);
gboolean mutter_window_effect_in_progress (MutterWindow *cw);
void mutter_window_sync_actor_position (MutterWindow *cw);
void mutter_window_sync_visibility (MutterWindow *cw);
-void mutter_window_update_window_type (MutterWindow *cw);
void mutter_window_update_shape (MutterWindow *cw,
gboolean shaped);
void mutter_window_update_opacity (MutterWindow *cw);
diff --git a/src/compositor/mutter-window.c b/src/compositor/mutter-window.c
index 012d818db..5dc86b49d 100644
--- a/src/compositor/mutter-window.c
+++ b/src/compositor/mutter-window.c
@@ -34,7 +34,6 @@ struct _MutterWindowPrivate
ClutterActor *shadow;
Pixmap back_pixmap;
- MetaCompWindowType type;
Damage damage;
guint8 opacity;
@@ -324,8 +323,6 @@ mutter_window_constructed (GObject *object)
compositor = meta_display_get_compositor (display);
- mutter_window_update_window_type (self);
-
#ifdef HAVE_SHAPE
/* Listen for ShapeNotify events on the window */
if (meta_display_has_shape (display))
@@ -535,13 +532,6 @@ mutter_window_get_property (GObject *object,
}
}
-void
-mutter_window_update_window_type (MutterWindow *self)
-{
- MutterWindowPrivate *priv = self->priv;
- priv->type = (MetaCompWindowType) meta_window_get_window_type (priv->window);
-}
-
static gboolean
is_shaped (MetaDisplay *display, Window xwindow)
{
@@ -565,6 +555,7 @@ static gboolean
mutter_window_has_shadow (MutterWindow *self)
{
MutterWindowPrivate * priv = self->priv;
+ MetaWindowType window_type = meta_window_get_window_type (priv->window);
if (priv->no_shadow)
return FALSE;
@@ -618,17 +609,17 @@ mutter_window_has_shadow (MutterWindow *self)
/*
* Don't put shadow around DND icon windows
*/
- if (priv->type == META_COMP_WINDOW_DND ||
- priv->type == META_COMP_WINDOW_DESKTOP)
+ if (window_type == META_WINDOW_DND ||
+ window_type == META_WINDOW_DESKTOP)
{
meta_verbose ("Window 0x%x has no shadow as it is DND or Desktop\n",
(guint)priv->xwindow);
return FALSE;
}
- if (priv->type == META_COMP_WINDOW_MENU
+ if (window_type == META_WINDOW_MENU
#if 0
- || priv->type == META_COMP_WINDOW_DROPDOWN_MENU
+ || window_type == META_WINDOW_DROPDOWN_MENU
#endif
)
{
@@ -638,7 +629,7 @@ mutter_window_has_shadow (MutterWindow *self)
}
#if 0
- if (priv->type == META_COMP_WINDOW_TOOLTIP)
+ if (window_type == META_WINDOW_TOOLTIP)
{
meta_verbose ("Window 0x%x has shadow as it is a tooltip\n",
(guint)priv->xwindow);
@@ -690,15 +681,6 @@ mutter_window_get_texture (MutterWindow *self)
return self->priv->actor;
}
-MetaCompWindowType
-mutter_window_get_window_type (MutterWindow *self)
-{
- if (!self)
- return 0;
-
- return self->priv->type;
-}
-
gboolean
mutter_window_is_override_redirect (MutterWindow *self)
{
@@ -1053,10 +1035,12 @@ mutter_window_destroy (MutterWindow *self)
MetaWindow *window;
MetaCompScreen *info;
MutterWindowPrivate *priv;
+ MetaWindowType window_type;
priv = self->priv;
window = priv->window;
+ window_type = meta_window_get_window_type (window);
meta_window_set_compositor_private (window, NULL);
/*
@@ -1066,13 +1050,13 @@ mutter_window_destroy (MutterWindow *self)
info = meta_screen_get_compositor_data (priv->screen);
info->windows = g_list_remove (info->windows, (gconstpointer) self);
- if (priv->type == META_COMP_WINDOW_DROPDOWN_MENU ||
- priv->type == META_COMP_WINDOW_POPUP_MENU ||
- priv->type == META_COMP_WINDOW_TOOLTIP ||
- priv->type == META_COMP_WINDOW_NOTIFICATION ||
- priv->type == META_COMP_WINDOW_COMBO ||
- priv->type == META_COMP_WINDOW_DND ||
- priv->type == META_COMP_WINDOW_OVERRIDE_OTHER)
+ if (window_type == META_WINDOW_DROPDOWN_MENU ||
+ window_type == META_WINDOW_POPUP_MENU ||
+ window_type == META_WINDOW_TOOLTIP ||
+ window_type == META_WINDOW_NOTIFICATION ||
+ window_type == META_WINDOW_COMBO ||
+ window_type == META_WINDOW_DND ||
+ window_type == META_WINDOW_OVERRIDE_OTHER)
{
/*
* No effects, just kill it.
diff --git a/src/compositor/plugins/default.c b/src/compositor/plugins/default.c
index 5d2513453..3d77a107a 100644
--- a/src/compositor/plugins/default.c
+++ b/src/compositor/plugins/default.c
@@ -22,6 +22,7 @@
*/
#include "mutter-plugin.h"
+#include "window.h"
#include <libintl.h>
#define _(x) dgettext (GETTEXT_PACKAGE, x)
@@ -441,12 +442,14 @@ on_minimize_effect_complete (ClutterTimeline *timeline, EffectCompleteData *data
static void
minimize (MutterPlugin *plugin, MutterWindow *mc_window)
{
- MetaCompWindowType type;
+ MetaWindowType type;
+ MetaWindow *meta_window = mutter_window_get_meta_window (mc_window);
ClutterActor *actor = CLUTTER_ACTOR (mc_window);
- type = mutter_window_get_window_type (mc_window);
- if (type == META_COMP_WINDOW_NORMAL)
+ type = meta_window_get_window_type (meta_window);
+
+ if (type == META_WINDOW_NORMAL)
{
ClutterAnimation *animation;
EffectCompleteData *data = g_new0 (EffectCompleteData, 1);
@@ -515,17 +518,18 @@ maximize (MutterPlugin *plugin,
MutterWindow *mc_window,
gint end_x, gint end_y, gint end_width, gint end_height)
{
- MetaCompWindowType type;
+ MetaWindowType type;
ClutterActor *actor = CLUTTER_ACTOR (mc_window);
+ MetaWindow *meta_window = mutter_window_get_meta_window (mc_window);
gdouble scale_x = 1.0;
gdouble scale_y = 1.0;
gfloat anchor_x = 0;
gfloat anchor_y = 0;
- type = mutter_window_get_window_type (mc_window);
+ type = meta_window_get_window_type (meta_window);
- if (type == META_COMP_WINDOW_NORMAL)
+ if (type == META_WINDOW_NORMAL)
{
ClutterAnimation *animation;
EffectCompleteData *data = g_new0 (EffectCompleteData, 1);
@@ -580,9 +584,10 @@ unmaximize (MutterPlugin *plugin,
MutterWindow *mc_window,
gint end_x, gint end_y, gint end_width, gint end_height)
{
- MetaCompWindowType type = mutter_window_get_window_type (mc_window);
+ MetaWindow *meta_window = mutter_window_get_meta_window (mc_window);
+ MetaWindowType type = meta_window_get_window_type (meta_window);
- if (type == META_COMP_WINDOW_NORMAL)
+ if (type == META_WINDOW_NORMAL)
{
ActorPrivate *apriv = get_actor_private (mc_window);
@@ -621,12 +626,13 @@ on_map_effect_complete (ClutterTimeline *timeline, EffectCompleteData *data)
static void
map (MutterPlugin *plugin, MutterWindow *mc_window)
{
- MetaCompWindowType type;
+ MetaWindowType type;
ClutterActor *actor = CLUTTER_ACTOR (mc_window);
+ MetaWindow *meta_window = mutter_window_get_meta_window (mc_window);
- type = mutter_window_get_window_type (mc_window);
+ type = meta_window_get_window_type (meta_window);
- if (type == META_COMP_WINDOW_NORMAL)
+ if (type == META_WINDOW_NORMAL)
{
ClutterAnimation *animation;
EffectCompleteData *data = g_new0 (EffectCompleteData, 1);
@@ -680,12 +686,13 @@ on_destroy_effect_complete (ClutterTimeline *timeline, EffectCompleteData *data)
static void
destroy (MutterPlugin *plugin, MutterWindow *mc_window)
{
- MetaCompWindowType type;
+ MetaWindowType type;
ClutterActor *actor = CLUTTER_ACTOR (mc_window);
+ MetaWindow *meta_window = mutter_window_get_meta_window (mc_window);
- type = mutter_window_get_window_type (mc_window);
+ type = meta_window_get_window_type (meta_window);
- if (type == META_COMP_WINDOW_NORMAL)
+ if (type == META_WINDOW_NORMAL)
{
ClutterAnimation *animation;
EffectCompleteData *data = g_new0 (EffectCompleteData, 1);
diff --git a/src/include/compositor.h b/src/include/compositor.h
index 843ff5504..7edacd08d 100644
--- a/src/include/compositor.h
+++ b/src/include/compositor.h
@@ -30,29 +30,6 @@
#include "window.h"
#include "workspace.h"
-typedef enum _MetaCompWindowType
-{
- META_COMP_WINDOW_NORMAL = META_WINDOW_NORMAL,
- META_COMP_WINDOW_DESKTOP = META_WINDOW_DESKTOP,
- META_COMP_WINDOW_DOCK = META_WINDOW_DOCK,
- META_COMP_WINDOW_DIALOG = META_WINDOW_DIALOG,
- META_COMP_WINDOW_MODAL_DIALOG = META_WINDOW_MODAL_DIALOG,
- META_COMP_WINDOW_TOOLBAR = META_WINDOW_TOOLBAR,
- META_COMP_WINDOW_MENU = META_WINDOW_MENU,
- META_COMP_WINDOW_UTILITY = META_WINDOW_UTILITY,
- META_COMP_WINDOW_SPLASHSCREEN = META_WINDOW_SPLASHSCREEN,
-
- /* override redirect window types, */
- META_COMP_WINDOW_DROPDOWN_MENU = META_WINDOW_DROPDOWN_MENU,
- META_COMP_WINDOW_POPUP_MENU = META_WINDOW_POPUP_MENU,
- META_COMP_WINDOW_TOOLTIP = META_WINDOW_TOOLTIP,
- META_COMP_WINDOW_NOTIFICATION = META_WINDOW_NOTIFICATION,
- META_COMP_WINDOW_COMBO = META_WINDOW_COMBO,
- META_COMP_WINDOW_DND = META_WINDOW_DND,
- META_COMP_WINDOW_OVERRIDE_OTHER = META_WINDOW_OVERRIDE_OTHER
-
-} MetaCompWindowType;
-
/**
* MetaCompEffect:
* @META_COMP_EFFECT_CREATE: The window is newly created
diff --git a/src/include/mutter-window.h b/src/include/mutter-window.h
index 9ef37944a..49f7f9232 100644
--- a/src/include/mutter-window.h
+++ b/src/include/mutter-window.h
@@ -59,7 +59,6 @@ struct _MutterWindow
GType mutter_window_get_type (void);
Window mutter_window_get_x_window (MutterWindow *mcw);
-MetaCompWindowType mutter_window_get_window_type (MutterWindow *mcw);
gint mutter_window_get_workspace (MutterWindow *mcw);
gboolean mutter_window_is_hidden (MutterWindow *mcw);
MetaWindow * mutter_window_get_meta_window (MutterWindow *mcw);