[Xfce4-commits] [panel-plugins/xfce4-pulseaudio-plugin] 02/03: Fixed slider click/drag coordinate errors in Gtk3.14
noreply at xfce.org
noreply at xfce.org
Sun Mar 8 04:55:20 CET 2015
This is an automated email from the git hooks/post-receive script.
andrzejr pushed a commit to branch master
in repository panel-plugins/xfce4-pulseaudio-plugin.
commit 3d425611c7e5a282250c738184a6566ec2c9ffb9
Author: Andrzej <ndrwrdck at gmail.com>
Date: Sun Mar 8 03:50:45 2015 +0000
Fixed slider click/drag coordinate errors in Gtk3.14
GdkEvent coordinates should be refer to GdkWindow and indeed
in Gtk3.14 that is the case so no extra translation is needed.
However, in Gtk3.12, the coordinates refer to the slider widget,
even though it has no GdkWindow associated with it.
TBC if there is a better way of handling this, but Gtk version
checking works well.
---
panel-plugin/scalemenuitem.c | 27 ++++++++++++++++++++++-----
1 file changed, 22 insertions(+), 5 deletions(-)
diff --git a/panel-plugin/scalemenuitem.c b/panel-plugin/scalemenuitem.c
index 581bdf5..5006dde 100644
--- a/panel-plugin/scalemenuitem.c
+++ b/panel-plugin/scalemenuitem.c
@@ -252,8 +252,14 @@ scale_menu_item_button_press_event (GtkWidget *menuitem,
gtk_widget_translate_coordinates (menuitem, priv->scale, event->x, event->y, &x, &y);
if (x > 0 && x < alloc.width && y > 0 && y < alloc.height)
- gtk_widget_event (priv->scale,
- ((GdkEvent *)(void*)(event)));
+ {
+#if !(GTK_CHECK_VERSION (3, 14, 0))
+ /* event coordinates are supposed to refer to GdkWindow but for some reason in Gtk+-3.12(?) they refer to the widget */
+ event->x = (gdouble) x;
+ event->y = (gdouble) y;
+#endif
+ gtk_widget_event (priv->scale, (GdkEvent*) event);
+ }
if (!priv->grabbed)
{
@@ -269,9 +275,15 @@ scale_menu_item_button_release_event (GtkWidget *menuitem,
GdkEventButton *event)
{
ScaleMenuItemPrivate *priv = GET_PRIVATE (menuitem);
+ gint x, y;
TRACE("entering");
+#if !(GTK_CHECK_VERSION (3, 14, 0))
+ gtk_widget_translate_coordinates (menuitem, priv->scale, event->x, event->y, &x, &y);
+ event->x = (gdouble) x;
+ event->y = (gdouble) y;
+#endif
gtk_widget_event (priv->scale, (GdkEvent*)event);
if (priv->grabbed)
@@ -296,9 +308,14 @@ scale_menu_item_motion_notify_event (GtkWidget *menuitem,
gtk_widget_get_allocation (priv->scale, &alloc);
gtk_widget_translate_coordinates (menuitem, priv->scale, event->x, event->y, &x, &y);
- if (priv->grabbed ||
- (x > 0 && x < alloc.width && y > 0 && y < alloc.height))
- gtk_widget_event (scale, (GdkEvent*) event);
+ if (x > 0 && x < alloc.width && y > 0 && y < alloc.height)
+ {
+#if !(GTK_CHECK_VERSION (3, 14, 0))
+ event->x = (gdouble) x;
+ event->y = (gdouble) y;
+#endif
+ gtk_widget_event (scale, (GdkEvent*) event);
+ }
return TRUE;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list