mirror of
https://github.com/brl/mutter.git
synced 2025-06-13 16:59:30 +00:00
Only shadow ARGB windows with a frame outside the frame
An ARGB window with a frame is likely something like a transparent terminal. It looks awful (and breaks transparency) to draw a big opaque black shadow under the window, so clip out the region under the terminal from the shadow we draw. Add meta_window_get_frame_bounds() to get a cairo region for the outer bounds of the frame of a window, and modify the frame handling code to notice changes to the frame shape and discard a cached region. meta_frames_apply_shapes() is refactored so we can extract meta_frames_get_frame_bounds() from it. https://bugzilla.gnome.org/show_bug.cgi?id=635268
This commit is contained in:
@ -328,7 +328,7 @@ meta_frame_calc_geometry (MetaFrame *frame,
|
||||
*geomp = geom;
|
||||
}
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
update_shape (MetaFrame *frame)
|
||||
{
|
||||
if (frame->need_reapply_frame_shape)
|
||||
@ -339,10 +339,14 @@ update_shape (MetaFrame *frame)
|
||||
frame->rect.height,
|
||||
frame->window->has_shape);
|
||||
frame->need_reapply_frame_shape = FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
gboolean
|
||||
meta_frame_sync_to_window (MetaFrame *frame,
|
||||
int resize_gravity,
|
||||
gboolean need_move,
|
||||
@ -350,8 +354,7 @@ meta_frame_sync_to_window (MetaFrame *frame,
|
||||
{
|
||||
if (!(need_move || need_resize))
|
||||
{
|
||||
update_shape (frame);
|
||||
return;
|
||||
return update_shape (frame);
|
||||
}
|
||||
|
||||
meta_topic (META_DEBUG_GEOMETRY,
|
||||
@ -401,6 +404,17 @@ meta_frame_sync_to_window (MetaFrame *frame,
|
||||
meta_ui_repaint_frame (frame->window->screen->ui,
|
||||
frame->xwindow);
|
||||
}
|
||||
|
||||
return need_resize;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -73,11 +73,13 @@ Window meta_frame_get_xwindow (MetaFrame *frame);
|
||||
/* These should ONLY be called from meta_window_move_resize_internal */
|
||||
void meta_frame_calc_geometry (MetaFrame *frame,
|
||||
MetaFrameGeometry *geomp);
|
||||
void meta_frame_sync_to_window (MetaFrame *frame,
|
||||
gboolean meta_frame_sync_to_window (MetaFrame *frame,
|
||||
int gravity,
|
||||
gboolean need_move,
|
||||
gboolean need_resize);
|
||||
|
||||
cairo_region_t *meta_frame_get_frame_bounds (MetaFrame *frame);
|
||||
|
||||
void meta_frame_set_screen_cursor (MetaFrame *frame,
|
||||
MetaCursor cursor);
|
||||
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "stack.h"
|
||||
#include "iconcache.h"
|
||||
#include <X11/Xutil.h>
|
||||
#include <cairo.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
||||
typedef struct _MetaWindowQueue MetaWindowQueue;
|
||||
@ -316,6 +317,9 @@ struct _MetaWindow
|
||||
/* if TRUE, application is buggy and SYNC resizing is turned off */
|
||||
guint disable_sync : 1;
|
||||
|
||||
/* if non-NULL, the bounds of the window frame */
|
||||
cairo_region_t *frame_bounds;
|
||||
|
||||
/* Note: can be NULL */
|
||||
GSList *struts;
|
||||
|
||||
|
@ -181,6 +181,9 @@ meta_window_finalize (GObject *object)
|
||||
if (window->mini_icon)
|
||||
g_object_unref (G_OBJECT (window->mini_icon));
|
||||
|
||||
if (window->frame_bounds)
|
||||
cairo_region_destroy (window->frame_bounds);
|
||||
|
||||
meta_icon_cache_free (&window->icon_cache);
|
||||
|
||||
g_free (window->sm_client_id);
|
||||
@ -4295,6 +4298,7 @@ meta_window_move_resize_internal (MetaWindow *window,
|
||||
int frame_size_dy;
|
||||
int size_dx;
|
||||
int size_dy;
|
||||
gboolean frame_shape_changed = FALSE;
|
||||
gboolean is_configure_request;
|
||||
gboolean do_gravity_adjust;
|
||||
gboolean is_user_action;
|
||||
@ -4598,9 +4602,9 @@ meta_window_move_resize_internal (MetaWindow *window,
|
||||
meta_window_set_gravity (window, StaticGravity);
|
||||
|
||||
if (configure_frame_first && window->frame)
|
||||
meta_frame_sync_to_window (window->frame,
|
||||
gravity,
|
||||
need_move_frame, need_resize_frame);
|
||||
frame_shape_changed = meta_frame_sync_to_window (window->frame,
|
||||
gravity,
|
||||
need_move_frame, need_resize_frame);
|
||||
|
||||
values.border_width = 0;
|
||||
values.x = client_move_x;
|
||||
@ -4655,9 +4659,9 @@ meta_window_move_resize_internal (MetaWindow *window,
|
||||
}
|
||||
|
||||
if (!configure_frame_first && window->frame)
|
||||
meta_frame_sync_to_window (window->frame,
|
||||
gravity,
|
||||
need_move_frame, need_resize_frame);
|
||||
frame_shape_changed = meta_frame_sync_to_window (window->frame,
|
||||
gravity,
|
||||
need_move_frame, need_resize_frame);
|
||||
|
||||
/* Put gravity back to be nice to lesser window managers */
|
||||
if (use_static_gravity)
|
||||
@ -4700,6 +4704,12 @@ meta_window_move_resize_internal (MetaWindow *window,
|
||||
* b) all constraints are obeyed by window->rect and frame->rect
|
||||
*/
|
||||
|
||||
if (frame_shape_changed && window->frame_bounds)
|
||||
{
|
||||
cairo_region_destroy (window->frame_bounds);
|
||||
window->frame_bounds = NULL;
|
||||
}
|
||||
|
||||
if (meta_prefs_get_attach_modal_dialogs ())
|
||||
meta_window_foreach_transient (window, move_attached_dialog, NULL);
|
||||
}
|
||||
@ -10204,3 +10214,24 @@ meta_window_get_frame_type (MetaWindow *window)
|
||||
return base_type;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_window_get_frame_bounds:
|
||||
*
|
||||
* Gets a region representing the outer bounds of the window's frame.
|
||||
*
|
||||
* Return value: (transfer none) (allow-none): a #cairo_region_t
|
||||
* holding the outer bounds of the window, or %NULL if the window
|
||||
* doesn't have a frame.
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user