From 731388c376c14545826c055e5094fc751bbe09de Mon Sep 17 00:00:00 2001 From: Cody Russell Date: Tue, 1 Dec 2009 12:54:00 -0600 Subject: [PATCH] Add GTK_WINDOW_REGION_SHADOW, and add support for shadow regions to get_region_type(). --- gtk/gtkwindow.c | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 791da9e243..ffb9dfc8d8 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -128,7 +128,8 @@ typedef enum GTK_WINDOW_REGION_EDGE_SE, GTK_WINDOW_REGION_INNER, GTK_WINDOW_REGION_TITLE, - GTK_WINDOW_REGION_EDGE + GTK_WINDOW_REGION_EDGE, + GTK_WINDOW_REGION_SHADOW } GtkWindowRegion; typedef struct @@ -5993,45 +5994,58 @@ get_region_type (GtkWindow *window, gint x, gint y) gint title_height = get_title_height (window); gint frame_width = 0; gint resize_handle = 0; + gint extents_left, extents_right, extents_top, extents_bottom; frame_width = get_decoration_frame_width (window); gtk_widget_style_get (widget, "decoration-resize-handle", &resize_handle, + "extents-left", &extents_left, + "extents-right", &extents_right, + "extents-top", &extents_top, + "extents-bottom", &extents_bottom, NULL); - if (x < frame_width) + if (x < extents_left || x > widget->allocation.width - extents_right || + y < extents_top || y > widget->allocation.height - extents_bottom) + return GTK_WINDOW_REGION_SHADOW; + + if (x > extents_left && x < frame_width + extents_left) { - if (y < frame_width + MAX (title_height, resize_handle)) + if (y < frame_width + extents_top + MAX (title_height, resize_handle)) return GTK_WINDOW_REGION_EDGE_NW; - else if (y > widget->allocation.height - frame_width - resize_handle) + else if (y > widget->allocation.height - frame_width - resize_handle - extents_bottom) return GTK_WINDOW_REGION_EDGE_SW; else return GTK_WINDOW_REGION_EDGE_W; } - else if (x > widget->allocation.width - frame_width) + else if (x > widget->allocation.width - extents_right - frame_width && + x < widget->allocation.width - extents_right) { - if (y < frame_width + MAX (title_height, resize_handle)) + if (y < frame_width + extents_top + MAX (title_height, resize_handle)) return GTK_WINDOW_REGION_EDGE_NE; - else if (y > widget->allocation.height - frame_width - resize_handle) + else if (y > widget->allocation.height - frame_width - resize_handle - extents_bottom) return GTK_WINDOW_REGION_EDGE_SE; else return GTK_WINDOW_REGION_EDGE_E; } - else if (y < frame_width) + else if (y > extents_top && y < frame_width + extents_top) { - if (x < frame_width + resize_handle) + if (x < frame_width + resize_handle && x > extents_left) return GTK_WINDOW_REGION_EDGE_NW; - else if (x > widget->allocation.width - frame_width - resize_handle) + else if (x > widget->allocation.width - frame_width - resize_handle && + x < widget->allocation.width - extents_right) return GTK_WINDOW_REGION_EDGE_NE; else return GTK_WINDOW_REGION_EDGE_N; } - else if (y > widget->allocation.height - frame_width) + else if (y > widget->allocation.height - extents_bottom - frame_width && + y < widget->allocation.height - extents_bottom) { - if (x < frame_width + resize_handle) + if (x < frame_width + resize_handle && x > extents_left) return GTK_WINDOW_REGION_EDGE_SW; - else if (x > widget->allocation.width - frame_width - resize_handle) + else if (x > widget->allocation.width - frame_width - resize_handle && + x < widget->allocation.width - extents_right) return GTK_WINDOW_REGION_EDGE_SE; else return GTK_WINDOW_REGION_EDGE_S;