forked from AuroraMiddleware/gtk
Merge branch 'matthiasc/for-master' into 'master'
colorscale: Bring back the right-click on slider See merge request GNOME/gtk!1933
This commit is contained in:
commit
383fa6b0b0
@ -21,6 +21,7 @@
|
||||
|
||||
#include "gtkcolorchooserprivate.h"
|
||||
#include "gtkgesturelongpress.h"
|
||||
#include "gtkgestureclick.h"
|
||||
#include "gtkcolorutils.h"
|
||||
#include "gtkorientable.h"
|
||||
#include "gtkrangeprivate.h"
|
||||
@ -53,6 +54,12 @@ static void hold_action (GtkGestureLongPress *gesture,
|
||||
gdouble y,
|
||||
GtkWidget *scale);
|
||||
|
||||
static void click_action (GtkGestureClick *gesture,
|
||||
guint n_presses,
|
||||
double x,
|
||||
double y,
|
||||
GtkWidget *scale);
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkColorScale, gtk_color_scale, GTK_TYPE_SCALE)
|
||||
|
||||
void
|
||||
@ -160,6 +167,12 @@ gtk_color_scale_init (GtkColorScale *scale)
|
||||
GTK_PHASE_TARGET);
|
||||
gtk_widget_add_controller (GTK_WIDGET (scale), GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
gesture = gtk_gesture_click_new ();
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
|
||||
g_signal_connect (gesture, "pressed",
|
||||
G_CALLBACK (click_action), scale);
|
||||
gtk_widget_add_controller (GTK_WIDGET (scale), GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
gtk_widget_add_css_class (GTK_WIDGET (scale), "color");
|
||||
}
|
||||
|
||||
@ -256,6 +269,18 @@ hold_action (GtkGestureLongPress *gesture,
|
||||
"s", gtk_widget_get_name (scale));
|
||||
}
|
||||
|
||||
static void
|
||||
click_action (GtkGestureClick *gesture,
|
||||
guint n_presses,
|
||||
double x,
|
||||
double y,
|
||||
GtkWidget *scale)
|
||||
{
|
||||
gtk_widget_activate_action (scale,
|
||||
"color.edit",
|
||||
"s", gtk_widget_get_name (scale));
|
||||
}
|
||||
|
||||
static void
|
||||
scale_finalize (GObject *object)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user