Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
33498f6b84 | |||
c0a440b852 | |||
1772a2a59c | |||
44f362ad87 | |||
478f1020a4 | |||
e8209e7b22 | |||
2d20c9ecad |
14
NEWS
14
NEWS
@ -1,3 +1,17 @@
|
||||
3.3.4
|
||||
=====
|
||||
* Adapt to changes in GtkStateFlags [Owen]
|
||||
* Redo properties for applications menu corresponding to GTK+ changes -
|
||||
they are now _GTK_* not DBUS_*. [Ryan]
|
||||
* Fix crash on gnome-shell restart when a modal dialog is open [Owen; #668299]
|
||||
* Code cleanup [Florian; #666039]
|
||||
|
||||
Contributors:
|
||||
Ryan Lortie, Florian Müllner, Owen Taylor
|
||||
|
||||
Translations:
|
||||
Alexander Shopov [bg], Fran Diéguez [gl]
|
||||
|
||||
3.3.3
|
||||
=====
|
||||
* Add keybindings for tiling to left or right [Florian; #648700]
|
||||
|
@ -2,7 +2,7 @@ AC_PREREQ(2.50)
|
||||
|
||||
m4_define([mutter_major_version], [3])
|
||||
m4_define([mutter_minor_version], [3])
|
||||
m4_define([mutter_micro_version], [3])
|
||||
m4_define([mutter_micro_version], [4])
|
||||
|
||||
m4_define([mutter_version],
|
||||
[mutter_major_version.mutter_minor_version.mutter_micro_version])
|
||||
|
@ -5025,12 +5025,21 @@ meta_display_unmanage_windows_for_screen (MetaDisplay *display,
|
||||
winlist = meta_display_list_windows (display,
|
||||
META_LIST_INCLUDE_OVERRIDE_REDIRECT);
|
||||
winlist = g_slist_sort (winlist, meta_display_stack_cmp);
|
||||
g_slist_foreach (winlist, (GFunc)g_object_ref, NULL);
|
||||
|
||||
/* Unmanage all windows */
|
||||
tmp = winlist;
|
||||
while (tmp != NULL)
|
||||
{
|
||||
meta_window_unmanage (tmp->data, timestamp);
|
||||
MetaWindow *window = tmp->data;
|
||||
|
||||
/* Check if already unmanaged for safety - in particular, catch
|
||||
* the case where unmanaging a parent window can cause attached
|
||||
* dialogs to be (temporarily) unmanaged.
|
||||
*/
|
||||
if (!window->unmanaging)
|
||||
meta_window_unmanage (window, timestamp);
|
||||
g_object_unref (window);
|
||||
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
@ -1925,7 +1925,6 @@ meta_screen_tile_preview_update_timeout (gpointer data)
|
||||
{
|
||||
MetaScreen *screen = data;
|
||||
MetaWindow *window = screen->display->grab_window;
|
||||
gboolean composited = screen->display->compositor != NULL;
|
||||
gboolean needs_preview = FALSE;
|
||||
|
||||
screen->tile_preview_timeout_id = 0;
|
||||
@ -1935,8 +1934,7 @@ meta_screen_tile_preview_update_timeout (gpointer data)
|
||||
Window xwindow;
|
||||
gulong create_serial;
|
||||
|
||||
screen->tile_preview = meta_tile_preview_new (screen->number,
|
||||
composited);
|
||||
screen->tile_preview = meta_tile_preview_new (screen->number);
|
||||
xwindow = meta_tile_preview_get_xwindow (screen->tile_preview,
|
||||
&create_serial);
|
||||
meta_stack_tracker_record_add (screen->stack_tracker,
|
||||
|
@ -101,9 +101,12 @@ struct _MetaWindow
|
||||
char *startup_id;
|
||||
char *mutter_hints;
|
||||
char *gtk_theme_variant;
|
||||
char *dbus_application_id;
|
||||
char *dbus_unique_name;
|
||||
char *dbus_object_path;
|
||||
char *gtk_application_id;
|
||||
char *gtk_unique_bus_name;
|
||||
char *gtk_application_object_path;
|
||||
char *gtk_window_object_path;
|
||||
char *gtk_app_menu_object_path;
|
||||
char *gtk_menubar_object_path;
|
||||
|
||||
int hide_titlebar_when_maximized;
|
||||
int net_wm_pid;
|
||||
|
@ -1617,71 +1617,30 @@ reload_gtk_hide_titlebar_when_maximized (MetaWindow *window,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
reload_dbus_application_id (MetaWindow *window,
|
||||
MetaPropValue *value,
|
||||
gboolean initial)
|
||||
{
|
||||
char *new_id = NULL;
|
||||
char *current_id = window->dbus_application_id;
|
||||
#define RELOAD_STRING(var_name, propname) \
|
||||
static void \
|
||||
reload_ ## var_name (MetaWindow *window, \
|
||||
MetaPropValue *value, \
|
||||
gboolean initial) \
|
||||
{ \
|
||||
g_free (window->var_name); \
|
||||
\
|
||||
if (value->type != META_PROP_VALUE_INVALID) \
|
||||
window->var_name = g_strdup (value->v.str); \
|
||||
else \
|
||||
window->var_name = NULL; \
|
||||
\
|
||||
g_object_notify (G_OBJECT (window), propname); \
|
||||
}
|
||||
|
||||
if (value->type != META_PROP_VALUE_INVALID)
|
||||
new_id = value->v.str;
|
||||
RELOAD_STRING (gtk_unique_bus_name, "gtk-unique-bus-name")
|
||||
RELOAD_STRING (gtk_application_id, "gtk-application-id")
|
||||
RELOAD_STRING (gtk_application_object_path, "gtk-application-object-path")
|
||||
RELOAD_STRING (gtk_window_object_path, "gtk-window-object-path")
|
||||
RELOAD_STRING (gtk_app_menu_object_path, "gtk-app-menu-object-path")
|
||||
RELOAD_STRING (gtk_menubar_object_path, "gtk-menubar-object-path")
|
||||
|
||||
if (g_strcmp0 (new_id, current_id) != 0)
|
||||
{
|
||||
g_free (current_id);
|
||||
|
||||
if (new_id)
|
||||
window->dbus_application_id = g_strdup (new_id);
|
||||
else
|
||||
window->dbus_application_id = NULL;
|
||||
|
||||
g_object_notify ((GObject*)window, "dbus-application-id");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
reload_dbus_unique_name (MetaWindow *window,
|
||||
MetaPropValue *value,
|
||||
gboolean initial)
|
||||
{
|
||||
char *new_id = NULL;
|
||||
char *current_id = window->dbus_unique_name;
|
||||
|
||||
if (value->type != META_PROP_VALUE_INVALID)
|
||||
new_id = value->v.str;
|
||||
|
||||
if (g_strcmp0 (new_id, current_id) != 0)
|
||||
{
|
||||
g_free (current_id);
|
||||
|
||||
window->dbus_unique_name = g_strdup (new_id);
|
||||
|
||||
g_object_notify ((GObject*)window, "dbus-unique-name");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
reload_dbus_object_path (MetaWindow *window,
|
||||
MetaPropValue *value,
|
||||
gboolean initial)
|
||||
{
|
||||
char *new_path = NULL;
|
||||
char *current_path = window->dbus_object_path;
|
||||
|
||||
if (value->type != META_PROP_VALUE_INVALID)
|
||||
new_path = value->v.str;
|
||||
|
||||
if (g_strcmp0 (new_path, current_path) != 0)
|
||||
{
|
||||
g_free (current_path);
|
||||
|
||||
window->dbus_object_path = g_strdup (new_path);
|
||||
|
||||
g_object_notify ((GObject*)window, "dbus-object-path");
|
||||
}
|
||||
}
|
||||
#undef RELOAD_STRING
|
||||
|
||||
/**
|
||||
* Initialises the property hooks system. Each row in the table named "hooks"
|
||||
@ -1737,9 +1696,12 @@ meta_display_init_window_prop_hooks (MetaDisplay *display)
|
||||
{ XA_WM_TRANSIENT_FOR, META_PROP_VALUE_WINDOW, reload_transient_for, TRUE, FALSE },
|
||||
{ display->atom__GTK_THEME_VARIANT, META_PROP_VALUE_UTF8, reload_gtk_theme_variant, TRUE, FALSE },
|
||||
{ display->atom__GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED, META_PROP_VALUE_CARDINAL, reload_gtk_hide_titlebar_when_maximized, TRUE, FALSE },
|
||||
{ display->atom__DBUS_APPLICATION_ID, META_PROP_VALUE_UTF8, reload_dbus_application_id, TRUE, FALSE },
|
||||
{ display->atom__DBUS_UNIQUE_NAME, META_PROP_VALUE_UTF8, reload_dbus_unique_name, TRUE, FALSE },
|
||||
{ display->atom__DBUS_OBJECT_PATH, META_PROP_VALUE_UTF8, reload_dbus_object_path, TRUE, FALSE },
|
||||
{ display->atom__GTK_APPLICATION_ID, META_PROP_VALUE_UTF8, reload_gtk_application_id, TRUE, FALSE },
|
||||
{ display->atom__GTK_UNIQUE_BUS_NAME, META_PROP_VALUE_UTF8, reload_gtk_unique_bus_name, TRUE, FALSE },
|
||||
{ display->atom__GTK_APPLICATION_OBJECT_PATH, META_PROP_VALUE_UTF8, reload_gtk_application_object_path, TRUE, FALSE },
|
||||
{ display->atom__GTK_WINDOW_OBJECT_PATH, META_PROP_VALUE_UTF8, reload_gtk_window_object_path, TRUE, FALSE },
|
||||
{ display->atom__GTK_APP_MENU_OBJECT_PATH, META_PROP_VALUE_UTF8, reload_gtk_app_menu_object_path, TRUE, FALSE },
|
||||
{ display->atom__GTK_MENUBAR_OBJECT_PATH, META_PROP_VALUE_UTF8, reload_gtk_menubar_object_path, TRUE, FALSE },
|
||||
{ display->atom__NET_WM_USER_TIME_WINDOW, META_PROP_VALUE_WINDOW, reload_net_wm_user_time_window, TRUE, FALSE },
|
||||
{ display->atom_WM_STATE, META_PROP_VALUE_INVALID, NULL, FALSE, FALSE },
|
||||
{ display->atom__NET_WM_ICON, META_PROP_VALUE_INVALID, reload_net_wm_icon, FALSE, FALSE },
|
||||
|
@ -165,9 +165,12 @@ enum {
|
||||
PROP_RESIZEABLE,
|
||||
PROP_ABOVE,
|
||||
PROP_WM_CLASS,
|
||||
PROP_DBUS_APPLICATION_ID,
|
||||
PROP_DBUS_UNIQUE_NAME,
|
||||
PROP_DBUS_OBJECT_PATH
|
||||
PROP_GTK_APPLICATION_ID,
|
||||
PROP_GTK_UNIQUE_BUS_NAME,
|
||||
PROP_GTK_APPLICATION_OBJECT_PATH,
|
||||
PROP_GTK_WINDOW_OBJECT_PATH,
|
||||
PROP_GTK_APP_MENU_OBJECT_PATH,
|
||||
PROP_GTK_MENUBAR_OBJECT_PATH
|
||||
};
|
||||
|
||||
enum
|
||||
@ -224,9 +227,12 @@ meta_window_finalize (GObject *object)
|
||||
g_free (window->icon_name);
|
||||
g_free (window->desc);
|
||||
g_free (window->gtk_theme_variant);
|
||||
g_free (window->dbus_application_id);
|
||||
g_free (window->dbus_unique_name);
|
||||
g_free (window->dbus_object_path);
|
||||
g_free (window->gtk_application_id);
|
||||
g_free (window->gtk_unique_bus_name);
|
||||
g_free (window->gtk_application_object_path);
|
||||
g_free (window->gtk_window_object_path);
|
||||
g_free (window->gtk_app_menu_object_path);
|
||||
g_free (window->gtk_menubar_object_path);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -290,14 +296,23 @@ meta_window_get_property(GObject *object,
|
||||
case PROP_ABOVE:
|
||||
g_value_set_boolean (value, win->wm_state_above);
|
||||
break;
|
||||
case PROP_DBUS_APPLICATION_ID:
|
||||
g_value_set_string (value, win->dbus_application_id);
|
||||
case PROP_GTK_APPLICATION_ID:
|
||||
g_value_set_string (value, win->gtk_application_id);
|
||||
break;
|
||||
case PROP_DBUS_UNIQUE_NAME:
|
||||
g_value_set_string (value, win->dbus_unique_name);
|
||||
case PROP_GTK_UNIQUE_BUS_NAME:
|
||||
g_value_set_string (value, win->gtk_unique_bus_name);
|
||||
break;
|
||||
case PROP_DBUS_OBJECT_PATH:
|
||||
g_value_set_string (value, win->dbus_object_path);
|
||||
case PROP_GTK_APPLICATION_OBJECT_PATH:
|
||||
g_value_set_string (value, win->gtk_application_object_path);
|
||||
break;
|
||||
case PROP_GTK_WINDOW_OBJECT_PATH:
|
||||
g_value_set_string (value, win->gtk_window_object_path);
|
||||
break;
|
||||
case PROP_GTK_APP_MENU_OBJECT_PATH:
|
||||
g_value_set_string (value, win->gtk_app_menu_object_path);
|
||||
break;
|
||||
case PROP_GTK_MENUBAR_OBJECT_PATH:
|
||||
g_value_set_string (value, win->gtk_menubar_object_path);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
@ -466,26 +481,50 @@ meta_window_class_init (MetaWindowClass *klass)
|
||||
G_PARAM_READABLE));
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_DBUS_APPLICATION_ID,
|
||||
g_param_spec_string ("dbus-application-id",
|
||||
"DBusApplicationID",
|
||||
"Contents of the _DBUS_APPLICATION_ID property of this window",
|
||||
PROP_GTK_APPLICATION_ID,
|
||||
g_param_spec_string ("gtk-application-id",
|
||||
"_GTK_APPLICATION_ID",
|
||||
"Contents of the _GTK_APPLICATION_ID property of this window",
|
||||
NULL,
|
||||
G_PARAM_READABLE));
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_DBUS_UNIQUE_NAME,
|
||||
g_param_spec_string ("dbus-unique-name",
|
||||
"_DBUS_UNIQUE_NAME",
|
||||
"Contents of the _DBUS_UNIQUE_NAME property of this window",
|
||||
PROP_GTK_UNIQUE_BUS_NAME,
|
||||
g_param_spec_string ("gtk-unique-bus-name",
|
||||
"_GTK_UNIQUE_BUS_NAME",
|
||||
"Contents of the _GTK_UNIQUE_BUS_NAME property of this window",
|
||||
NULL,
|
||||
G_PARAM_READABLE));
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_DBUS_OBJECT_PATH,
|
||||
g_param_spec_string ("dbus-object-path",
|
||||
"_DBUS_OBJECT_PATH",
|
||||
"Contents of the _DBUS_OBJECT_PATH property of this window",
|
||||
PROP_GTK_APPLICATION_OBJECT_PATH,
|
||||
g_param_spec_string ("gtk-application-object-path",
|
||||
"_GTK_APPLICATION_OBJECT_PATH",
|
||||
"Contents of the _GTK_APPLICATION_OBJECT_PATH property of this window",
|
||||
NULL,
|
||||
G_PARAM_READABLE));
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_GTK_WINDOW_OBJECT_PATH,
|
||||
g_param_spec_string ("gtk-window-object-path",
|
||||
"_GTK_WINDOW_OBJECT_PATH",
|
||||
"Contents of the _GTK_WINDOW_OBJECT_PATH property of this window",
|
||||
NULL,
|
||||
G_PARAM_READABLE));
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_GTK_APP_MENU_OBJECT_PATH,
|
||||
g_param_spec_string ("gtk-app-menu-object-path",
|
||||
"_GTK_APP_MENU_OBJECT_PATH",
|
||||
"Contents of the _GTK_APP_MENU_OBJECT_PATH property of this window",
|
||||
NULL,
|
||||
G_PARAM_READABLE));
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_GTK_MENUBAR_OBJECT_PATH,
|
||||
g_param_spec_string ("gtk-menubar-object-path",
|
||||
"_GTK_MENUBAR_OBJECT_PATH",
|
||||
"Contents of the _GTK_MENUBAR_OBJECT_PATH property of this window",
|
||||
NULL,
|
||||
G_PARAM_READABLE));
|
||||
|
||||
@ -10251,39 +10290,75 @@ meta_window_get_wm_class_instance (MetaWindow *window)
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_window_get_dbus_application_id:
|
||||
* meta_window_get_gtk_application_id:
|
||||
* @window: a #MetaWindow
|
||||
*
|
||||
* Return value: (transfer none): the application ID
|
||||
**/
|
||||
const char *
|
||||
meta_window_get_dbus_application_id (MetaWindow *window)
|
||||
meta_window_get_gtk_application_id (MetaWindow *window)
|
||||
{
|
||||
return window->dbus_application_id;
|
||||
return window->gtk_application_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_window_get_dbus_unique_name:
|
||||
* meta_window_get_gtk_unique_bus_name:
|
||||
* @window: a #MetaWindow
|
||||
*
|
||||
* Return value: (transfer none): the unique name
|
||||
**/
|
||||
const char *
|
||||
meta_window_get_dbus_unique_name (MetaWindow *window)
|
||||
meta_window_get_gtk_unique_bus_name (MetaWindow *window)
|
||||
{
|
||||
return window->dbus_unique_name;
|
||||
return window->gtk_unique_bus_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_window_get_dbus_object_path:
|
||||
* meta_window_get_gtk_application_object_path:
|
||||
* @window: a #MetaWindow
|
||||
*
|
||||
* Return value: (transfer none): the object path
|
||||
**/
|
||||
const char *
|
||||
meta_window_get_dbus_object_path (MetaWindow *window)
|
||||
meta_window_get_gtk_application_object_path (MetaWindow *window)
|
||||
{
|
||||
return window->dbus_object_path;
|
||||
return window->gtk_application_object_path;
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_window_get_gtk_window_object_path:
|
||||
* @window: a #MetaWindow
|
||||
*
|
||||
* Return value: (transfer none): the object path
|
||||
**/
|
||||
const char *
|
||||
meta_window_get_gtk_window_object_path (MetaWindow *window)
|
||||
{
|
||||
return window->gtk_window_object_path;
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_window_get_gtk_app_menu_object_path:
|
||||
* @window: a #MetaWindow
|
||||
*
|
||||
* Return value: (transfer none): the object path
|
||||
**/
|
||||
const char *
|
||||
meta_window_get_gtk_app_menu_object_path (MetaWindow *window)
|
||||
{
|
||||
return window->gtk_app_menu_object_path;
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_window_get_gtk_menubar_object_path:
|
||||
* @window: a #MetaWindow
|
||||
*
|
||||
* Return value: (transfer none): the object path
|
||||
**/
|
||||
const char *
|
||||
meta_window_get_gtk_menubar_object_path (MetaWindow *window)
|
||||
{
|
||||
return window->gtk_menubar_object_path;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -60,9 +60,12 @@ item(_MUTTER_TOGGLE_VERBOSE)
|
||||
item(_MUTTER_HINTS)
|
||||
item(_GTK_THEME_VARIANT)
|
||||
item(_GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED)
|
||||
item(_DBUS_APPLICATION_ID)
|
||||
item(_DBUS_UNIQUE_NAME)
|
||||
item(_DBUS_OBJECT_PATH)
|
||||
item(_GTK_APPLICATION_ID)
|
||||
item(_GTK_UNIQUE_BUS_NAME)
|
||||
item(_GTK_APPLICATION_OBJECT_PATH)
|
||||
item(_GTK_WINDOW_OBJECT_PATH)
|
||||
item(_GTK_APP_MENU_OBJECT_PATH)
|
||||
item(_GTK_MENUBAR_OBJECT_PATH)
|
||||
item(_GNOME_WM_KEYBINDINGS)
|
||||
item(_GNOME_PANEL_ACTION)
|
||||
item(_GNOME_PANEL_ACTION_MAIN_MENU)
|
||||
|
@ -95,9 +95,12 @@ const char * meta_window_get_wm_class (MetaWindow *window);
|
||||
const char * meta_window_get_wm_class_instance (MetaWindow *window);
|
||||
gboolean meta_window_showing_on_its_workspace (MetaWindow *window);
|
||||
|
||||
const char * meta_window_get_dbus_application_id (MetaWindow *window);
|
||||
const char * meta_window_get_dbus_unique_name (MetaWindow *window);
|
||||
const char * meta_window_get_dbus_object_path (MetaWindow *window);
|
||||
const char * meta_window_get_gtk_application_id (MetaWindow *window);
|
||||
const char * meta_window_get_gtk_unique_bus_name (MetaWindow *window);
|
||||
const char * meta_window_get_gtk_application_object_path (MetaWindow *window);
|
||||
const char * meta_window_get_gtk_window_object_path (MetaWindow *window);
|
||||
const char * meta_window_get_gtk_app_menu_object_path (MetaWindow *window);
|
||||
const char * meta_window_get_gtk_menubar_object_path (MetaWindow *window);
|
||||
|
||||
void meta_window_move(MetaWindow *window, gboolean user_op, int root_x_nw, int root_y_nw);
|
||||
void meta_window_move_frame(MetaWindow *window, gboolean user_op, int root_x_nw, int root_y_nw);
|
||||
|
@ -6403,8 +6403,8 @@ meta_gtk_state_from_string (const char *str)
|
||||
return GTK_STATE_FLAG_INCONSISTENT;
|
||||
else if (g_ascii_strcasecmp ("focused", str) == 0)
|
||||
return GTK_STATE_FLAG_FOCUSED;
|
||||
else if (g_ascii_strcasecmp ("window-unfocused", str) == 0)
|
||||
return GTK_STATE_FLAG_WINDOW_UNFOCUSED;
|
||||
else if (g_ascii_strcasecmp ("backdrop", str) == 0)
|
||||
return GTK_STATE_FLAG_BACKDROP;
|
||||
else
|
||||
return -1; /* hack */
|
||||
}
|
||||
@ -6428,8 +6428,8 @@ meta_gtk_state_to_string (GtkStateFlags state)
|
||||
return "INCONSISTENT";
|
||||
case GTK_STATE_FLAG_FOCUSED:
|
||||
return "FOCUSED";
|
||||
case GTK_STATE_FLAG_WINDOW_UNFOCUSED:
|
||||
return "WINDOW_UNFOCUSED";
|
||||
case GTK_STATE_FLAG_BACKDROP:
|
||||
return "BACKDROP";
|
||||
}
|
||||
|
||||
return "<unknown>";
|
||||
|
@ -39,8 +39,6 @@ struct _MetaTilePreview {
|
||||
GdkRGBA *preview_color;
|
||||
|
||||
MetaRectangle tile_rect;
|
||||
|
||||
gboolean has_alpha: 1;
|
||||
};
|
||||
|
||||
static gboolean
|
||||
@ -52,30 +50,17 @@ meta_tile_preview_draw (GtkWidget *widget,
|
||||
|
||||
cairo_set_line_width (cr, 1.0);
|
||||
|
||||
if (preview->has_alpha)
|
||||
{
|
||||
/* Fill the preview area with a transparent color */
|
||||
gdk_cairo_set_source_rgba (cr, preview->preview_color);
|
||||
/* Fill the preview area with a transparent color */
|
||||
gdk_cairo_set_source_rgba (cr, preview->preview_color);
|
||||
|
||||
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
|
||||
cairo_paint (cr);
|
||||
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
|
||||
cairo_paint (cr);
|
||||
|
||||
/* Use the opaque color for the border */
|
||||
cairo_set_source_rgb (cr,
|
||||
preview->preview_color->red,
|
||||
preview->preview_color->green,
|
||||
preview->preview_color->blue);
|
||||
}
|
||||
else
|
||||
{
|
||||
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
|
||||
|
||||
cairo_rectangle (cr,
|
||||
OUTLINE_WIDTH - 0.5, OUTLINE_WIDTH - 0.5,
|
||||
preview->tile_rect.width - 2 * (OUTLINE_WIDTH - 1) - 1,
|
||||
preview->tile_rect.height - 2 * (OUTLINE_WIDTH - 1) - 1);
|
||||
cairo_stroke (cr);
|
||||
}
|
||||
/* Use the opaque color for the border */
|
||||
cairo_set_source_rgb (cr,
|
||||
preview->preview_color->red,
|
||||
preview->preview_color->green,
|
||||
preview->preview_color->blue);
|
||||
|
||||
cairo_rectangle (cr,
|
||||
0.5, 0.5,
|
||||
@ -87,11 +72,13 @@ meta_tile_preview_draw (GtkWidget *widget,
|
||||
}
|
||||
|
||||
MetaTilePreview *
|
||||
meta_tile_preview_new (int screen_number,
|
||||
gboolean composited)
|
||||
meta_tile_preview_new (int screen_number)
|
||||
{
|
||||
MetaTilePreview *preview;
|
||||
GdkScreen *screen;
|
||||
GtkStyleContext *context;
|
||||
GtkWidgetPath *path;
|
||||
guchar selection_alpha = 0xFF;
|
||||
|
||||
screen = gdk_display_get_screen (gdk_display_get_default (), screen_number);
|
||||
|
||||
@ -107,44 +94,34 @@ meta_tile_preview_new (int screen_number,
|
||||
preview->tile_rect.x = preview->tile_rect.y = 0;
|
||||
preview->tile_rect.width = preview->tile_rect.height = 0;
|
||||
|
||||
preview->has_alpha = composited &&
|
||||
(gdk_screen_get_rgba_visual (screen) != NULL);
|
||||
gtk_widget_set_visual (preview->preview_window,
|
||||
gdk_screen_get_rgba_visual (screen));
|
||||
|
||||
if (preview->has_alpha)
|
||||
{
|
||||
GtkStyleContext *context;
|
||||
GtkWidgetPath *path;
|
||||
guchar selection_alpha = 0xFF;
|
||||
path = gtk_widget_path_new ();
|
||||
gtk_widget_path_append_type (path, GTK_TYPE_ICON_VIEW);
|
||||
|
||||
gtk_widget_set_visual (preview->preview_window,
|
||||
gdk_screen_get_rgba_visual (screen));
|
||||
context = gtk_style_context_new ();
|
||||
gtk_style_context_set_path (context, path);
|
||||
gtk_style_context_add_class (context,
|
||||
GTK_STYLE_CLASS_RUBBERBAND);
|
||||
|
||||
path = gtk_widget_path_new ();
|
||||
gtk_widget_path_append_type (path, GTK_TYPE_ICON_VIEW);
|
||||
gtk_widget_path_free (path);
|
||||
|
||||
context = gtk_style_context_new ();
|
||||
gtk_style_context_set_path (context, path);
|
||||
gtk_style_context_add_class (context,
|
||||
GTK_STYLE_CLASS_RUBBERBAND);
|
||||
gtk_style_context_get (context, GTK_STATE_FLAG_SELECTED,
|
||||
"background-color", &preview->preview_color,
|
||||
NULL);
|
||||
|
||||
gtk_widget_path_free (path);
|
||||
/* The background-color for the .rubberband class should probably
|
||||
* contain the correct alpha value - unfortunately, at least for now
|
||||
* it doesn't. Hopefully the following workaround can be removed
|
||||
* when GtkIconView gets ported to GtkStyleContext.
|
||||
*/
|
||||
gtk_style_context_get_style (context,
|
||||
"selection-box-alpha", &selection_alpha,
|
||||
NULL);
|
||||
preview->preview_color->alpha = (double)selection_alpha / 0xFF;
|
||||
|
||||
gtk_style_context_get (context, GTK_STATE_FLAG_SELECTED,
|
||||
"background-color", &preview->preview_color,
|
||||
NULL);
|
||||
|
||||
/* The background-color for the .rubberband class should probably
|
||||
* contain the correct alpha value - unfortunately, at least for now
|
||||
* it doesn't. Hopefully the following workaround can be removed
|
||||
* when GtkIconView gets ported to GtkStyleContext.
|
||||
*/
|
||||
gtk_style_context_get_style (context,
|
||||
"selection-box-alpha", &selection_alpha,
|
||||
NULL);
|
||||
preview->preview_color->alpha = (double)selection_alpha / 0xFF;
|
||||
|
||||
g_object_unref (context);
|
||||
}
|
||||
g_object_unref (context);
|
||||
|
||||
/* We make an assumption that XCreateWindow will be the first operation
|
||||
* when calling gtk_widget_realize() (via gdk_window_new()), or that it
|
||||
@ -200,33 +177,6 @@ meta_tile_preview_show (MetaTilePreview *preview,
|
||||
gdk_window_move_resize (window,
|
||||
preview->tile_rect.x, preview->tile_rect.y,
|
||||
preview->tile_rect.width, preview->tile_rect.height);
|
||||
|
||||
if (!preview->has_alpha)
|
||||
{
|
||||
cairo_region_t *outer_region, *inner_region;
|
||||
GdkRectangle outer_rect, inner_rect;
|
||||
GdkRGBA black = { 0.0, 0.0, 0.0, 1.0 };
|
||||
|
||||
gdk_window_set_background_rgba (window, &black);
|
||||
|
||||
outer_rect.x = outer_rect.y = 0;
|
||||
outer_rect.width = preview->tile_rect.width;
|
||||
outer_rect.height = preview->tile_rect.height;
|
||||
|
||||
inner_rect.x = OUTLINE_WIDTH;
|
||||
inner_rect.y = OUTLINE_WIDTH;
|
||||
inner_rect.width = outer_rect.width - 2 * OUTLINE_WIDTH;
|
||||
inner_rect.height = outer_rect.height - 2 * OUTLINE_WIDTH;
|
||||
|
||||
outer_region = cairo_region_create_rectangle (&outer_rect);
|
||||
inner_region = cairo_region_create_rectangle (&inner_rect);
|
||||
|
||||
cairo_region_subtract (outer_region, inner_region);
|
||||
cairo_region_destroy (inner_region);
|
||||
|
||||
gdk_window_shape_combine_region (window, outer_region, 0, 0);
|
||||
cairo_region_destroy (outer_region);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -27,8 +27,7 @@
|
||||
|
||||
typedef struct _MetaTilePreview MetaTilePreview;
|
||||
|
||||
MetaTilePreview *meta_tile_preview_new (int screen_number,
|
||||
gboolean composited);
|
||||
MetaTilePreview *meta_tile_preview_new (int screen_number);
|
||||
void meta_tile_preview_free (MetaTilePreview *preview);
|
||||
void meta_tile_preview_show (MetaTilePreview *preview,
|
||||
MetaRectangle *rect);
|
||||
|
Reference in New Issue
Block a user