Support window dragging from menubars
This commit is contained in:
parent
dbf1fcdcd7
commit
87bb846130
@ -19,7 +19,7 @@
|
||||
Summary: The GIMP ToolKit (GTK+), a library for creating GUIs for X
|
||||
Name: gtk2
|
||||
Version: %{base_version}
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
License: LGPLv2+
|
||||
Group: System Environment/Libraries
|
||||
#VCS: git:git://git.gnome.org/gtk+
|
||||
@ -41,6 +41,8 @@ Patch8: tooltip-positioning.patch
|
||||
Patch11: gtk2-remove-connecting-reason.patch
|
||||
# https://bugzilla.gnome.org/show_bug.cgi?id=592582
|
||||
#Patch14: gtk2-landscape-pdf-print.patch
|
||||
# https://bugzilla.gnome.org/show_bug.cgi?id=611313
|
||||
Patch15: window-dragging.patch
|
||||
|
||||
BuildRequires: atk-devel >= %{atk_version}
|
||||
BuildRequires: pango-devel >= %{pango_version}
|
||||
@ -373,6 +375,9 @@ fi
|
||||
%doc tmpdocs/examples
|
||||
|
||||
%changelog
|
||||
* Fri Mar 12 2010 Matthias Clasen <mclasen@redhat.com> - 2.19.7-2
|
||||
- Support dragging windows from menubars
|
||||
|
||||
* Wed Mar 10 2010 Matthias Clasen <mclasen@redhat.com> - 2.19.7-1
|
||||
- Update to 2.19.7
|
||||
- Add a VCS tag
|
||||
|
124
window-dragging.patch
Normal file
124
window-dragging.patch
Normal file
@ -0,0 +1,124 @@
|
||||
diff --git a/gtk/gtkmenushell.c b/gtk/gtkmenushell.c
|
||||
index 4788590..cb94c64 100644
|
||||
--- a/gtk/gtkmenushell.c
|
||||
+++ b/gtk/gtkmenushell.c
|
||||
@@ -585,18 +585,45 @@ gtk_menu_shell_button_press (GtkWidget *widget,
|
||||
|
||||
if (!menu_shell->active || !menu_shell->button)
|
||||
{
|
||||
- _gtk_menu_shell_activate (menu_shell);
|
||||
+ gboolean initially_active = menu_shell->active;
|
||||
|
||||
menu_shell->button = event->button;
|
||||
|
||||
- if (menu_item && _gtk_menu_item_is_selectable (menu_item) &&
|
||||
- menu_item->parent == widget &&
|
||||
- menu_item != menu_shell->active_menu_item)
|
||||
+ if (menu_item)
|
||||
{
|
||||
- if (GTK_MENU_SHELL_GET_CLASS (menu_shell)->submenu_placement == GTK_TOP_BOTTOM)
|
||||
+ if (_gtk_menu_item_is_selectable (menu_item) &&
|
||||
+ menu_item->parent == widget &&
|
||||
+ menu_item != menu_shell->active_menu_item)
|
||||
{
|
||||
- menu_shell->activate_time = event->time;
|
||||
- gtk_menu_shell_select_item (menu_shell, menu_item);
|
||||
+ _gtk_menu_shell_activate (menu_shell);
|
||||
+ menu_shell->button = event->button;
|
||||
+
|
||||
+ if (GTK_MENU_SHELL_GET_CLASS (menu_shell)->submenu_placement == GTK_TOP_BOTTOM)
|
||||
+ {
|
||||
+ menu_shell->activate_time = event->time;
|
||||
+ gtk_menu_shell_select_item (menu_shell, menu_item);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ if (!initially_active)
|
||||
+ {
|
||||
+ gboolean window_drag = FALSE;
|
||||
+
|
||||
+ gtk_widget_style_get (widget,
|
||||
+ "window-dragging", &window_drag,
|
||||
+ NULL);
|
||||
+
|
||||
+ if (window_drag)
|
||||
+ {
|
||||
+ gtk_menu_shell_deactivate (menu_shell);
|
||||
+ gtk_window_begin_move_drag (GTK_WINDOW (gtk_widget_get_toplevel (widget)),
|
||||
+ event->button,
|
||||
+ event->x_root,
|
||||
+ event->y_root,
|
||||
+ event->time);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c
|
||||
index 8f065a7..c72a09f 100644
|
||||
--- a/gtk/gtktoolbar.c
|
||||
+++ b/gtk/gtktoolbar.c
|
||||
@@ -2699,17 +2699,41 @@ static gboolean
|
||||
gtk_toolbar_button_press (GtkWidget *toolbar,
|
||||
GdkEventButton *event)
|
||||
{
|
||||
+ GtkWidget *window;
|
||||
+
|
||||
if (event->button == 3)
|
||||
{
|
||||
gboolean return_value;
|
||||
-
|
||||
+
|
||||
g_signal_emit (toolbar, toolbar_signals[POPUP_CONTEXT_MENU], 0,
|
||||
(int)event->x_root, (int)event->y_root, event->button,
|
||||
&return_value);
|
||||
-
|
||||
+
|
||||
return return_value;
|
||||
}
|
||||
-
|
||||
+
|
||||
+ window = gtk_widget_get_toplevel (toolbar);
|
||||
+
|
||||
+ if (window)
|
||||
+ {
|
||||
+ gboolean window_drag = FALSE;
|
||||
+
|
||||
+ gtk_widget_style_get (toolbar,
|
||||
+ "window-dragging", &window_drag,
|
||||
+ NULL);
|
||||
+
|
||||
+ if (window_drag)
|
||||
+ {
|
||||
+ gtk_window_begin_move_drag (GTK_WINDOW (window),
|
||||
+ event->button,
|
||||
+ event->x_root,
|
||||
+ event->y_root,
|
||||
+ event->time);
|
||||
+
|
||||
+ return TRUE;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
|
||||
index 58ce2db..921c22a 100644
|
||||
--- a/gtk/gtkwidget.c
|
||||
+++ b/gtk/gtkwidget.c
|
||||
@@ -2443,6 +2443,13 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
||||
0.0, 1.0, 0.04,
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
+ gtk_widget_class_install_style_property (klass,
|
||||
+ g_param_spec_boolean ("window-dragging",
|
||||
+ P_("Window dragging"),
|
||||
+ P_("Window dragging"),
|
||||
+ FALSE,
|
||||
+ GTK_PARAM_READWRITE));
|
||||
+
|
||||
/**
|
||||
* GtkWidget:draw-border:
|
||||
*
|
Loading…
Reference in New Issue
Block a user