[gtk+/client-side-decorations: 26/50] differentiate between N edge and title in button_press_event
- From: Cody Russell <bratsche src gnome org>
- To: svn-commits-list gnome org
- Subject: [gtk+/client-side-decorations: 26/50] differentiate between N edge and title in button_press_event
- Date: Wed, 8 Jul 2009 15:30:20 +0000 (UTC)
commit 110e1c846ec8b9dba87061ad294f5d0b265c8aab
Author: Cody Russell <crussell canonical com>
Date: Sun May 24 16:51:02 2009 +0200
differentiate between N edge and title in button_press_event
gtk/gtkwindow.c | 24 +++++++++++++++++++++---
1 files changed, 21 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 8f2c15a..2534e11 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -5393,14 +5393,26 @@ gtk_window_propagate_key_event (GtkWindow *window,
return handled;
}
+static gint
+get_title_height (GtkWindow *window)
+{
+ GtkWindowPrivate *priv = GTK_WINDOW_GET_PRIVATE (window);
+
+ if (!priv->client_side_decorated || !priv->title_hbox)
+ return 0;
+
+ return priv->title_hbox->allocation.height;
+}
+
static GtkWindowRegion
get_region_type (GtkWindow *window, gint x, gint y)
{
GtkWidget *widget = GTK_WIDGET (window);
+ gint title_height = get_title_height (window);
if (x < window->frame_left)
{
- if (y < window->frame_top)
+ if (y < window->frame_top + title_height)
return GTK_WINDOW_REGION_EDGE_NW;
else if (y > widget->allocation.height - window->frame_bottom)
return GTK_WINDOW_REGION_EDGE_SW;
@@ -5410,7 +5422,13 @@ get_region_type (GtkWindow *window, gint x, gint y)
else if (x < widget->allocation.width - window->frame_right)
{
if (y < window->frame_top)
- return GTK_WINDOW_REGION_EDGE_N;
+ {
+ return GTK_WINDOW_REGION_EDGE_N;
+ }
+ else if (y < window->frame_top + title_height)
+ {
+ return GTK_WINDOW_REGION_TITLE;
+ }
else if (y > widget->allocation.height - window->frame_bottom)
return GTK_WINDOW_REGION_EDGE_S;
else
@@ -5480,7 +5498,7 @@ gtk_window_button_press_event (GtkWidget *widget,
GtkWindowRegion region = get_region_type (GTK_WINDOW (widget), x, y);
GdkWindowEdge edge = (GdkWindowEdge)region;
- if (region == GTK_WINDOW_REGION_EDGE_N ||
+ if (region == GTK_WINDOW_REGION_TITLE ||
region == GTK_WINDOW_REGION_INNER)
{
gtk_window_begin_move_drag (GTK_WINDOW (widget),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]