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 | |
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')
-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 | ||||
-rw-r--r-- | src/core/window.c | 10 | ||||
-rw-r--r-- | src/include/compositor.h | 10 | ||||
-rw-r--r-- | src/include/window.h | 1 |
6 files changed, 82 insertions, 7 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 +} diff --git a/src/core/window.c b/src/core/window.c index e7e0fb9e..1ff745a9 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -2680,6 +2680,8 @@ meta_window_maximize (MetaWindow *window, /* move_resize with new maximization constraints */ meta_window_queue(window, META_QUEUE_MOVE_RESIZE); + + meta_compositor_maximize_window (window->display->compositor, window); } } @@ -2848,6 +2850,8 @@ meta_window_unmaximize (MetaWindow *window, recalc_window_features (window); set_net_wm_state (window); + + meta_compositor_unmaximize_window (window->display->compositor, window); } } @@ -8368,6 +8372,12 @@ meta_window_get_xwindow (MetaWindow *window) return window->xwindow; } +gboolean +meta_window_is_maximized (MetaWindow *window) +{ + return META_WINDOW_MAXIMIZED (window); +} + /** * meta_window_is_client_decorated: * diff --git a/src/include/compositor.h b/src/include/compositor.h index df59e204..5c238890 100644 --- a/src/include/compositor.h +++ b/src/include/compositor.h @@ -67,10 +67,8 @@ void meta_compositor_end_move (MetaCompositor *compositor, MetaWindow *window); void meta_compositor_free_window (MetaCompositor *compositor, MetaWindow *window); - +void meta_compositor_maximize_window (MetaCompositor *compositor, + MetaWindow *window); +void meta_compositor_unmaximize_window (MetaCompositor *compositor, + MetaWindow *window); #endif - - - - - diff --git a/src/include/window.h b/src/include/window.h index 32c7ebc9..d83ad45f 100644 --- a/src/include/window.h +++ b/src/include/window.h @@ -35,5 +35,6 @@ MetaRectangle *meta_window_get_rect (MetaWindow *window); MetaScreen *meta_window_get_screen (MetaWindow *window); MetaDisplay *meta_window_get_display (MetaWindow *window); Window meta_window_get_xwindow (MetaWindow *window); +gboolean meta_window_is_maximized (MetaWindow *window); #endif |