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:
parent
4fdbb466e1
commit
8b2b65246a
@ -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);
|
||||
}
|
||||
meta_compositor_flash_screen (display->compositor, 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);
|
||||
meta_compositor_flash_screen (display->compositor, screen);
|
||||
screen_list = screen_list->next;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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_compositor_unmanage_screen (screen->display->compositor,
|
||||
screen);
|
||||
|
||||
meta_display_unmanage_windows_for_screen (display, screen, timestamp);
|
||||
|
||||
@ -2523,10 +2520,9 @@ 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);
|
||||
meta_compositor_sync_screen_size (screen->display->compositor,
|
||||
screen,
|
||||
screen->rect.width, screen->rect.height);
|
||||
|
||||
/* Queue a resize on all the windows */
|
||||
meta_screen_foreach_window (screen, meta_screen_resize_func, 0);
|
||||
|
@ -1245,10 +1245,9 @@ 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);
|
||||
meta_compositor_sync_stack (tracker->screen->display->compositor,
|
||||
tracker->screen,
|
||||
meta_windows);
|
||||
g_list_free (meta_windows);
|
||||
|
||||
meta_screen_restacked (tracker->screen);
|
||||
|
@ -1221,8 +1221,7 @@ _meta_window_shared_new (MetaDisplay *display,
|
||||
set_net_wm_state (window);
|
||||
}
|
||||
|
||||
if (screen->display->compositor)
|
||||
meta_compositor_add_window (screen->display->compositor, window);
|
||||
meta_compositor_add_window (screen->display->compositor, window);
|
||||
|
||||
/* Sync stack changes */
|
||||
meta_stack_thaw (window->screen->stack);
|
||||
@ -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);
|
||||
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);
|
||||
}
|
||||
meta_compositor_remove_window (window->display->compositor, window);
|
||||
|
||||
if (window->display->window_with_menu == window)
|
||||
{
|
||||
@ -2747,27 +2743,24 @@ meta_window_show (MetaWindow *window)
|
||||
|
||||
if (!window->visible_to_compositor)
|
||||
{
|
||||
MetaCompEffect effect = META_COMP_EFFECT_NONE;
|
||||
|
||||
window->visible_to_compositor = TRUE;
|
||||
|
||||
if (window->display->compositor)
|
||||
switch (window->pending_compositor_effect)
|
||||
{
|
||||
MetaCompEffect effect = META_COMP_EFFECT_NONE;
|
||||
|
||||
switch (window->pending_compositor_effect)
|
||||
{
|
||||
case META_COMP_EFFECT_CREATE:
|
||||
case META_COMP_EFFECT_UNMINIMIZE:
|
||||
effect = window->pending_compositor_effect;
|
||||
break;
|
||||
case META_COMP_EFFECT_NONE:
|
||||
case META_COMP_EFFECT_DESTROY:
|
||||
case META_COMP_EFFECT_MINIMIZE:
|
||||
break;
|
||||
}
|
||||
|
||||
meta_compositor_show_window (window->display->compositor,
|
||||
window, effect);
|
||||
case META_COMP_EFFECT_CREATE:
|
||||
case META_COMP_EFFECT_UNMINIMIZE:
|
||||
effect = window->pending_compositor_effect;
|
||||
break;
|
||||
case META_COMP_EFFECT_NONE:
|
||||
case META_COMP_EFFECT_DESTROY:
|
||||
case META_COMP_EFFECT_MINIMIZE:
|
||||
break;
|
||||
}
|
||||
|
||||
meta_compositor_show_window (window->display->compositor,
|
||||
window, effect);
|
||||
}
|
||||
|
||||
/* We don't want to worry about all cases from inside
|
||||
@ -2840,26 +2833,23 @@ meta_window_hide (MetaWindow *window)
|
||||
|
||||
if (window->visible_to_compositor)
|
||||
{
|
||||
MetaCompEffect effect = META_COMP_EFFECT_NONE;
|
||||
|
||||
window->visible_to_compositor = FALSE;
|
||||
|
||||
if (window->display->compositor)
|
||||
switch (window->pending_compositor_effect)
|
||||
{
|
||||
MetaCompEffect effect = META_COMP_EFFECT_NONE;
|
||||
|
||||
switch (window->pending_compositor_effect)
|
||||
{
|
||||
case META_COMP_EFFECT_CREATE:
|
||||
case META_COMP_EFFECT_UNMINIMIZE:
|
||||
case META_COMP_EFFECT_NONE:
|
||||
break;
|
||||
case META_COMP_EFFECT_DESTROY:
|
||||
case META_COMP_EFFECT_MINIMIZE:
|
||||
effect = window->pending_compositor_effect;
|
||||
break;
|
||||
}
|
||||
|
||||
meta_compositor_hide_window (window->display->compositor, window, effect);
|
||||
case META_COMP_EFFECT_CREATE:
|
||||
case META_COMP_EFFECT_UNMINIMIZE:
|
||||
case META_COMP_EFFECT_NONE:
|
||||
break;
|
||||
case META_COMP_EFFECT_DESTROY:
|
||||
case META_COMP_EFFECT_MINIMIZE:
|
||||
effect = window->pending_compositor_effect;
|
||||
break;
|
||||
}
|
||||
|
||||
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,27 +3166,15 @@ 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_get_frame_rect (window, &old_rect);
|
||||
meta_window_move_resize_now (window);
|
||||
|
||||
meta_window_move_resize_now (window);
|
||||
|
||||
meta_window_get_frame_rect (window, &new_rect);
|
||||
meta_compositor_maximize_window (window->display->compositor,
|
||||
window,
|
||||
&old_rect,
|
||||
&new_rect);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* move_resize with new maximization constraints
|
||||
*/
|
||||
meta_window_queue(window, META_QUEUE_MOVE_RESIZE);
|
||||
}
|
||||
meta_window_get_frame_rect (window, &new_rect);
|
||||
meta_compositor_maximize_window (window->display->compositor,
|
||||
window,
|
||||
&old_rect,
|
||||
&new_rect);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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,31 +3349,19 @@ 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_get_frame_rect (window, &old_rect);
|
||||
meta_window_move_resize_now (window);
|
||||
|
||||
meta_window_move_resize_now (window);
|
||||
meta_window_get_frame_rect (window, &new_rect);
|
||||
meta_compositor_maximize_window (window->display->compositor,
|
||||
window,
|
||||
&old_rect,
|
||||
&new_rect);
|
||||
|
||||
meta_window_get_frame_rect (window, &new_rect);
|
||||
meta_compositor_maximize_window (window->display->compositor,
|
||||
window,
|
||||
&old_rect,
|
||||
&new_rect);
|
||||
|
||||
if (window->frame)
|
||||
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);
|
||||
}
|
||||
if (window->frame)
|
||||
meta_ui_queue_frame_draw (window->screen->ui,
|
||||
window->frame->xwindow);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -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,34 +3519,19 @@ 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,
|
||||
target_rect.x,
|
||||
target_rect.y,
|
||||
target_rect.width,
|
||||
target_rect.height);
|
||||
|
||||
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);
|
||||
|
||||
meta_window_get_frame_rect (window, &new_rect);
|
||||
meta_compositor_unmaximize_window (window->display->compositor,
|
||||
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);
|
||||
}
|
||||
meta_window_get_frame_rect (window, &new_rect);
|
||||
meta_compositor_unmaximize_window (window->display->compositor,
|
||||
window,
|
||||
&old_rect,
|
||||
&new_rect);
|
||||
|
||||
/* Make sure user_rect is current.
|
||||
*/
|
||||
@ -5014,10 +4970,9 @@ 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);
|
||||
meta_compositor_sync_window_geometry (window->display->compositor,
|
||||
window,
|
||||
did_placement);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -10117,8 +10072,7 @@ meta_window_set_opacity (MetaWindow *window,
|
||||
{
|
||||
window->opacity = opacity;
|
||||
|
||||
if (window->display->compositor)
|
||||
meta_compositor_window_opacity_changed (window->display->compositor, window);
|
||||
meta_compositor_window_opacity_changed (window->display->compositor, window);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -297,8 +297,7 @@ 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);
|
||||
meta_compositor_window_shape_changed (window->display->compositor, window);
|
||||
}
|
||||
|
||||
void
|
||||
@ -383,8 +382,7 @@ 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);
|
||||
meta_compositor_window_shape_changed (window->display->compositor, window);
|
||||
}
|
||||
|
||||
#if 0
|
||||
@ -490,8 +488,7 @@ 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);
|
||||
meta_compositor_window_shape_changed (window->display->compositor, window);
|
||||
}
|
||||
|
||||
void
|
||||
@ -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);
|
||||
meta_compositor_sync_window_geometry (window->display->compositor, window, FALSE);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user