[mutter/wip/no-reparent: 2/2] use gtk+ theme impl
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/no-reparent: 2/2] use gtk+ theme impl
- Date: Thu, 20 Feb 2014 22:32:48 +0000 (UTC)
commit 2ff2a2722907f2ede849fe9df8febc0bd81c25d5
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Tue Apr 23 12:53:24 2013 -0400
use gtk+ theme impl
src/Makefile.am | 20 +-
src/compositor/meta-window-actor.c | 89 +-
src/core/frame.c | 159 +-
src/core/frame.h | 3 -
src/core/keybindings.c | 4 -
src/core/main.c | 42 -
src/core/prefs.c | 44 -
src/core/stack-tracker.c | 4 +-
src/core/stack.c | 5 +-
src/core/window.c | 283 +--
src/gtk-decorator/gtk-decorator.c | 143 +
src/meta/gradient.h | 71 -
src/meta/meta-background-actor.h | 1 -
src/meta/meta-background.h | 1 -
src/meta/prefs.h | 3 -
src/meta/util.h | 1 -
src/ui/frames.c | 2412 -------------
src/ui/frames.h | 160 -
src/ui/gradient.c | 873 -----
src/ui/menu.c | 518 ---
src/ui/menu.h | 55 -
src/ui/testgradient.c | 315 --
src/ui/theme-parser.c | 4344 -----------------------
src/ui/theme-private.h | 1156 ------
src/ui/theme.c | 6802 ------------------------------------
src/ui/ui.c | 446 +---
src/ui/ui.h | 57 -
27 files changed, 221 insertions(+), 17790 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index dc1cac7..75ae6ea 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -102,8 +102,6 @@ libmutter_la_SOURCES = \
meta/errors.h \
core/frame.c \
core/frame.h \
- ui/gradient.c \
- meta/gradient.h \
core/group-private.h \
core/group-props.c \
core/group-props.h \
@@ -152,20 +150,12 @@ libmutter_la_SOURCES = \
core/xprops.h \
meta/common.h \
core/core.h \
+ ui/ui.c \
ui/ui.h \
- ui/frames.c \
- ui/frames.h \
- ui/menu.c \
- ui/menu.h \
ui/metaaccellabel.c \
ui/metaaccellabel.h \
ui/resizepopup.c \
- ui/resizepopup.h \
- ui/theme-parser.c \
- ui/theme.c \
- meta/theme.h \
- ui/theme-private.h \
- ui/ui.c
+ ui/resizepopup.h
nodist_libmutter_la_SOURCES = \
$(mutter_built_sources)
@@ -183,7 +173,6 @@ libmutterinclude_base_headers = \
meta/compositor.h \
meta/display.h \
meta/errors.h \
- meta/gradient.h \
meta/group.h \
meta/keybindings.h \
meta/main.h \
@@ -198,7 +187,6 @@ libmutterinclude_base_headers = \
meta/meta-window-actor.h \
meta/prefs.h \
meta/screen.h \
- meta/theme.h \
meta/types.h \
meta/util.h \
meta/window.h \
@@ -254,13 +242,11 @@ Meta-$(api_version).gir: libmutter.la
endif
testboxes_SOURCES = core/testboxes.c
-testgradient_SOURCES = ui/testgradient.c
testasyncgetprop_SOURCES = core/testasyncgetprop.c
-noinst_PROGRAMS=testboxes testgradient testasyncgetprop
+noinst_PROGRAMS=testboxes testasyncgetprop
testboxes_LDADD = $(MUTTER_LIBS) libmutter.la
-testgradient_LDADD = $(MUTTER_LIBS) libmutter.la
testasyncgetprop_LDADD = $(MUTTER_LIBS) libmutter.la
@INTLTOOL_DESKTOP_RULE@
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index 11606bb..70214ff 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -361,6 +361,7 @@ meta_window_actor_dispose (GObject *object)
xdisplay = meta_display_get_xdisplay (display);
info = meta_screen_get_compositor_data (screen);
+ meta_window_actor_set_redirected (self, FALSE);
meta_window_actor_detach (self);
if (priv->send_frame_messages_timer != 0)
@@ -484,6 +485,36 @@ meta_window_actor_get_property (GObject *object,
}
}
+static const char*
+meta_frame_type_to_string (MetaFrameType type)
+{
+ switch (type)
+ {
+ case META_FRAME_TYPE_NORMAL:
+ return "normal";
+ case META_FRAME_TYPE_DIALOG:
+ return "dialog";
+ case META_FRAME_TYPE_MODAL_DIALOG:
+ return "modal_dialog";
+ case META_FRAME_TYPE_UTILITY:
+ return "utility";
+ case META_FRAME_TYPE_MENU:
+ return "menu";
+ case META_FRAME_TYPE_BORDER:
+ return "border";
+ case META_FRAME_TYPE_ATTACHED:
+ return "attached";
+#if 0
+ case META_FRAME_TYPE_TOOLBAR:
+ return "toolbar";
+#endif
+ case META_FRAME_TYPE_LAST:
+ break;
+ }
+
+ return "<unknown>";
+}
+
static const char *
meta_window_actor_get_shadow_class (MetaWindowActor *self)
{
@@ -1842,43 +1873,6 @@ meta_window_actor_sync_visibility (MetaWindowActor *self)
}
}
-static cairo_region_t *
-scan_visible_region (guchar *mask_data,
- int stride,
- cairo_region_t *scan_area)
-{
- int i, n_rects = cairo_region_num_rectangles (scan_area);
- MetaRegionBuilder builder;
-
- meta_region_builder_init (&builder);
-
- for (i = 0; i < n_rects; i++)
- {
- int x, y;
- cairo_rectangle_int_t rect;
-
- cairo_region_get_rectangle (scan_area, i, &rect);
-
- for (y = rect.y; y < (rect.y + rect.height); y++)
- {
- for (x = rect.x; x < (rect.x + rect.width); x++)
- {
- int x2 = x;
- while (mask_data[y * stride + x2] == 255 && x2 < (rect.x + rect.width))
- x2++;
-
- if (x2 > x)
- {
- meta_region_builder_add_rectangle (&builder, x, y, x2 - x, 1);
- x = x2;
- }
- }
- }
- }
-
- return meta_region_builder_finish (&builder);
-}
-
static void
build_and_scan_frame_mask (MetaWindowActor *self,
cairo_rectangle_int_t *client_area,
@@ -1914,27 +1908,6 @@ build_and_scan_frame_mask (MetaWindowActor *self,
gdk_cairo_region (cr, shape_region);
cairo_fill (cr);
- if (priv->window->frame != NULL)
- {
- cairo_region_t *frame_paint_region, *scanned_region;
- cairo_rectangle_int_t rect = { 0, 0, tex_width, tex_height };
-
- /* Make sure we don't paint the frame over the client window. */
- frame_paint_region = cairo_region_create_rectangle (&rect);
- cairo_region_subtract_rectangle (frame_paint_region, client_area);
-
- gdk_cairo_region (cr, frame_paint_region);
- cairo_clip (cr);
-
- meta_frame_get_mask (priv->window->frame, cr);
-
- cairo_surface_flush (surface);
- scanned_region = scan_visible_region (mask_data, stride, frame_paint_region);
- cairo_region_union (shape_region, scanned_region);
- cairo_region_destroy (scanned_region);
- cairo_region_destroy (frame_paint_region);
- }
-
cairo_destroy (cr);
cairo_surface_destroy (surface);
diff --git a/src/core/frame.c b/src/core/frame.c
index ed7e3cb..0861602 100644
--- a/src/core/frame.c
+++ b/src/core/frame.c
@@ -43,7 +43,6 @@ meta_window_ensure_frame (MetaWindow *window)
{
MetaFrame *frame;
XSetWindowAttributes attrs;
- Visual *visual;
gulong create_serial;
if (window->frame)
@@ -62,53 +61,34 @@ meta_window_ensure_frame (MetaWindow *window)
frame->current_cursor = 0;
frame->is_flashing = FALSE;
- frame->borders_cached = FALSE;
-
- meta_verbose ("Framing window %s: visual %s default, depth %d default depth %d\n",
- window->desc,
- XVisualIDFromVisual (window->xvisual) ==
- XVisualIDFromVisual (window->screen->default_xvisual) ?
- "is" : "is not",
- window->depth, window->screen->default_depth);
+
meta_verbose ("Frame geometry %d,%d %dx%d\n",
frame->rect.x, frame->rect.y,
frame->rect.width, frame->rect.height);
-
- /* Default depth/visual handles clients with weird visuals; they can
- * always be children of the root depth/visual obviously, but
- * e.g. DRI games can't be children of a parent that has the same
- * visual as the client. NULL means default visual.
- *
- * We look for an ARGB visual if we can find one, otherwise use
- * the default of NULL.
- */
-
- /* Special case for depth 32 windows (assumed to be ARGB),
- * we use the window's visual. Otherwise we just use the system visual.
- */
- if (window->depth == 32)
- visual = window->xvisual;
- else
- visual = NULL;
-
- frame->xwindow = meta_ui_create_frame_window (window->screen->ui,
- window->display->xdisplay,
- visual,
- frame->rect.x,
- frame->rect.y,
- frame->rect.width,
- frame->rect.height,
- frame->window->screen->number,
- &create_serial);
+
+ attrs.event_mask = EVENT_MASK;
+ XChangeWindowAttributes (window->display->xdisplay,
+ frame->xwindow, CWEventMask, &attrs);
+
+ create_serial = XNextRequest (window->display->xdisplay);
+
+ frame->xwindow = XCreateWindow (window->display->xdisplay,
+ DefaultRootWindow (window->display->xdisplay),
+ frame->rect.x, frame->rect.y,
+ frame->rect.width, frame->rect.height,
+ 0,
+ CopyFromParent,
+ InputOnly,
+ CopyFromParent,
+ CWEventMask,
+ &attrs);
+
meta_stack_tracker_record_add (window->screen->stack_tracker,
frame->xwindow,
create_serial);
meta_verbose ("Frame for %s is 0x%lx\n", frame->window->desc, frame->xwindow);
- attrs.event_mask = EVENT_MASK;
- XChangeWindowAttributes (window->display->xdisplay,
- frame->xwindow, CWEventMask, &attrs);
-
+
meta_display_register_x_window (window->display, &frame->xwindow, window);
meta_error_trap_push (window->display);
@@ -128,28 +108,12 @@ meta_window_ensure_frame (MetaWindow *window)
meta_stack_tracker_record_remove (window->screen->stack_tracker,
window->xwindow,
XNextRequest (window->display->xdisplay));
- XReparentWindow (window->display->xdisplay,
- window->xwindow,
- frame->xwindow,
- window->rect.x,
- window->rect.y);
/* FIXME handle this error */
meta_error_trap_pop (window->display);
/* stick frame to the window */
window->frame = frame;
- /* Now that frame->xwindow is registered with window, we can set its
- * style and background.
- */
- meta_ui_update_frame_style (window->screen->ui, frame->xwindow);
- meta_ui_reset_frame_bg (window->screen->ui, frame->xwindow);
-
- if (window->title)
- meta_ui_set_frame_title (window->screen->ui,
- window->frame->xwindow,
- window->title);
-
/* Move keybindings to frame instead of window */
meta_window_grab_keys (window);
@@ -190,18 +154,9 @@ meta_window_destroy_frame (MetaWindow *window)
meta_stack_tracker_record_add (window->screen->stack_tracker,
window->xwindow,
XNextRequest (window->display->xdisplay));
- XReparentWindow (window->display->xdisplay,
- window->xwindow,
- window->screen->xroot,
- /* Using anything other than meta_window_get_position()
- * coordinates here means we'll need to ensure a configure
- * notify event is sent; see bug 399552.
- */
- window->frame->rect.x + borders.invisible.left,
- window->frame->rect.y + borders.invisible.top);
meta_error_trap_pop (window->display);
- meta_ui_destroy_frame_window (window->screen->ui, frame->xwindow);
+ XDestroyWindow (window->display->xdisplay, frame->xwindow);
meta_display_unregister_x_window (window->display,
frame->xwindow);
@@ -309,22 +264,7 @@ void
meta_frame_calc_borders (MetaFrame *frame,
MetaFrameBorders *borders)
{
- /* Save on if statements and potential uninitialized values
- * in callers -- if there's no frame, then zero the borders. */
- if (frame == NULL)
- meta_frame_borders_clear (borders);
- else
- {
- if (!frame->borders_cached)
- {
- meta_ui_get_frame_borders (frame->window->screen->ui,
- frame->xwindow,
- &frame->cached_borders);
- frame->borders_cached = TRUE;
- }
-
- *borders = frame->cached_borders;
- }
+ meta_frame_borders_clear (borders);
}
void
@@ -346,35 +286,12 @@ meta_frame_sync_to_window (MetaFrame *frame,
frame->rect.x + frame->rect.width,
frame->rect.y + frame->rect.height);
- /* set bg to none to avoid flicker */
- if (need_resize)
- {
- meta_ui_unflicker_frame_bg (frame->window->screen->ui,
- frame->xwindow,
- frame->rect.width,
- frame->rect.height);
- }
-
- meta_ui_move_resize_frame (frame->window->screen->ui,
- frame->xwindow,
- frame->rect.x,
- frame->rect.y,
- frame->rect.width,
- frame->rect.height);
-
- if (need_resize)
- {
- meta_ui_reset_frame_bg (frame->window->screen->ui,
- frame->xwindow);
-
- /* If we're interactively resizing the frame, repaint
- * it immediately so we don't start to lag.
- */
- if (frame->window->display->grab_window ==
- frame->window)
- meta_ui_repaint_frame (frame->window->screen->ui,
- frame->xwindow);
- }
+ XMoveResizeWindow (frame->window->display->xdisplay,
+ frame->xwindow,
+ frame->rect.x,
+ frame->rect.y,
+ frame->rect.width,
+ frame->rect.height);
return need_resize;
}
@@ -382,25 +299,19 @@ meta_frame_sync_to_window (MetaFrame *frame,
cairo_region_t *
meta_frame_get_frame_bounds (MetaFrame *frame)
{
- return meta_ui_get_frame_bounds (frame->window->screen->ui,
- frame->xwindow,
- frame->rect.width,
- frame->rect.height);
-}
+ cairo_rectangle_int_t rect;
-void
-meta_frame_get_mask (MetaFrame *frame,
- cairo_t *cr)
-{
- meta_ui_get_frame_mask (frame->window->screen->ui, frame->xwindow,
- frame->rect.width, frame->rect.height, cr);
+ rect.x = frame->window->rect.x;
+ rect.y = frame->window->rect.y;
+ rect.width = frame->window->rect.width;
+ rect.height = frame->window->rect.height;
+
+ return cairo_region_create_rectangles (&rect, 1);
}
void
meta_frame_queue_draw (MetaFrame *frame)
{
- meta_ui_queue_frame_draw (frame->window->screen->ui,
- frame->xwindow);
}
void
diff --git a/src/core/frame.h b/src/core/frame.h
index 8ac1c26..e22348d 100644
--- a/src/core/frame.h
+++ b/src/core/frame.h
@@ -72,9 +72,6 @@ void meta_frame_clear_cached_borders (MetaFrame *frame);
cairo_region_t *meta_frame_get_frame_bounds (MetaFrame *frame);
-void meta_frame_get_mask (MetaFrame *frame,
- cairo_t *cr);
-
void meta_frame_set_screen_cursor (MetaFrame *frame,
MetaCursor cursor);
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index c43afd1..6038948 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -1983,10 +1983,6 @@ meta_display_process_key_event (MetaDisplay *display,
if (screen == NULL)
return FALSE; /* event window is destroyed */
- /* ignore key events on popup menus and such. */
- if (meta_ui_window_is_widget (screen->ui, event->event))
- return FALSE;
-
/* window may be NULL */
keysym = XKeycodeToKeysym (display->xdisplay, event->detail, 0);
diff --git a/src/core/main.c b/src/core/main.c
index b2eb4cd..63d750b 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -523,42 +523,6 @@ meta_run (void)
if (g_getenv ("MUTTER_G_FATAL_WARNINGS") != NULL)
g_log_set_always_fatal (G_LOG_LEVEL_MASK);
-
- meta_ui_set_current_theme (meta_prefs_get_theme ());
-
- /* Try to find some theme that'll work if the theme preference
- * doesn't exist. First try Simple (the default theme) then just
- * try anything in the themes directory.
- */
- if (!meta_ui_have_a_theme ())
- meta_ui_set_current_theme ("Simple");
-
- if (!meta_ui_have_a_theme ())
- {
- const char *dir_entry = NULL;
- GError *err = NULL;
- GDir *themes_dir = NULL;
-
- if (!(themes_dir = g_dir_open (MUTTER_DATADIR"/themes", 0, &err)))
- {
- meta_fatal (_("Failed to scan themes directory: %s\n"), err->message);
- g_error_free (err);
- }
- else
- {
- while (((dir_entry = g_dir_read_name (themes_dir)) != NULL) &&
- (!meta_ui_have_a_theme ()))
- {
- meta_ui_set_current_theme (dir_entry);
- }
-
- g_dir_close (themes_dir);
- }
- }
-
- if (!meta_ui_have_a_theme ())
- meta_fatal (_("Could not find a theme! Be sure %s exists and contains the usual themes.\n"),
- MUTTER_DATADIR"/themes");
if (!meta_display_open ())
meta_exit (META_EXIT_ERROR);
@@ -606,12 +570,6 @@ prefs_changed_callback (MetaPreference pref,
{
switch (pref)
{
- case META_PREF_THEME:
- case META_PREF_DRAGGABLE_BORDER_WIDTH:
- meta_ui_set_current_theme (meta_prefs_get_theme ());
- meta_display_retheme_all ();
- break;
-
case META_PREF_CURSOR_THEME:
case META_PREF_CURSOR_SIZE:
meta_display_set_cursor_theme (meta_prefs_get_cursor_theme (),
diff --git a/src/core/prefs.c b/src/core/prefs.c
index d9f0f28..cc9c6ea 100644
--- a/src/core/prefs.c
+++ b/src/core/prefs.c
@@ -80,7 +80,6 @@ static GDesktopFocusMode focus_mode = G_DESKTOP_FOCUS_MODE_CLICK;
static GDesktopFocusNewWindows focus_new_windows = G_DESKTOP_FOCUS_NEW_WINDOWS_SMART;
static gboolean raise_on_click = TRUE;
static gboolean attach_modal_dialogs = FALSE;
-static char* current_theme = NULL;
static int num_workspaces = 4;
static GDesktopTitlebarAction action_double_click_titlebar = G_DESKTOP_TITLEBAR_ACTION_TOGGLE_MAXIMIZE;
static GDesktopTitlebarAction action_middle_click_titlebar = G_DESKTOP_TITLEBAR_ACTION_LOWER;
@@ -132,7 +131,6 @@ static void queue_changed (MetaPreference pref);
static void maybe_give_disable_workarounds_warning (void);
static gboolean titlebar_handler (GVariant*, gpointer*, gpointer);
-static gboolean theme_name_handler (GVariant*, gpointer*, gpointer);
static gboolean mouse_button_mods_handler (GVariant*, gpointer*, gpointer);
static gboolean button_layout_handler (GVariant*, gpointer*, gpointer);
static gboolean overlay_key_handler (GVariant*, gpointer*, gpointer);
@@ -383,14 +381,6 @@ static MetaStringPreference preferences_string[] =
NULL,
},
{
- { "theme",
- SCHEMA_GENERAL,
- META_PREF_THEME,
- },
- theme_name_handler,
- NULL,
- },
- {
{ KEY_TITLEBAR_FONT,
SCHEMA_GENERAL,
META_PREF_TITLEBAR_FONT,
@@ -1226,12 +1216,6 @@ meta_prefs_get_raise_on_click (void)
}
const char*
-meta_prefs_get_theme (void)
-{
- return current_theme;
-}
-
-const char*
meta_prefs_get_cursor_theme (void)
{
return cursor_theme;
@@ -1288,31 +1272,6 @@ titlebar_handler (GVariant *value,
}
static gboolean
-theme_name_handler (GVariant *value,
- gpointer *result,
- gpointer data)
-{
- const gchar *string_value;
-
- *result = NULL; /* ignored */
- string_value = g_variant_get_string (value, NULL);
-
- if (!string_value || !*string_value)
- return FALSE;
-
- if (g_strcmp0 (current_theme, string_value) != 0)
- {
- if (current_theme)
- g_free (current_theme);
-
- current_theme = g_strdup (string_value);
- queue_changed (META_PREF_THEME);
- }
-
- return TRUE;
-}
-
-static gboolean
mouse_button_mods_handler (GVariant *value,
gpointer *result,
gpointer data)
@@ -1731,9 +1690,6 @@ meta_preference_to_string (MetaPreference pref)
case META_PREF_RAISE_ON_CLICK:
return "RAISE_ON_CLICK";
- case META_PREF_THEME:
- return "THEME";
-
case META_PREF_TITLEBAR_FONT:
return "TITLEBAR_FONT";
diff --git a/src/core/stack-tracker.c b/src/core/stack-tracker.c
index 17979e3..1aaf780 100644
--- a/src/core/stack-tracker.c
+++ b/src/core/stack-tracker.c
@@ -711,9 +711,7 @@ meta_stack_tracker_sync_stack (MetaStackTracker *tracker)
* XID => window table. (Wine uses a toplevel for _NET_WM_USER_TIME_WINDOW;
* see window-prop.c:reload_net_wm_user_time_window() for registration.)
*/
- if (meta_window &&
- (windows[i] == meta_window->xwindow ||
- (meta_window->frame && windows[i] == meta_window->frame->xwindow)))
+ if (meta_window && windows[i] == meta_window->xwindow)
meta_windows = g_list_prepend (meta_windows, meta_window);
}
diff --git a/src/core/stack.c b/src/core/stack.c
index 18f1d7e..f51e6bb 100644
--- a/src/core/stack.c
+++ b/src/core/stack.c
@@ -1189,10 +1189,7 @@ stack_sync_to_server (MetaStack *stack)
else
g_array_prepend_val (stacked, w->xwindow);
- if (w->frame)
- top_level_window = w->frame->xwindow;
- else
- top_level_window = w->xwindow;
+ top_level_window = w->xwindow;
/* We don't restack hidden windows along with the rest, though they are
* reflected in the _NET hints. Hidden windows all get pushed below
diff --git a/src/core/window.c b/src/core/window.c
index 6405b23..7a5cd91 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -1705,13 +1705,6 @@ meta_window_unmanage (MetaWindow *window,
meta_compositor_remove_window (window->display->compositor, window);
}
- if (window->display->window_with_menu == window)
- {
- meta_ui_window_menu_free (window->display->window_menu);
- window->display->window_menu = NULL;
- window->display->window_with_menu = NULL;
- }
-
if (destroying_windows_disallowed > 0)
meta_bug ("Tried to destroy window %s while destruction was not allowed\n",
window->desc);
@@ -3697,10 +3690,6 @@ meta_window_tile (MetaWindow *window)
window,
&old_rect,
&new_rect);
-
- if (window->frame)
- meta_ui_queue_frame_draw (window->screen->ui,
- window->frame->xwindow);
}
else
{
@@ -7888,11 +7877,6 @@ meta_window_update_shape_region_x11 (MetaWindow *window)
static void
redraw_icon (MetaWindow *window)
{
- /* We could probably be smart and just redraw the icon here,
- * instead of the whole frame.
- */
- if (window->frame)
- meta_ui_queue_frame_draw (window->screen->ui, window->frame->xwindow);
}
void
@@ -8644,145 +8628,6 @@ recalc_window_features (MetaWindow *window)
*/
}
-static void
-menu_callback (MetaWindowMenu *menu,
- Display *xdisplay,
- Window client_xwindow,
- guint32 timestamp,
- MetaMenuOp op,
- int workspace_index,
- gpointer data)
-{
- MetaDisplay *display;
- MetaWindow *window;
- MetaWorkspace *workspace;
-
- display = meta_display_for_x_display (xdisplay);
- window = meta_display_lookup_x_window (display, client_xwindow);
- workspace = NULL;
-
- if (window != NULL) /* window can be NULL */
- {
- meta_verbose ("Menu op %u on %s\n", op, window->desc);
-
- switch (op)
- {
- case META_MENU_OP_NONE:
- /* nothing */
- break;
-
- case META_MENU_OP_DELETE:
- meta_window_delete (window, timestamp);
- break;
-
- case META_MENU_OP_MINIMIZE:
- meta_window_minimize (window);
- break;
-
- case META_MENU_OP_UNMAXIMIZE:
- meta_window_unmaximize (window,
- META_MAXIMIZE_HORIZONTAL |
- META_MAXIMIZE_VERTICAL);
- break;
-
- case META_MENU_OP_MAXIMIZE:
- meta_window_maximize (window,
- META_MAXIMIZE_HORIZONTAL |
- META_MAXIMIZE_VERTICAL);
- break;
-
- case META_MENU_OP_UNSHADE:
- meta_window_unshade (window, timestamp);
- break;
-
- case META_MENU_OP_SHADE:
- meta_window_shade (window, timestamp);
- break;
-
- case META_MENU_OP_MOVE_LEFT:
- workspace = meta_workspace_get_neighbor (window->screen->active_workspace,
- META_MOTION_LEFT);
- break;
-
- case META_MENU_OP_MOVE_RIGHT:
- workspace = meta_workspace_get_neighbor (window->screen->active_workspace,
- META_MOTION_RIGHT);
- break;
-
- case META_MENU_OP_MOVE_UP:
- workspace = meta_workspace_get_neighbor (window->screen->active_workspace,
- META_MOTION_UP);
- break;
-
- case META_MENU_OP_MOVE_DOWN:
- workspace = meta_workspace_get_neighbor (window->screen->active_workspace,
- META_MOTION_DOWN);
- break;
-
- case META_MENU_OP_WORKSPACES:
- workspace = meta_screen_get_workspace_by_index (window->screen,
- workspace_index);
- break;
-
- case META_MENU_OP_STICK:
- meta_window_stick (window);
- break;
-
- case META_MENU_OP_UNSTICK:
- meta_window_unstick (window);
- break;
-
- case META_MENU_OP_ABOVE:
- case META_MENU_OP_UNABOVE:
- if (window->wm_state_above == FALSE)
- meta_window_make_above (window);
- else
- meta_window_unmake_above (window);
- break;
-
- case META_MENU_OP_MOVE:
- meta_window_begin_grab_op (window,
- META_GRAB_OP_KEYBOARD_MOVING,
- TRUE,
- timestamp);
- break;
-
- case META_MENU_OP_RESIZE:
- meta_window_begin_grab_op (window,
- META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN,
- TRUE,
- timestamp);
- break;
-
- case META_MENU_OP_RECOVER:
- meta_window_shove_titlebar_onscreen (window);
- break;
-
- default:
- meta_warning (G_STRLOC": Unknown window op\n");
- break;
- }
-
- if (workspace)
- {
- meta_window_change_workspace (window,
- workspace);
- }
- }
- else
- {
- meta_verbose ("Menu callback on nonexistent window\n");
- }
-
- if (display->window_menu == menu)
- {
- display->window_menu = NULL;
- display->window_with_menu = NULL;
- }
-
- meta_ui_window_menu_free (menu);
-}
-
void
meta_window_show_menu (MetaWindow *window,
int root_x,
@@ -8790,126 +8635,6 @@ meta_window_show_menu (MetaWindow *window,
int button,
guint32 timestamp)
{
- MetaMenuOp ops;
- MetaMenuOp insensitive;
- MetaWindowMenu *menu;
- MetaWorkspaceLayout layout;
- int n_workspaces;
- gboolean ltr;
-
- g_return_if_fail (!window->override_redirect);
-
- if (window->display->window_menu)
- {
- meta_ui_window_menu_free (window->display->window_menu);
- window->display->window_menu = NULL;
- window->display->window_with_menu = NULL;
- }
-
- ops = META_MENU_OP_NONE;
- insensitive = META_MENU_OP_NONE;
-
- ops |= (META_MENU_OP_DELETE | META_MENU_OP_MINIMIZE | META_MENU_OP_MOVE | META_MENU_OP_RESIZE);
-
- if (!meta_window_titlebar_is_onscreen (window) &&
- window->type != META_WINDOW_DOCK &&
- window->type != META_WINDOW_DESKTOP)
- ops |= META_MENU_OP_RECOVER;
-
- if (!meta_prefs_get_workspaces_only_on_primary () ||
- meta_window_is_on_primary_monitor (window))
- {
- n_workspaces = meta_screen_get_n_workspaces (window->screen);
-
- if (n_workspaces > 1)
- ops |= META_MENU_OP_WORKSPACES;
-
- meta_screen_calc_workspace_layout (window->screen,
- n_workspaces,
- meta_workspace_index ( window->screen->active_workspace),
- &layout);
-
- if (!window->on_all_workspaces)
- {
- ltr = meta_ui_get_direction() == META_UI_DIRECTION_LTR;
-
- if (layout.current_col > 0)
- ops |= ltr ? META_MENU_OP_MOVE_LEFT : META_MENU_OP_MOVE_RIGHT;
- if ((layout.current_col < layout.cols - 1) &&
- (layout.current_row * layout.cols + (layout.current_col + 1) < n_workspaces))
- ops |= ltr ? META_MENU_OP_MOVE_RIGHT : META_MENU_OP_MOVE_LEFT;
- if (layout.current_row > 0)
- ops |= META_MENU_OP_MOVE_UP;
- if ((layout.current_row < layout.rows - 1) &&
- ((layout.current_row + 1) * layout.cols + layout.current_col < n_workspaces))
- ops |= META_MENU_OP_MOVE_DOWN;
- }
-
- meta_screen_free_workspace_layout (&layout);
-
- ops |= META_MENU_OP_UNSTICK;
- ops |= META_MENU_OP_STICK;
- }
-
- if (META_WINDOW_MAXIMIZED (window))
- ops |= META_MENU_OP_UNMAXIMIZE;
- else
- ops |= META_MENU_OP_MAXIMIZE;
-
- if (window->wm_state_above)
- ops |= META_MENU_OP_UNABOVE;
- else
- ops |= META_MENU_OP_ABOVE;
-
- if (!window->has_maximize_func)
- insensitive |= META_MENU_OP_UNMAXIMIZE | META_MENU_OP_MAXIMIZE;
-
- if (!window->has_minimize_func)
- insensitive |= META_MENU_OP_MINIMIZE;
-
- if (!window->has_close_func)
- insensitive |= META_MENU_OP_DELETE;
-
- if (!window->has_shade_func)
- insensitive |= META_MENU_OP_SHADE | META_MENU_OP_UNSHADE;
-
- if (!META_WINDOW_ALLOWS_MOVE (window))
- insensitive |= META_MENU_OP_MOVE;
-
- if (!META_WINDOW_ALLOWS_RESIZE (window))
- insensitive |= META_MENU_OP_RESIZE;
-
- if (window->always_sticky)
- insensitive |= META_MENU_OP_STICK | META_MENU_OP_UNSTICK | META_MENU_OP_WORKSPACES;
-
- if ((window->type == META_WINDOW_DESKTOP) ||
- (window->type == META_WINDOW_DOCK) ||
- (window->type == META_WINDOW_SPLASHSCREEN ||
- META_WINDOW_MAXIMIZED (window)))
- insensitive |= META_MENU_OP_ABOVE | META_MENU_OP_UNABOVE;
-
- /* If all operations are disabled, just quit without showing the menu.
- * This is the case, for example, with META_WINDOW_DESKTOP windows.
- */
- if ((ops & ~insensitive) == 0)
- return;
-
- menu =
- meta_ui_window_menu_new (window->screen->ui,
- window->xwindow,
- ops,
- insensitive,
- meta_window_get_net_wm_desktop (window),
- meta_screen_get_n_workspaces (window->screen),
- menu_callback,
- NULL);
-
- window->display->window_menu = menu;
- window->display->window_with_menu = window;
-
- meta_verbose ("Popping up window menu for %s\n", window->desc);
-
- meta_ui_window_menu_popup (menu, root_x, root_y, button, timestamp);
}
void
@@ -11245,13 +10970,7 @@ meta_window_get_frame_type (MetaWindow *window)
cairo_region_t *
meta_window_get_frame_bounds (MetaWindow *window)
{
- if (!window->frame_bounds)
- {
- if (window->frame)
- window->frame_bounds = meta_frame_get_frame_bounds (window->frame);
- }
-
- return window->frame_bounds;
+ return NULL;
}
/**
diff --git a/src/gtk-decorator/gtk-decorator.c b/src/gtk-decorator/gtk-decorator.c
new file mode 100644
index 0000000..b760340
--- /dev/null
+++ b/src/gtk-decorator/gtk-decorator.c
@@ -0,0 +1,143 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/*
+ * Copyright (C) 2013 Red Hat
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Written by:
+ * Jasper St. Pierre <jstpierre mecheye net>
+ */
+
+#include <gtk/gtk.h>
+#include <gdk/gdkx.h>
+
+#include <X11/extensions/Xcomposite.h>
+
+typedef struct {
+ Display *xdisplay;
+} Decorator;
+
+typedef struct {
+ Decorator decorator;
+ Window child_window;
+
+ GtkWidget *window;
+ GtkWidget *socket;
+} WindowFrame;
+
+static void
+socket_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation,
+ gpointer user_data)
+{
+ WindowFrame *frame = user_data;
+
+ XMoveResizeWindow (GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (widget)),
+ frame->child_window,
+ allocation->x, allocation->y,
+ allocation->width, allocation->height);
+}
+
+static WindowFrame *
+frame_window (Decorator *decorator,
+ Window child_window)
+{
+ WindowFrame *frame;
+ XWindowAttributes attrs;
+ GtkWidget *window, *socket;
+
+ XGetWindowAttributes (decorator->xdisplay, child_window, &attrs);
+
+ frame = g_slice_new0 (WindowFrame);
+ frame->child_window = child_window;
+
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ frame->window = window;
+ gtk_window_move (GTK_WINDOW (window), attrs.x, attrs.y);
+
+ socket = gtk_frame_new (NULL);
+ frame->socket = socket;
+ gtk_widget_set_size_request (socket, attrs.width, attrs.height);
+ g_signal_connect (socket, "size-allocate",
+ G_CALLBACK (socket_size_allocate), frame);
+ gtk_container_add (GTK_CONTAINER (window), socket);
+
+ gtk_widget_show (socket);
+ gtk_widget_show (window);
+
+ XReparentWindow (decorator->xdisplay,
+ child_window,
+ GDK_WINDOW_XID (gtk_widget_get_window (window)),
+ /* these will be positioned correctly at the
+ * next size-allocate pass... */
+ 0, 0);
+
+ return frame;
+}
+
+static Window
+find_test_window (Display *dpy)
+{
+ Window root, parent;
+ Window *children;
+ Window ret = None;
+ unsigned int i, n_children;
+
+ XQueryTree (dpy, DefaultRootWindow (dpy),
+ &root, &parent,
+ &children, &n_children);
+
+ for (i = 0; i < n_children; i++)
+ {
+ Window child = children[i];
+ char *name;
+
+ XFetchName (dpy, child, &name);
+ if (g_strcmp0 (name, "this is a test window") == 0)
+ ret = child;
+
+ g_free (name);
+
+ if (ret)
+ break;
+ }
+
+ return ret;
+}
+
+static void
+decorator_init (Decorator *decorator)
+{
+ decorator->xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
+}
+
+int
+main (int argc,
+ char **argv)
+{
+ Decorator decorator;
+ Window window;
+
+ gtk_init (&argc, &argv);
+
+ decorator_init (&decorator);
+
+ window = find_test_window (decorator.xdisplay);
+ frame_window (&decorator, window);
+
+ gtk_main ();
+ return 0;
+}
diff --git a/src/meta/meta-background-actor.h b/src/meta/meta-background-actor.h
index 56e9768..4904a7a 100644
--- a/src/meta/meta-background-actor.h
+++ b/src/meta/meta-background-actor.h
@@ -24,7 +24,6 @@
#include <clutter/clutter.h>
#include <cogl/cogl.h>
-#include <meta/gradient.h>
#include <meta/screen.h>
#include <gsettings-desktop-schemas/gdesktop-enums.h>
diff --git a/src/meta/meta-background.h b/src/meta/meta-background.h
index c171df3..3028d8a 100644
--- a/src/meta/meta-background.h
+++ b/src/meta/meta-background.h
@@ -24,7 +24,6 @@
#include <cogl/cogl.h>
#include <clutter/clutter.h>
-#include <meta/gradient.h>
#include <meta/screen.h>
#include <gsettings-desktop-schemas/gdesktop-enums.h>
diff --git a/src/meta/prefs.h b/src/meta/prefs.h
index a5a3ab2..b2ba0f6 100644
--- a/src/meta/prefs.h
+++ b/src/meta/prefs.h
@@ -43,7 +43,6 @@
* @META_PREF_AUTO_RAISE: auto-raise
* @META_PREF_AUTO_RAISE_DELAY: auto-raise delay
* @META_PREF_FOCUS_CHANGE_ON_POINTER_REST: focus change on pointer rest
- * @META_PREF_THEME: theme
* @META_PREF_TITLEBAR_FONT: title-bar font
* @META_PREF_NUM_WORKSPACES: number of workspaces
* @META_PREF_DYNAMIC_WORKSPACES: dynamic workspaces
@@ -80,7 +79,6 @@ typedef enum
META_PREF_AUTO_RAISE,
META_PREF_AUTO_RAISE_DELAY,
META_PREF_FOCUS_CHANGE_ON_POINTER_REST,
- META_PREF_THEME,
META_PREF_TITLEBAR_FONT,
META_PREF_NUM_WORKSPACES,
META_PREF_DYNAMIC_WORKSPACES,
@@ -125,7 +123,6 @@ GDesktopFocusMode meta_prefs_get_focus_mode (void);
GDesktopFocusNewWindows meta_prefs_get_focus_new_windows (void);
gboolean meta_prefs_get_attach_modal_dialogs (void);
gboolean meta_prefs_get_raise_on_click (void);
-const char* meta_prefs_get_theme (void);
/* returns NULL if GTK default should be used */
const PangoFontDescription* meta_prefs_get_titlebar_font (void);
int meta_prefs_get_num_workspaces (void);
diff --git a/src/meta/util.h b/src/meta/util.h
index 9328a26..1b85271 100644
--- a/src/meta/util.h
+++ b/src/meta/util.h
@@ -111,7 +111,6 @@ gint meta_unsigned_long_equal (gconstpointer v1,
gconstpointer v2);
guint meta_unsigned_long_hash (gconstpointer v);
-const char* meta_frame_type_to_string (MetaFrameType type);
const char* meta_gravity_to_string (int gravity);
char* meta_external_binding_name_for_action (guint keybinding_action);
diff --git a/src/ui/ui.c b/src/ui/ui.c
index aa1d3bd..82b559b 100644
--- a/src/ui/ui.c
+++ b/src/ui/ui.c
@@ -22,11 +22,8 @@
#include <config.h>
#include <meta/prefs.h>
#include "ui.h"
-#include "frames.h"
#include <meta/util.h>
-#include "menu.h"
#include "core.h"
-#include "theme-private.h"
#include <string.h>
#include <stdlib.h>
@@ -41,7 +38,6 @@ struct _MetaUI
{
Display *xdisplay;
Screen *xscreen;
- MetaFrames *frames;
/* For double-click tracking */
gint button_click_number;
@@ -56,11 +52,6 @@ meta_ui_init (void)
{
if (!gtk_init_check (NULL, NULL))
meta_fatal ("Unable to open X display %s\n", XDisplayName (NULL));
-
- /* We need to be able to fully trust that the window and monitor sizes
- that Gdk reports corresponds to the X ones, so we disable the automatic
- scale handling */
- gdk_x11_display_set_window_scale (gdk_display_get_default (), 1);
}
Display*
@@ -75,162 +66,6 @@ meta_ui_get_screen_number (void)
return gdk_screen_get_number (gdk_screen_get_default ());
}
-/* For XInput2 */
-#include "display-private.h"
-
-static gboolean
-is_input_event (XEvent *event)
-{
- MetaDisplay *display = meta_get_display ();
-
- return (event->type == GenericEvent &&
- event->xcookie.extension == display->xinput_opcode);
-}
-
-/* We do some of our event handling in frames.c, which expects
- * GDK events delivered by GTK+. However, since the transition to
- * client side windows, we can't let GDK see button events, since the
- * client-side tracking of implicit and explicit grabs it does will
- * get confused by our direct use of X grabs in the core code.
- *
- * So we do a very minimal GDK => GTK event conversion here and send on the
- * events we care about, and then filter them out so they don't go
- * through the normal GDK event handling.
- *
- * To reduce the amount of code, the only events fields filled out
- * below are the ones that frames.c uses. If frames.c is modified to
- * use more fields, more fields need to be filled out below.
- */
-
-static gboolean
-maybe_redirect_mouse_event (XEvent *xevent)
-{
- GdkDisplay *gdisplay;
- GdkDeviceManager *gmanager;
- GdkDevice *gdevice;
- MetaUI *ui;
- GdkEvent *gevent;
- GdkWindow *gdk_window;
- Window window;
- XIEvent *xev;
- XIDeviceEvent *xev_d = NULL;
- XIEnterEvent *xev_e = NULL;
-
- if (!is_input_event (xevent))
- return FALSE;
-
- xev = (XIEvent *) xevent->xcookie.data;
-
- switch (xev->evtype)
- {
- case XI_ButtonPress:
- case XI_ButtonRelease:
- case XI_Motion:
- xev_d = (XIDeviceEvent *) xev;
- window = xev_d->event;
- break;
- case XI_Enter:
- case XI_Leave:
- xev_e = (XIEnterEvent *) xev;
- window = xev_e->event;
- break;
- default:
- return FALSE;
- }
-
- gdisplay = gdk_x11_lookup_xdisplay (xev->display);
- ui = g_object_get_data (G_OBJECT (gdisplay), "meta-ui");
- if (!ui)
- return FALSE;
-
- gdk_window = gdk_x11_window_lookup_for_display (gdisplay, window);
- if (gdk_window == NULL)
- return FALSE;
-
- gmanager = gdk_display_get_device_manager (gdisplay);
- gdevice = gdk_x11_device_manager_lookup (gmanager, META_VIRTUAL_CORE_POINTER_ID);
-
- /* If GDK already thinks it has a grab, we better let it see events; this
- * is the menu-navigation case and events need to get sent to the appropriate
- * (client-side) subwindow for individual menu items.
- */
- if (gdk_display_device_is_grabbed (gdisplay, gdevice))
- return FALSE;
-
- switch (xev->evtype)
- {
- case XI_ButtonPress:
- case XI_ButtonRelease:
- if (xev_d->evtype == XI_ButtonPress)
- {
- GtkSettings *settings = gtk_settings_get_default ();
- int double_click_time;
- int double_click_distance;
-
- g_object_get (settings,
- "gtk-double-click-time", &double_click_time,
- "gtk-double-click-distance", &double_click_distance,
- NULL);
-
- if (xev_d->detail == ui->button_click_number &&
- xev_d->event == ui->button_click_window &&
- xev_d->time < ui->button_click_time + double_click_time &&
- ABS (xev_d->event_x - ui->button_click_x) <= double_click_distance &&
- ABS (xev_d->event_y - ui->button_click_y) <= double_click_distance)
- {
- gevent = gdk_event_new (GDK_2BUTTON_PRESS);
-
- ui->button_click_number = 0;
- }
- else
- {
- gevent = gdk_event_new (GDK_BUTTON_PRESS);
- ui->button_click_number = xev_d->detail;
- ui->button_click_window = xev_d->event;
- ui->button_click_time = xev_d->time;
- ui->button_click_x = xev_d->event_x;
- ui->button_click_y = xev_d->event_y;
- }
- }
- else
- {
- gevent = gdk_event_new (GDK_BUTTON_RELEASE);
- }
-
- gevent->button.window = g_object_ref (gdk_window);
- gevent->button.button = xev_d->detail;
- gevent->button.time = xev_d->time;
- gevent->button.x = xev_d->event_x;
- gevent->button.y = xev_d->event_y;
- gevent->button.x_root = xev_d->root_x;
- gevent->button.y_root = xev_d->root_y;
-
- break;
- case XI_Motion:
- gevent = gdk_event_new (GDK_MOTION_NOTIFY);
- gevent->motion.type = GDK_MOTION_NOTIFY;
- gevent->motion.window = g_object_ref (gdk_window);
- break;
- case XI_Enter:
- case XI_Leave:
- gevent = gdk_event_new (xev_e->evtype == XI_Enter ? GDK_ENTER_NOTIFY : GDK_LEAVE_NOTIFY);
- gevent->crossing.window = g_object_ref (gdk_window);
- gevent->crossing.x = xev_e->event_x;
- gevent->crossing.y = xev_e->event_y;
- break;
- default:
- g_assert_not_reached ();
- break;
- }
-
- /* If we've gotten here, we've created the gdk_event and should send it on */
- gdk_event_set_device (gevent, gdevice);
- gtk_main_do_event (gevent);
- gdk_event_free (gevent);
-
- return TRUE;
-}
-
typedef struct _EventFunc EventFunc;
struct _EventFunc
@@ -248,8 +83,7 @@ filter_func (GdkXEvent *xevent,
{
g_return_val_if_fail (ef != NULL, GDK_FILTER_CONTINUE);
- if ((* ef->func) (xevent, ef->data) ||
- maybe_redirect_mouse_event (xevent))
+ if ((* ef->func) (xevent, ef->data))
return GDK_FILTER_REMOVE;
else
return GDK_FILTER_CONTINUE;
@@ -297,12 +131,6 @@ meta_ui_new (Display *xdisplay,
gdisplay = gdk_x11_lookup_xdisplay (xdisplay);
g_assert (gdisplay == gdk_display_get_default ());
- ui->frames = meta_frames_new (XScreenNumberOfScreen (screen));
- /* This does not actually show any widget. MetaFrames has been hacked so
- * that showing it doesn't actually do anything. But we need the flags
- * set for GTK to deliver events properly. */
- gtk_widget_show (GTK_WIDGET (ui->frames));
-
g_object_set_data (G_OBJECT (gdisplay), "meta-ui", ui);
return ui;
@@ -313,33 +141,12 @@ meta_ui_free (MetaUI *ui)
{
GdkDisplay *gdisplay;
- gtk_widget_destroy (GTK_WIDGET (ui->frames));
-
gdisplay = gdk_x11_lookup_xdisplay (ui->xdisplay);
g_object_set_data (G_OBJECT (gdisplay), "meta-ui", NULL);
g_free (ui);
}
-void
-meta_ui_get_frame_mask (MetaUI *ui,
- Window frame_xwindow,
- guint width,
- guint height,
- cairo_t *cr)
-{
- meta_frames_get_mask (ui->frames, frame_xwindow, width, height, cr);
-}
-
-void
-meta_ui_get_frame_borders (MetaUI *ui,
- Window frame_xwindow,
- MetaFrameBorders *borders)
-{
- meta_frames_get_borders (ui->frames, frame_xwindow,
- borders);
-}
-
Window
meta_ui_create_frame_window (MetaUI *ui,
Display *xdisplay,
@@ -351,72 +158,13 @@ meta_ui_create_frame_window (MetaUI *ui,
gint screen_no,
gulong *create_serial)
{
- GdkDisplay *display = gdk_x11_lookup_xdisplay (xdisplay);
- GdkScreen *screen = gdk_display_get_screen (display, screen_no);
- GdkWindowAttr attrs;
- gint attributes_mask;
- GdkWindow *window;
- GdkVisual *visual;
-
- /* Default depth/visual handles clients with weird visuals; they can
- * always be children of the root depth/visual obviously, but
- * e.g. DRI games can't be children of a parent that has the same
- * visual as the client.
- */
- if (!xvisual)
- visual = gdk_screen_get_system_visual (screen);
- else
- {
- visual = gdk_x11_screen_lookup_visual (screen,
- XVisualIDFromVisual (xvisual));
- }
-
- attrs.title = NULL;
-
- /* frame.c is going to replace the event mask immediately, but
- * we still have to set it here to let GDK know what it is.
- */
- attrs.event_mask =
- GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
- GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
- GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_FOCUS_CHANGE_MASK;
- attrs.x = x;
- attrs.y = y;
- attrs.wclass = GDK_INPUT_OUTPUT;
- attrs.visual = visual;
- attrs.window_type = GDK_WINDOW_CHILD;
- attrs.cursor = NULL;
- attrs.wmclass_name = NULL;
- attrs.wmclass_class = NULL;
- attrs.override_redirect = FALSE;
-
- attrs.width = width;
- attrs.height = height;
-
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
-
- /* We make an assumption that gdk_window_new() is going to call
- * XCreateWindow as it's first operation; this seems to be true currently
- * as long as you pass in a colormap.
- */
- if (create_serial)
- *create_serial = XNextRequest (xdisplay);
- window =
- gdk_window_new (gdk_screen_get_root_window(screen),
- &attrs, attributes_mask);
-
- gdk_window_resize (window, width, height);
-
- meta_frames_manage_window (ui->frames, GDK_WINDOW_XID (window), window);
-
- return GDK_WINDOW_XID (window);
+ return None;
}
void
meta_ui_destroy_frame_window (MetaUI *ui,
Window xwindow)
{
- meta_frames_unmanage_window (ui->frames, xwindow);
}
void
@@ -427,83 +175,6 @@ meta_ui_move_resize_frame (MetaUI *ui,
int width,
int height)
{
- meta_frames_move_resize_frame (ui->frames, frame, x, y, width, height);
-}
-
-void
-meta_ui_map_frame (MetaUI *ui,
- Window xwindow)
-{
- GdkWindow *window;
- GdkDisplay *display;
-
- display = gdk_x11_lookup_xdisplay (ui->xdisplay);
- window = gdk_x11_window_lookup_for_display (display, xwindow);
-
- if (window)
- gdk_window_show_unraised (window);
-}
-
-void
-meta_ui_unmap_frame (MetaUI *ui,
- Window xwindow)
-{
- GdkWindow *window;
- GdkDisplay *display;
-
- display = gdk_x11_lookup_xdisplay (ui->xdisplay);
- window = gdk_x11_window_lookup_for_display (display, xwindow);
-
- if (window)
- gdk_window_hide (window);
-}
-
-void
-meta_ui_unflicker_frame_bg (MetaUI *ui,
- Window xwindow,
- int target_width,
- int target_height)
-{
- meta_frames_unflicker_bg (ui->frames, xwindow,
- target_width, target_height);
-}
-
-void
-meta_ui_update_frame_style (MetaUI *ui,
- Window xwindow)
-{
- meta_frames_update_frame_style (ui->frames, xwindow);
-}
-
-void
-meta_ui_repaint_frame (MetaUI *ui,
- Window xwindow)
-{
- meta_frames_repaint_frame (ui->frames, xwindow);
-}
-
-void
-meta_ui_reset_frame_bg (MetaUI *ui,
- Window xwindow)
-{
- meta_frames_reset_bg (ui->frames, xwindow);
-}
-
-cairo_region_t *
-meta_ui_get_frame_bounds (MetaUI *ui,
- Window xwindow,
- int window_width,
- int window_height)
-{
- return meta_frames_get_frame_bounds (ui->frames, xwindow,
- window_width, window_height);
-}
-
-void
-meta_ui_queue_frame_draw (MetaUI *ui,
- Window xwindow)
-{
- meta_frames_queue_draw (ui->frames, xwindow);
}
void
@@ -511,41 +182,12 @@ meta_ui_set_frame_title (MetaUI *ui,
Window xwindow,
const char *title)
{
- meta_frames_set_title (ui->frames, xwindow, title);
-}
-
-MetaWindowMenu*
-meta_ui_window_menu_new (MetaUI *ui,
- Window client_xwindow,
- MetaMenuOp ops,
- MetaMenuOp insensitive,
- unsigned long active_workspace,
- int n_workspaces,
- MetaWindowMenuFunc func,
- gpointer data)
-{
- return meta_window_menu_new (ui->frames,
- ops, insensitive,
- client_xwindow,
- active_workspace,
- n_workspaces,
- func, data);
}
void
-meta_ui_window_menu_popup (MetaWindowMenu *menu,
- int root_x,
- int root_y,
- int button,
- guint32 timestamp)
-{
- meta_window_menu_popup (menu, root_x, root_y, button, timestamp);
-}
-
-void
-meta_ui_window_menu_free (MetaWindowMenu *menu)
+meta_ui_update_frame_style (MetaUI *ui,
+ Window xwindow)
{
- meta_window_menu_free (menu);
}
GdkPixbuf*
@@ -725,63 +367,7 @@ meta_ui_theme_get_frame_borders (MetaUI *ui,
MetaFrameFlags flags,
MetaFrameBorders *borders)
{
- int text_height;
- GtkStyleContext *style = NULL;
- PangoContext *context;
- const PangoFontDescription *font_desc;
- PangoFontDescription *free_font_desc = NULL;
-
- if (meta_ui_have_a_theme ())
- {
- context = gtk_widget_get_pango_context (GTK_WIDGET (ui->frames));
- font_desc = meta_prefs_get_titlebar_font ();
-
- if (!font_desc)
- {
- GdkDisplay *display = gdk_x11_lookup_xdisplay (ui->xdisplay);
- GdkScreen *screen = gdk_display_get_screen (display, XScreenNumberOfScreen (ui->xscreen));
- GtkWidgetPath *widget_path;
-
- style = gtk_style_context_new ();
- gtk_style_context_set_screen (style, screen);
- widget_path = gtk_widget_path_new ();
- gtk_widget_path_append_type (widget_path, GTK_TYPE_WINDOW);
- gtk_style_context_set_path (style, widget_path);
- gtk_widget_path_free (widget_path);
-
- gtk_style_context_get (style, GTK_STATE_FLAG_NORMAL, "font", &free_font_desc, NULL);
- font_desc = (const PangoFontDescription *) free_font_desc;
- }
-
- text_height = meta_pango_font_desc_get_text_height (font_desc, context);
-
- meta_theme_get_frame_borders (meta_theme_get_current (),
- type, text_height, flags,
- borders);
-
- if (free_font_desc)
- pango_font_description_free (free_font_desc);
- }
- else
- {
- meta_frame_borders_clear (borders);
- }
-
- if (style != NULL)
- g_object_unref (style);
-}
-
-void
-meta_ui_set_current_theme (const char *name)
-{
- meta_theme_set_current (name);
- meta_invalidate_default_icons ();
-}
-
-gboolean
-meta_ui_have_a_theme (void)
-{
- return meta_theme_get_current () != NULL;
+ meta_frame_borders_clear (borders);
}
static void
@@ -974,33 +560,13 @@ meta_ui_parse_modifier (const char *accel,
return TRUE;
}
-gboolean
-meta_ui_window_is_widget (MetaUI *ui,
- Window xwindow)
-{
- GdkDisplay *display;
- GdkWindow *window;
-
- display = gdk_x11_lookup_xdisplay (ui->xdisplay);
- window = gdk_x11_window_lookup_for_display (display, xwindow);
-
- if (window)
- {
- void *user_data = NULL;
- gdk_window_get_user_data (window, &user_data);
- return user_data != NULL && user_data != ui->frames;
- }
- else
- return FALSE;
-}
-
int
meta_ui_get_drag_threshold (MetaUI *ui)
{
GtkSettings *settings;
int threshold;
- settings = gtk_widget_get_settings (GTK_WIDGET (ui->frames));
+ settings = gtk_settings_get_default ();
threshold = 8;
g_object_get (G_OBJECT (settings), "gtk-dnd-drag-threshold", &threshold, NULL);
diff --git a/src/ui/ui.h b/src/ui/ui.h
index ca52f4c..4b90c3f 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -61,16 +61,6 @@ void meta_ui_theme_get_frame_borders (MetaUI *ui,
MetaFrameType type,
MetaFrameFlags flags,
MetaFrameBorders *borders);
-void meta_ui_get_frame_borders (MetaUI *ui,
- Window frame_xwindow,
- MetaFrameBorders *borders);
-
-void meta_ui_get_frame_mask (MetaUI *ui,
- Window frame_xwindow,
- guint width,
- guint height,
- cairo_t *cr);
-
Window meta_ui_create_frame_window (MetaUI *ui,
Display *xdisplay,
Visual *xvisual,
@@ -88,54 +78,12 @@ void meta_ui_move_resize_frame (MetaUI *ui,
int y,
int width,
int height);
-
-/* GDK insists on tracking map/unmap */
-void meta_ui_map_frame (MetaUI *ui,
- Window xwindow);
-void meta_ui_unmap_frame (MetaUI *ui,
- Window xwindow);
-
-void meta_ui_unflicker_frame_bg (MetaUI *ui,
- Window xwindow,
- int target_width,
- int target_height);
-void meta_ui_reset_frame_bg (MetaUI *ui,
- Window xwindow);
-
-cairo_region_t *meta_ui_get_frame_bounds (MetaUI *ui,
- Window xwindow,
- int window_width,
- int window_height);
-
-void meta_ui_queue_frame_draw (MetaUI *ui,
- Window xwindow);
-
void meta_ui_set_frame_title (MetaUI *ui,
Window xwindow,
const char *title);
void meta_ui_update_frame_style (MetaUI *ui,
Window window);
-
-void meta_ui_repaint_frame (MetaUI *ui,
- Window xwindow);
-
-MetaWindowMenu* meta_ui_window_menu_new (MetaUI *ui,
- Window client_xwindow,
- MetaMenuOp ops,
- MetaMenuOp insensitive,
- unsigned long active_workspace,
- int n_workspaces,
- MetaWindowMenuFunc func,
- gpointer data);
-void meta_ui_window_menu_popup (MetaWindowMenu *menu,
- int root_x,
- int root_y,
- int button,
- guint32 timestamp);
-void meta_ui_window_menu_free (MetaWindowMenu *menu);
-
-
/* FIXME these lack a display arg */
GdkPixbuf* meta_gdk_pixbuf_get_from_pixmap (Pixmap xpixmap,
int src_x,
@@ -152,9 +100,6 @@ gboolean meta_ui_window_should_not_cause_focus (Display *xdisplay,
char* meta_text_property_to_utf8 (Display *xdisplay,
const XTextProperty *prop);
-void meta_ui_set_current_theme (const char *name);
-gboolean meta_ui_have_a_theme (void);
-
/* Not a real key symbol but means "key above the tab key"; this is
* used as the default keybinding for cycle_group.
* 0x2xxxxxxx is a range not used by GDK or X. the remaining digits are
@@ -171,8 +116,6 @@ gboolean meta_ui_parse_modifier (const char *accel,
/* Caller responsible for freeing return string of meta_ui_accelerator_name! */
gchar* meta_ui_accelerator_name (unsigned int keysym,
MetaVirtualModifier mask);
-gboolean meta_ui_window_is_widget (MetaUI *ui,
- Window xwindow);
int meta_ui_get_drag_threshold (MetaUI *ui);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]