From b3a66c59ade144c094d4dbc568e33a5ef85c1a7d Mon Sep 17 00:00:00 2001 From: Diego Escalante Urrelo Date: Wed, 28 Mar 2012 03:38:10 -0500 Subject: [PATCH] WIP: make GtkNotebook window-draggable https://bugzilla.gnome.org/show_bug.cgi?id=672427 https://bugzilla.gnome.org/show_bug.cgi?id=674587 --- gtk/gtknotebook.c | 26 ++++++++++++++++++++++++++ tests/testgtk.css | 4 ++++ 2 files changed, 30 insertions(+) diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index 5978e3dac6..5deaed6099 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -2949,6 +2949,32 @@ gtk_notebook_button_press (GtkWidget *widget, priv->drag_offset_y = priv->drag_begin_y - page->allocation.y; } } + else + { + GtkWidget *window; + window = gtk_widget_get_toplevel (widget); + + if (window) + { + gboolean window_drag = FALSE; + gtk_widget_style_get (widget, + "window-dragging", &window_drag, + NULL); + + if (window_drag) + { + priv->during_detach = FALSE; + priv->during_reorder = FALSE; + priv->pressed_button = event->button; + + gtk_window_begin_move_drag (GTK_WINDOW (window), + event->button, + event->x_root, + event->y_root, + event->time); + } + } + } return TRUE; } diff --git a/tests/testgtk.css b/tests/testgtk.css index f5e8694f12..5a6c6c1699 100644 --- a/tests/testgtk.css +++ b/tests/testgtk.css @@ -24,6 +24,10 @@ -Gtest-bar: 47; } +GtkNotebook { + -GtkWidget-window-dragging: true; +} + GtkLabel:selected { background-color: gray; }