diff options
author | infirit <[email protected]> | 2014-10-24 13:38:54 +0200 |
---|---|---|
committer | infirit <[email protected]> | 2014-10-24 15:40:43 +0200 |
commit | 470fed7e80a741e43e53f2e2186f9470db132983 (patch) | |
tree | 3c364aae98f80d74e073cda5da26e5fa444bec57 /src/compositor | |
parent | 13741f524e5f8b780a96872f534237186fa78741 (diff) | |
download | marco-470fed7e80a741e43e53f2e2186f9470db132983.tar.bz2 marco-470fed7e80a741e43e53f2e2186f9470db132983.tar.xz |
don't show shadow for maximized windows
based on metacity commit: 72d1c6a6b9a85391444bb5ff8c5de1e3aabd3fd9
From: Alberts Muktupāvels <[email protected]>
Diffstat (limited to 'src/compositor')
-rw-r--r-- | src/compositor/compositor-private.h | 5 | ||||
-rw-r--r-- | src/compositor/compositor-xrender.c | 43 | ||||
-rw-r--r-- | src/compositor/compositor.c | 20 |
3 files changed, 67 insertions, 1 deletions
diff --git a/src/compositor/compositor-private.h b/src/compositor/compositor-private.h index 6e34fe05..93f3e05b 100644 --- a/src/compositor/compositor-private.h +++ b/src/compositor/compositor-private.h @@ -49,6 +49,11 @@ struct _MetaCompositor void (*set_active_window) (MetaCompositor *compositor, MetaScreen *screen, MetaWindow *window); + + void (*maximize_window) (MetaCompositor *compositor, + MetaWindow *window); + void (*unmaximize_window) (MetaCompositor *compositor, + MetaWindow *window); }; #endif diff --git a/src/compositor/compositor-xrender.c b/src/compositor/compositor-xrender.c index 9bf9d8d1..68898257 100644 --- a/src/compositor/compositor-xrender.c +++ b/src/compositor/compositor-xrender.c @@ -905,6 +905,13 @@ window_has_shadow (MetaCompWindow *cw) as the frame might be the reason the window is shaped */ if (cw->window) { + /* Do not add shadows for maximized windows */ + if (meta_window_is_maximized (cw->window)) + { + meta_verbose ("Window has no shadow because it is maximized\n"); + return FALSE; + } + if (meta_window_get_frame (cw->window)) { meta_verbose ("Window has shadow because it has a frame\n"); return TRUE; @@ -3011,6 +3018,38 @@ xrender_set_active_window (MetaCompositor *compositor, #endif } +static void +xrender_maximize_window (MetaCompositor *compositor, + MetaWindow *window) +{ +#ifdef HAVE_COMPOSITE_EXTENSIONS + MetaFrame *frame = meta_window_get_frame (window); + Window xid = frame ? meta_frame_get_xwindow (frame) : meta_window_get_xwindow (window); + MetaCompWindow *cw = find_window_in_display (meta_window_get_display (window), xid); + + if (!cw) + return; + + cw->needs_shadow = window_has_shadow (cw); +#endif +} + +static void +xrender_unmaximize_window (MetaCompositor *compositor, + MetaWindow *window) +{ +#ifdef HAVE_COMPOSITE_EXTENSIONS + MetaFrame *frame = meta_window_get_frame (window); + Window xid = frame ? meta_frame_get_xwindow (frame) : meta_window_get_xwindow (window); + MetaCompWindow *cw = find_window_in_display (meta_window_get_display (window), xid); + + if (!cw) + return; + + cw->needs_shadow = window_has_shadow (cw); +#endif +} + static MetaCompositor comp_info = { xrender_destroy, xrender_manage_screen, @@ -3020,7 +3059,9 @@ static MetaCompositor comp_info = { xrender_set_updates, xrender_process_event, xrender_get_window_pixmap, - xrender_set_active_window + xrender_set_active_window, + xrender_maximize_window, + xrender_unmaximize_window, }; MetaCompositor * diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c index ab6427e7..d23fe3f7 100644 --- a/src/compositor/compositor.c +++ b/src/compositor/compositor.c @@ -157,3 +157,23 @@ void meta_compositor_free_window (MetaCompositor *compositor, MetaWindow *window) { } + +void +meta_compositor_maximize_window (MetaCompositor *compositor, + MetaWindow *window) +{ +#ifdef HAVE_COMPOSITE_EXTENSIONS + if (compositor && compositor->maximize_window) + compositor->maximize_window (compositor, window); +#endif +} + +void +meta_compositor_unmaximize_window (MetaCompositor *compositor, + MetaWindow *window) +{ +#ifdef HAVE_COMPOSITE_EXTENSIONS + if (compositor && compositor->unmaximize_window) + compositor->unmaximize_window (compositor, window); +#endif +} |