Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
GNOME
gtk
Commits
8c139c1f
Commit
8c139c1f
authored
Apr 08, 2014
by
Carlos Garnacho
Browse files
colorplane: Replace GtkPressAndHold with GtkLongPressGesture
parent
e3d25b3c
Changes
1
Hide whitespace changes
Inline
Side-by-side
gtk/gtkcolorplane.c
View file @
8c139c1f
...
...
@@ -19,10 +19,10 @@
#include "gtkcolorplaneprivate.h"
#include "gtkgesturelongpress.h"
#include "gtkaccessible.h"
#include "gtkadjustment.h"
#include "gtkcolorutils.h"
#include "gtkpressandholdprivate.h"
#include "gtkintl.h"
struct
_GtkColorPlanePrivate
...
...
@@ -34,7 +34,7 @@ struct _GtkColorPlanePrivate
cairo_surface_t
*
surface
;
gboolean
in_drag
;
Gtk
PressAndHold
*
press_and_hold
;
Gtk
Gesture
*
long_press_gesture
;
};
enum
{
...
...
@@ -296,10 +296,10 @@ plane_motion_notify (GtkWidget *widget,
}
static
void
hold_action
(
Gtk
PressAndHold
*
pah
,
g
int
x
,
g
int
y
,
GtkColorPlane
*
plane
)
hold_action
(
Gtk
GestureLongPress
*
gesture
,
g
double
x
,
g
double
y
,
GtkColorPlane
*
plane
)
{
gboolean
handled
;
...
...
@@ -312,26 +312,6 @@ plane_touch (GtkWidget *widget,
{
GtkColorPlane
*
plane
=
GTK_COLOR_PLANE
(
widget
);
if
(
!
plane
->
priv
->
press_and_hold
)
{
gint
drag_threshold
;
g_object_get
(
gtk_widget_get_settings
(
widget
),
"gtk-dnd-drag-threshold"
,
&
drag_threshold
,
NULL
);
plane
->
priv
->
press_and_hold
=
gtk_press_and_hold_new
();
g_object_set
(
plane
->
priv
->
press_and_hold
,
"drag-threshold"
,
drag_threshold
,
"hold-time"
,
1000
,
NULL
);
g_signal_connect
(
plane
->
priv
->
press_and_hold
,
"hold"
,
G_CALLBACK
(
hold_action
),
plane
);
}
gtk_press_and_hold_process_event
(
plane
->
priv
->
press_and_hold
,
(
GdkEvent
*
)
event
);
update_color
(
plane
,
event
->
x
,
event
->
y
);
return
TRUE
;
...
...
@@ -443,6 +423,10 @@ gtk_color_plane_init (GtkColorPlane *plane)
atk_object_set_name
(
atk_obj
,
_
(
"Color Plane"
));
atk_object_set_role
(
atk_obj
,
ATK_ROLE_COLOR_CHOOSER
);
}
plane
->
priv
->
long_press_gesture
=
gtk_gesture_long_press_new
(
GTK_WIDGET
(
plane
));
g_signal_connect
(
plane
->
priv
->
long_press_gesture
,
"pressed"
,
G_CALLBACK
(
hold_action
),
plane
);
}
static
void
...
...
@@ -457,7 +441,9 @@ plane_finalize (GObject *object)
g_clear_object
(
&
plane
->
priv
->
s_adj
);
g_clear_object
(
&
plane
->
priv
->
v_adj
);
g_clear_object
(
&
plane
->
priv
->
press_and_hold
);
gtk_widget_remove_controller
(
GTK_WIDGET
(
object
),
GTK_EVENT_CONTROLLER
(
plane
->
priv
->
long_press_gesture
));
g_clear_object
(
&
plane
->
priv
->
long_press_gesture
);
G_OBJECT_CLASS
(
gtk_color_plane_parent_class
)
->
finalize
(
object
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment