diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/frame.c | 159 | ||||
-rw-r--r-- | src/core/frame.h | 3 | ||||
-rw-r--r-- | src/core/keybindings.c | 4 | ||||
-rw-r--r-- | src/core/main.c | 42 | ||||
-rw-r--r-- | src/core/prefs.c | 44 | ||||
-rw-r--r-- | src/core/stack-tracker.c | 4 | ||||
-rw-r--r-- | src/core/stack.c | 5 | ||||
-rw-r--r-- | src/core/window.c | 283 |
8 files changed, 38 insertions, 506 deletions
diff --git a/src/core/frame.c b/src/core/frame.c index ed7e3cb59..086160291 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 8ac1c261e..e22348df4 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 c43afd1ac..6038948d5 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 b2eb4cdbb..63d750b33 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 d9f0f28d9..cc9c6ead3 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 17979e38a..1aaf7801e 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 18f1d7e56..f51e6bb9d 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 6405b2370..7a5cd91ec 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; } /** |