forked from AuroraMiddleware/gtk
adjusted stylus-only code to fit gtk code conventions
This commit is contained in:
parent
789778105d
commit
c85fbcea55
@ -53,39 +53,41 @@ enum {
|
||||
N_SIGNALS
|
||||
};
|
||||
|
||||
static GParamSpec* obj_properties[N_PROPERTIES] = { NULL, };
|
||||
static GParamSpec *obj_properties[N_PROPERTIES] = { NULL, };
|
||||
static guint signals[N_SIGNALS] = { 0, };
|
||||
|
||||
static void gtk_gesture_stylus_get_property (GObject* object,
|
||||
guint prop_id,
|
||||
GValue* value,
|
||||
GParamSpec* pspec)
|
||||
static void gtk_gesture_stylus_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkGestureStylus* gesture = GTK_GESTURE_STYLUS(object);
|
||||
GtkGestureStylus *gesture = GTK_GESTURE_STYLUS (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_STYLUS_ONLY:
|
||||
g_value_set_boolean(value, gtk_gesture_stylus_get_stylus_only(gesture));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_STYLUS_ONLY:
|
||||
g_value_set_boolean (value, gtk_gesture_stylus_get_stylus_only (gesture));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
static void gtk_gesture_stylus_set_property (GObject* object,
|
||||
guint prop_id,
|
||||
const GValue* value,
|
||||
GParamSpec* pspec)
|
||||
static void gtk_gesture_stylus_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkGestureStylus* gesture = GTK_GESTURE_STYLUS(object);
|
||||
GtkGestureStylus *gesture = GTK_GESTURE_STYLUS (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_STYLUS_ONLY:
|
||||
gtk_gesture_stylus_set_stylus_only(gesture, g_value_get_boolean(value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_STYLUS_ONLY:
|
||||
gtk_gesture_stylus_set_stylus_only (gesture, g_value_get_boolean (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -98,7 +100,7 @@ gtk_gesture_stylus_handle_event (GtkEventController *controller,
|
||||
GdkModifierType modifiers;
|
||||
guint n_signal;
|
||||
|
||||
priv = gtk_gesture_stylus_get_instance_private(GTK_GESTURE_STYLUS(controller));
|
||||
priv = gtk_gesture_stylus_get_instance_private (GTK_GESTURE_STYLUS (controller));
|
||||
GTK_EVENT_CONTROLLER_CLASS (gtk_gesture_stylus_parent_class)->handle_event (controller, event, x, y);
|
||||
|
||||
if (!(priv->stylus_only || gdk_event_get_device_tool (event)))
|
||||
@ -144,12 +146,10 @@ gtk_gesture_stylus_class_init (GtkGestureStylusClass *klass)
|
||||
*
|
||||
* If this gesture should exclusively react to stylus input devices.
|
||||
*/
|
||||
obj_properties[PROP_STYLUS_ONLY] = g_param_spec_boolean("stylus-only",
|
||||
P_("Stylus only"),
|
||||
P_("Should this gesture exclusively react to stylus input devices."),
|
||||
obj_properties[PROP_STYLUS_ONLY] = g_param_spec_boolean ("stylus-only", NULL, NULL,
|
||||
TRUE,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_CONSTRUCT);
|
||||
g_object_class_install_properties(object_class, N_PROPERTIES, obj_properties);
|
||||
g_object_class_install_properties (object_class, N_PROPERTIES, obj_properties);
|
||||
|
||||
event_controller_class = GTK_EVENT_CONTROLLER_CLASS (klass);
|
||||
event_controller_class->handle_event = gtk_gesture_stylus_handle_event;
|
||||
@ -268,12 +268,13 @@ gtk_gesture_stylus_new (void)
|
||||
* Returns: The state of stylus-only set via [method@Gtk.GestureStylus.set_stylus_only]
|
||||
*/
|
||||
gboolean
|
||||
gtk_gesture_stylus_get_stylus_only(GtkGestureStylus* gesture) {
|
||||
GtkGestureStylusPrivate* priv;
|
||||
gtk_gesture_stylus_get_stylus_only (GtkGestureStylus *gesture)
|
||||
{
|
||||
GtkGestureStylusPrivate *priv;
|
||||
|
||||
g_return_val_if_fail(GTK_IS_GESTURE_STYLUS(gesture), FALSE);
|
||||
g_return_val_if_fail (GTK_IS_GESTURE_STYLUS (gesture), FALSE);
|
||||
|
||||
priv = gtk_gesture_stylus_get_instance_private(gesture);
|
||||
priv = gtk_gesture_stylus_get_instance_private (gesture);
|
||||
|
||||
return priv->stylus_only;
|
||||
}
|
||||
@ -289,12 +290,13 @@ gtk_gesture_stylus_get_stylus_only(GtkGestureStylus* gesture) {
|
||||
* otherwise it'll handle events from any pointing device.
|
||||
*/
|
||||
void
|
||||
gtk_gesture_stylus_set_stylus_only(GtkGestureStylus* gesture, gboolean stylus_only) {
|
||||
GtkGestureStylusPrivate* priv;
|
||||
gtk_gesture_stylus_set_stylus_only (GtkGestureStylus *gesture, gboolean stylus_only)
|
||||
{
|
||||
GtkGestureStylusPrivate *priv;
|
||||
|
||||
g_return_if_fail(GTK_IS_GESTURE_STYLUS(gesture));
|
||||
g_return_if_fail (GTK_IS_GESTURE_STYLUS (gesture));
|
||||
|
||||
priv = gtk_gesture_stylus_get_instance_private(gesture);
|
||||
priv = gtk_gesture_stylus_get_instance_private (gesture);
|
||||
|
||||
if (priv->stylus_only == stylus_only)
|
||||
return;
|
||||
|
@ -43,11 +43,11 @@ GType gtk_gesture_stylus_get_type (void) G_GNUC_CONST;
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkGesture * gtk_gesture_stylus_new (void);
|
||||
|
||||
GDK_AVAILABLE_IN_4_8
|
||||
gboolean gtk_gesture_stylus_get_stylus_only (GtkGestureStylus* gesture);
|
||||
GDK_AVAILABLE_IN_4_8
|
||||
void gtk_gesture_stylus_set_stylus_only (GtkGestureStylus* gesture,
|
||||
gboolean stylus_only);
|
||||
GDK_AVAILABLE_IN_4_10
|
||||
gboolean gtk_gesture_stylus_get_stylus_only (GtkGestureStylus *gesture);
|
||||
GDK_AVAILABLE_IN_4_10
|
||||
void gtk_gesture_stylus_set_stylus_only (GtkGestureStylus *gesture,
|
||||
gboolean stylus_only);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_gesture_stylus_get_axis (GtkGestureStylus *gesture,
|
||||
|
Loading…
Reference in New Issue
Block a user