Assume the compositor always exists

At one point, it was supported to run mutter without a compositor,
but we don't allow that any longer. A lot of code already assumes
display->compositor exists and doesn't check for a NULL pointer,
so just kill the rest of the checks.
This commit is contained in:
Jasper St. Pierre 2014-03-18 17:06:42 -04:00
parent 4fdbb466e1
commit 8b2b65246a
6 changed files with 87 additions and 232 deletions

View File

@ -58,88 +58,6 @@
#include <canberra-gtk.h>
#endif
/**
* bell_flash_screen:
* @display: The display which owns the screen (rather redundant)
* @screen: The screen to flash
*
* Flashes one entire screen. This is done by making a window the size of the
* whole screen (or reusing the old one, if it's still around), mapping it,
* painting it white and then black, and then unmapping it. We set saveunder so
* that all the windows behind it come back immediately.
*
* Unlike frame flashes, we don't do fullscreen flashes with a timeout; rather,
* we do them in one go, because we don't have to rely on the theme code
* redrawing the frame for us in order to do the flash.
*/
/*
* Bug: The way I read it, this appears not to do the flash
* the first time we flash a particular display. Am I wrong?
*
* Bug: This appears to destroy our current XSync status.
*/
static void
bell_flash_screen (MetaDisplay *display,
MetaScreen *screen)
{
Window root = screen->xroot;
int width = screen->rect.width;
int height = screen->rect.height;
if (screen->flash_window == None)
{
Visual *visual = (Visual *)CopyFromParent;
XSetWindowAttributes xswa;
int depth = CopyFromParent;
xswa.save_under = True;
xswa.override_redirect = True;
/*
* TODO: use XGetVisualInfo and determine which is an
* overlay, if one is present, and use the Overlay visual
* for this window (for performance reasons).
* Not sure how to tell this yet...
*/
screen->flash_window = XCreateWindow (display->xdisplay, root,
0, 0, width, height,
0, depth,
InputOutput,
visual,
/* note: XSun doesn't like SaveUnder here */
CWSaveUnder | CWOverrideRedirect,
&xswa);
XSelectInput (display->xdisplay, screen->flash_window, ExposureMask);
XMapWindow (display->xdisplay, screen->flash_window);
XSync (display->xdisplay, False);
XFlush (display->xdisplay);
XUnmapWindow (display->xdisplay, screen->flash_window);
}
else
{
/* just draw something in the window */
GC gc = XCreateGC (display->xdisplay, screen->flash_window, 0, NULL);
XMapWindow (display->xdisplay, screen->flash_window);
XSetForeground (display->xdisplay, gc,
WhitePixel (display->xdisplay,
XScreenNumberOfScreen (screen->xscreen)));
XFillRectangle (display->xdisplay, screen->flash_window, gc,
0, 0, width, height);
XSetForeground (display->xdisplay, gc,
BlackPixel (display->xdisplay,
XScreenNumberOfScreen (screen->xscreen)));
XFillRectangle (display->xdisplay, screen->flash_window, gc,
0, 0, width, height);
XFlush (display->xdisplay);
XSync (display->xdisplay, False);
XUnmapWindow (display->xdisplay, screen->flash_window);
XFreeGC (display->xdisplay, gc);
}
if (meta_prefs_get_focus_mode () != G_DESKTOP_FOCUS_MODE_CLICK &&
!display->mouse_mode)
meta_display_increment_focus_sentinel (display);
XFlush (display->xdisplay);
}
/**
* bell_flash_fullscreen:
* @display: The display the event came in on
@ -164,12 +82,7 @@ bell_flash_fullscreen (MetaDisplay *display,
{
screen = meta_display_screen_for_xwindow (display, xkb_bell_ev->window);
if (screen)
{
if (display->compositor)
meta_compositor_flash_screen (display->compositor, screen);
else
bell_flash_screen (display, screen);
}
}
else
{
@ -177,10 +90,7 @@ bell_flash_fullscreen (MetaDisplay *display,
while (screen_list)
{
screen = (MetaScreen *) screen_list->data;
if (display->compositor)
meta_compositor_flash_screen (display->compositor, screen);
else
bell_flash_screen (display, screen);
screen_list = screen_list->next;
}
}

View File

@ -2621,7 +2621,7 @@ handle_other_xevent (MetaDisplay *display,
/* NB: override redirect windows wont cause a map request so we
* watch out for map notifies against any root windows too if a
* compositor is enabled: */
if (display->compositor && window == NULL
if (window == NULL
&& meta_display_screen_for_root (display, event->xmap.event))
{
window = meta_window_x11_new (display, event->xmap.window,
@ -3085,7 +3085,7 @@ meta_display_handle_xevent (MetaDisplay *display,
}
out:
if (display->compositor && !bypass_compositor)
if (!bypass_compositor)
{
MetaWindow *window = modified != None ? meta_display_lookup_x_window (display, modified) : NULL;

View File

@ -809,11 +809,8 @@ meta_screen_free (MetaScreen *screen,
meta_display_grab (display);
if (screen->display->compositor)
{
meta_compositor_unmanage_screen (screen->display->compositor,
screen);
}
meta_display_unmanage_windows_for_screen (display, screen, timestamp);
@ -2523,7 +2520,6 @@ on_monitors_changed (MetaMonitorManager *manager,
&changes);
}
if (screen->display->compositor)
meta_compositor_sync_screen_size (screen->display->compositor,
screen,
screen->rect.width, screen->rect.height);

View File

@ -1245,7 +1245,6 @@ meta_stack_tracker_sync_stack (MetaStackTracker *tracker)
meta_windows = g_list_prepend (meta_windows, window->wayland.meta_window);
}
if (tracker->screen->display->compositor)
meta_compositor_sync_stack (tracker->screen->display->compositor,
tracker->screen,
meta_windows);

View File

@ -1221,7 +1221,6 @@ _meta_window_shared_new (MetaDisplay *display,
set_net_wm_state (window);
}
if (screen->display->compositor)
meta_compositor_add_window (screen->display->compositor, window);
/* Sync stack changes */
@ -1505,14 +1504,11 @@ meta_window_unmanage (MetaWindow *window,
0);
}
if (window->display->compositor)
{
if (window->visible_to_compositor)
meta_compositor_hide_window (window->display->compositor, window,
META_COMP_EFFECT_DESTROY);
meta_compositor_remove_window (window->display->compositor, window);
}
if (window->display->window_with_menu == window)
{
@ -2746,13 +2742,11 @@ meta_window_show (MetaWindow *window)
}
if (!window->visible_to_compositor)
{
window->visible_to_compositor = TRUE;
if (window->display->compositor)
{
MetaCompEffect effect = META_COMP_EFFECT_NONE;
window->visible_to_compositor = TRUE;
switch (window->pending_compositor_effect)
{
case META_COMP_EFFECT_CREATE:
@ -2768,7 +2762,6 @@ meta_window_show (MetaWindow *window)
meta_compositor_show_window (window->display->compositor,
window, effect);
}
}
/* We don't want to worry about all cases from inside
* implement_showing(); we only want to worry about focus if this
@ -2839,13 +2832,11 @@ meta_window_hide (MetaWindow *window)
"Hiding window %s\n", window->desc);
if (window->visible_to_compositor)
{
window->visible_to_compositor = FALSE;
if (window->display->compositor)
{
MetaCompEffect effect = META_COMP_EFFECT_NONE;
window->visible_to_compositor = FALSE;
switch (window->pending_compositor_effect)
{
case META_COMP_EFFECT_CREATE:
@ -2860,7 +2851,6 @@ meta_window_hide (MetaWindow *window)
meta_compositor_hide_window (window->display->compositor, window, effect);
}
}
did_hide = FALSE;
@ -3125,6 +3115,8 @@ meta_window_maximize (MetaWindow *window,
{
MetaRectangle *saved_rect = NULL;
gboolean maximize_horizontally, maximize_vertically;
MetaRectangle old_rect;
MetaRectangle new_rect;
g_return_if_fail (!window->override_redirect);
@ -3174,11 +3166,6 @@ meta_window_maximize (MetaWindow *window,
directions,
saved_rect);
if (window->display->compositor)
{
MetaRectangle old_rect;
MetaRectangle new_rect;
meta_window_get_frame_rect (window, &old_rect);
meta_window_move_resize_now (window);
@ -3189,13 +3176,6 @@ meta_window_maximize (MetaWindow *window,
&old_rect,
&new_rect);
}
else
{
/* move_resize with new maximization constraints
*/
meta_window_queue(window, META_QUEUE_MOVE_RESIZE);
}
}
}
/**
@ -3354,6 +3334,8 @@ void
meta_window_tile (MetaWindow *window)
{
MetaMaximizeFlags directions;
MetaRectangle old_rect;
MetaRectangle new_rect;
/* Don't do anything if no tiling is requested */
if (window->tile_mode == META_TILE_NONE)
@ -3367,11 +3349,6 @@ meta_window_tile (MetaWindow *window)
meta_window_maximize_internal (window, directions, NULL);
meta_screen_update_tile_preview (window->screen, FALSE);
if (window->display->compositor)
{
MetaRectangle old_rect;
MetaRectangle new_rect;
meta_window_get_frame_rect (window, &old_rect);
meta_window_move_resize_now (window);
@ -3386,13 +3363,6 @@ meta_window_tile (MetaWindow *window)
meta_ui_queue_frame_draw (window->screen->ui,
window->frame->xwindow);
}
else
{
/* move_resize with new tiling constraints
*/
meta_window_queue (window, META_QUEUE_MOVE_RESIZE);
}
}
static gboolean
meta_window_can_tile_maximized (MetaWindow *window)
@ -3464,6 +3434,7 @@ meta_window_unmaximize_internal (MetaWindow *window,
int gravity)
{
gboolean unmaximize_horizontally, unmaximize_vertically;
MetaRectangle new_rect;
g_return_if_fail (!window->override_redirect);
@ -3548,10 +3519,6 @@ meta_window_unmaximize_internal (MetaWindow *window,
*/
ensure_size_hints_satisfied (&target_rect, &window->size_hints);
if (window->display->compositor)
{
MetaRectangle new_rect;
meta_window_move_resize_internal (window,
META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION,
gravity,
@ -3565,17 +3532,6 @@ meta_window_unmaximize_internal (MetaWindow *window,
window,
&old_rect,
&new_rect);
}
else
{
meta_window_move_resize_internal (window,
META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION,
gravity,
target_rect.x,
target_rect.y,
target_rect.width,
target_rect.height);
}
/* Make sure user_rect is current.
*/
@ -5014,7 +4970,6 @@ meta_window_move_resize_internal (MetaWindow *window,
newx, newy, window->rect.width, window->rect.height,
window->user_rect.x, window->user_rect.y,
window->user_rect.width, window->user_rect.height);
if (window->display->compositor)
meta_compositor_sync_window_geometry (window->display->compositor,
window,
did_placement);
@ -10117,7 +10072,6 @@ meta_window_set_opacity (MetaWindow *window,
{
window->opacity = opacity;
if (window->display->compositor)
meta_compositor_window_opacity_changed (window->display->compositor, window);
}

View File

@ -297,7 +297,6 @@ meta_window_set_opaque_region (MetaWindow *window,
if (region != NULL)
window->opaque_region = cairo_region_reference (region);
if (window->display->compositor)
meta_compositor_window_shape_changed (window->display->compositor, window);
}
@ -383,7 +382,6 @@ meta_window_set_input_region (MetaWindow *window,
if (region != NULL)
window->input_region = cairo_region_reference (region);
if (window->display->compositor)
meta_compositor_window_shape_changed (window->display->compositor, window);
}
@ -490,7 +488,6 @@ meta_window_set_shape_region (MetaWindow *window,
if (region != NULL)
window->shape_region = cairo_region_reference (region);
if (window->display->compositor)
meta_compositor_window_shape_changed (window->display->compositor, window);
}
@ -1348,7 +1345,7 @@ is_our_xwindow (MetaDisplay *display,
if (xwindow == screen->guard_window)
return TRUE;
if (display->compositor && xwindow == XCompositeGetOverlayWindow (display->xdisplay, screen->xroot))
if (xwindow == XCompositeGetOverlayWindow (display->xdisplay, screen->xroot))
return TRUE;
/* Any windows created via meta_create_offscreen_window */
@ -1687,6 +1684,5 @@ meta_window_x11_configure_notify (MetaWindow *window,
if (!event->override_redirect && !event->send_event)
meta_warning ("Unhandled change of windows override redirect status\n");
if (window->display->compositor)
meta_compositor_sync_window_geometry (window->display->compositor, window, FALSE);
}