diff --git a/panels/meson.build b/panels/meson.build index 29b96450c..5382bb034 100644 --- a/panels/meson.build +++ b/panels/meson.build @@ -39,7 +39,7 @@ if host_is_linux_not_s390 panels += [ 'bluetooth', 'thunderbolt', -# 'wacom' + 'wacom' ] endif diff --git a/panels/wacom/button-mapping.ui b/panels/wacom/button-mapping.ui index 23b22262b..add7e454d 100644 --- a/panels/wacom/button-mapping.ui +++ b/panels/wacom/button-mapping.ui @@ -4,141 +4,73 @@ 600 450 - False - 5 Map Buttons False True 600 450 - dialog - + - True - False vertical 2 - - - True - False - end - - - - - - - - - - - - _Close - False - True - True - True - False - False - True - - - False - False - 3 - - - - - False - True - end - 0 - - - - True - False + + vertical 6 + True - True - False 0 - 12 + 12 Map buttons to functions - - False - True - 0 - - - True - False - 5 + + never - - True - True - never - in - - - True - True - - + - - True - True - 1 - - - True - False - 5 + + 5 + 5 + 5 + 5 12 - True - False 0 To edit a shortcut, choose the “Send Keystroke” action, press the keyboard shortcut button and hold down the new keys or press Backspace to clear. fill True + True - - True - True - 0 - - - False - True - 2 - - - True - True - 1 - + + + + end + + + _Close + False + True + False + False + True + + + diff --git a/panels/wacom/calibrator/calibrator-gui.c b/panels/wacom/calibrator/calibrator-gui.c index 012291f8b..1c9d6f4d9 100644 --- a/panels/wacom/calibrator/calibrator-gui.c +++ b/panels/wacom/calibrator/calibrator-gui.c @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include "calibrator.h" @@ -96,12 +96,11 @@ calib_area_notify_finish (CalibArea *area) } static gboolean -on_delete_event (GtkWidget *widget, - GdkEvent *event, - CalibArea *area) +on_close_request (GtkWidget *widget, + CalibArea *area) { calib_area_notify_finish (area); - return TRUE; + return GDK_EVENT_PROPAGATE; } static gboolean @@ -167,23 +166,20 @@ set_active_target (CalibArea *area, } static void -on_gesture_press (GtkGestureMultiPress *gesture, - guint n_press, - gdouble x, - gdouble y, - CalibArea *area) +on_gesture_press (GtkGestureClick *gesture, + guint n_press, + gdouble x, + gdouble y, + CalibArea *area) { gint num_clicks; gboolean success; GdkDevice *source; - GdkEvent *event; if (area->success) return; - event = gtk_get_current_event (); - source = gdk_event_get_source_device ((GdkEvent *) event); - gdk_event_free (event); + source = gtk_gesture_get_device (GTK_GESTURE (gesture)); /* Check matching device if a device was provided */ if (area->device && area->device != source) @@ -217,12 +213,13 @@ on_gesture_press (GtkGestureMultiPress *gesture, } static gboolean -on_key_release_event (GtkWidget *widget, - GdkEventKey *event, - CalibArea *area) +on_key_release_event (GtkWidget *widget, + guint keyval, + guint keycode, + GdkModifierType state, + CalibArea *area) { - if (area->success || - event->keyval != GDK_KEY_Escape) + if (area->success || keyval != GDK_KEY_Escape) return GDK_EVENT_PROPAGATE; calib_area_notify_finish (area); @@ -259,15 +256,15 @@ on_title_revealed (CalibArea *area) gtk_revealer_set_reveal_child (GTK_REVEALER (revealer), TRUE); } -static gboolean -on_fullscreen (GtkWindow *window, - GdkEventWindowState *event, - CalibArea *area) +static void +on_fullscreen (GtkWindow *window, + GParamSpec *pspec, + CalibArea *area) { GtkWidget *revealer; - if ((event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN) == 0) - return FALSE; + if (!gtk_window_is_fullscreen (window)) + return; revealer = GTK_WIDGET (gtk_builder_get_object (area->builder, "title_revealer")); g_signal_connect_swapped (revealer, "notify::child-revealed", @@ -276,8 +273,6 @@ on_fullscreen (GtkWindow *window, gtk_revealer_set_reveal_child (GTK_REVEALER (revealer), TRUE); set_active_target (area, 0); - - return FALSE; } static void @@ -295,7 +290,7 @@ on_size_allocate (GtkWidget *widget, * calib_area_finish(). */ CalibArea * -calib_area_new (GdkScreen *screen, +calib_area_new (GdkDisplay *display, int n_monitor, GdkDevice *device, FinishCallback callback, @@ -303,15 +298,10 @@ calib_area_new (GdkScreen *screen, int threshold_doubleclick, int threshold_misclick) { + g_autoptr(GdkMonitor) monitor = NULL; CalibArea *calib_area; GdkRectangle rect; - GdkVisual *visual; - GdkMonitor *monitor; -#ifndef FAKE_AREA - GdkWindow *window; - g_autoptr(GdkCursor) cursor = NULL; -#endif /* FAKE_AREA */ - GtkGesture *press; + GtkGesture *click; g_return_val_if_fail (callback, NULL); @@ -330,9 +320,9 @@ calib_area_new (GdkScreen *screen, calib_area->clock = GTK_WIDGET (gtk_builder_get_object (calib_area->builder, "clock")); calib_area->style_provider = gtk_css_provider_new (); gtk_css_provider_load_from_resource (calib_area->style_provider, "/org/gnome/control-center/wacom/calibrator/calibrator.css"); - gtk_style_context_add_provider_for_screen (gtk_widget_get_screen (calib_area->window), - GTK_STYLE_PROVIDER (calib_area->style_provider), - GTK_STYLE_PROVIDER_PRIORITY_USER); + gtk_style_context_add_provider_for_display (gtk_widget_get_display (calib_area->window), + GTK_STYLE_PROVIDER (calib_area->style_provider), + GTK_STYLE_PROVIDER_PRIORITY_USER); cc_clock_set_duration (CC_CLOCK (calib_area->clock), MAX_TIME); g_signal_connect (calib_area->clock, "finished", @@ -341,18 +331,15 @@ calib_area_new (GdkScreen *screen, #ifndef FAKE_AREA /* No cursor */ gtk_widget_realize (calib_area->window); - window = gtk_widget_get_window (calib_area->window); - cursor = gdk_cursor_new_for_display (gdk_display_get_default (), GDK_BLANK_CURSOR); - gdk_window_set_cursor (window, cursor); + gtk_widget_set_cursor_from_name (calib_area->window, "blank"); gtk_widget_set_can_focus (calib_area->window, TRUE); - gtk_window_set_keep_above (GTK_WINDOW (calib_area->window), TRUE); #endif /* FAKE_AREA */ /* Move to correct screen */ - if (screen == NULL) - screen = gdk_screen_get_default (); - monitor = gdk_display_get_monitor (gdk_screen_get_display (screen), n_monitor); + if (display == NULL) + display = gdk_display_get_default (); + monitor = g_list_model_get_item (gdk_display_get_monitors (display), n_monitor); gdk_monitor_get_geometry (monitor, &rect); calib_area->calibrator.geometry = rect; @@ -362,15 +349,15 @@ calib_area_new (GdkScreen *screen, G_CALLBACK (on_key_release_event), calib_area); g_signal_connect (calib_area->window, - "delete-event", - G_CALLBACK (on_delete_event), + "close-request", + G_CALLBACK (on_close_request), calib_area); g_signal_connect (calib_area->window, "focus-out-event", G_CALLBACK(on_focus_out_event), calib_area); g_signal_connect (calib_area->window, - "window-state-event", + "notify::fullscreened", G_CALLBACK (on_fullscreen), calib_area); g_signal_connect (calib_area->window, @@ -378,17 +365,13 @@ calib_area_new (GdkScreen *screen, G_CALLBACK (on_size_allocate), calib_area); - press = gtk_gesture_multi_press_new (calib_area->window); - gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (press), GDK_BUTTON_PRIMARY); - g_signal_connect (press, "pressed", + click = gtk_gesture_click_new (); + gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (click), GDK_BUTTON_PRIMARY); + g_signal_connect (click, "pressed", G_CALLBACK (on_gesture_press), calib_area); + gtk_widget_add_controller (calib_area->window, GTK_EVENT_CONTROLLER (click)); - gtk_window_fullscreen_on_monitor (GTK_WINDOW (calib_area->window), screen, n_monitor); - - visual = gdk_screen_get_rgba_visual (screen); - if (visual != NULL) - gtk_widget_set_visual (GTK_WIDGET (calib_area->window), visual); - + gtk_window_fullscreen_on_monitor (GTK_WINDOW (calib_area->window), monitor); gtk_widget_show (calib_area->window); return calib_area; @@ -418,9 +401,9 @@ calib_area_free (CalibArea *area) { g_return_if_fail (area != NULL); - gtk_style_context_remove_provider_for_screen (gtk_widget_get_screen (area->window), - GTK_STYLE_PROVIDER (area->style_provider)); - gtk_widget_destroy (area->window); + gtk_style_context_remove_provider_for_display (gtk_widget_get_display (area->window), + GTK_STYLE_PROVIDER (area->style_provider)); + gtk_window_destroy (GTK_WINDOW (area->window)); g_free (area); } diff --git a/panels/wacom/calibrator/calibrator-gui.h b/panels/wacom/calibrator/calibrator-gui.h index d3301c138..6e0dc7a08 100644 --- a/panels/wacom/calibrator/calibrator-gui.h +++ b/panels/wacom/calibrator/calibrator-gui.h @@ -39,7 +39,7 @@ typedef struct typedef struct CalibArea CalibArea; typedef void (*FinishCallback) (CalibArea *area, gpointer user_data); -CalibArea * calib_area_new (GdkScreen *screen, +CalibArea * calib_area_new (GdkDisplay *display, int monitor, GdkDevice *device, FinishCallback callback, diff --git a/panels/wacom/calibrator/calibrator.ui b/panels/wacom/calibrator/calibrator.ui index 6734b76f1..81b0ee11b 100644 --- a/panels/wacom/calibrator/calibrator.ui +++ b/panels/wacom/calibrator/calibrator.ui @@ -5,46 +5,39 @@ calibrator - True 0 - True True True - True vertical + + 0 + 0 + 8 + 8 + - True vertical + True - - True - - - True - - - 1 - + - True vertical + True - True 300 title - True Screen Calibration @@ -52,143 +45,117 @@ - True 300 subtitle - True Please tap the target markers as they appear on screen to calibrate the tablet. - - 1 - - True crossfade 500 error - True Mis-click detected, restarting… - - 2 - - - True - 2 - - - 0 - 0 - 8 - 8 - target 100 100 - True - True + True False + + 0 + 0 + 2 + 2 + - - 0 - 0 - 2 - 2 - target 100 100 - True - True + True False + + 6 + 0 + 2 + 2 + - - 6 - 0 - 2 - 2 - target 100 100 - True - True + True False + + 0 + 6 + 2 + 2 + - - 0 - 6 - 2 - 2 - target 100 100 - True - True + True False + + 6 + 6 + 2 + 2 + - - 6 - 6 - 2 - 2 - - True none 0 + + 0 + 0 + 8 + 8 + - - 0 - 0 - 8 - 8 - - + page0 - + - True 300 emblem-ok-symbolic - + page1 1 - + diff --git a/panels/wacom/calibrator/cc-clock.c b/panels/wacom/calibrator/cc-clock.c index b39ddacdc..26afd8136 100644 --- a/panels/wacom/calibrator/cc-clock.c +++ b/panels/wacom/calibrator/cc-clock.c @@ -79,19 +79,19 @@ cc_clock_get_angle (CcClock *clock) return ((gdouble) time_diff / (clock->duration * 1000)) * 360; } -static gboolean -cc_clock_draw (GtkWidget *widget, - cairo_t *cr) +static void +cc_clock_snapshot (GtkWidget *widget, + GtkSnapshot *snapshot) { GtkAllocation allocation; + cairo_t *cr; gdouble angle; gtk_widget_get_allocation (widget, &allocation); angle = cc_clock_get_angle (CC_CLOCK (widget)); - cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR); - cairo_paint (cr); - cairo_set_operator (cr, CAIRO_OPERATOR_OVER); + cr = gtk_snapshot_append_cairo (snapshot, + &GRAPHENE_RECT_INIT (0, 0, allocation.width, allocation.height)); /* Draw the clock background */ cairo_arc (cr, allocation.width / 2, allocation.height / 2, CLOCK_RADIUS / 2, 0.0, 2.0 * M_PI); @@ -109,8 +109,6 @@ cc_clock_draw (GtkWidget *widget, 3 * M_PI_2 + angle * M_PI / 180.0); cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); cairo_stroke (cr); - - return TRUE; } static void @@ -199,20 +197,13 @@ cc_clock_get_property (GObject *object, } static void -cc_clock_get_preferred_width (GtkWidget *widget, - gint *minimum, - gint *natural) -{ - if (minimum) - *minimum = CLOCK_RADIUS + EXTRA_SPACE; - if (natural) - *natural = CLOCK_RADIUS + EXTRA_SPACE; -} - -static void -cc_clock_get_preferred_height (GtkWidget *widget, - gint *minimum, - gint *natural) +cc_clock_measure (GtkWidget *widget, + GtkOrientation orientation, + gint for_size, + gint *minimum, + gint *natural, + gint *minimum_baseline, + gint *natural_baseline) { if (minimum) *minimum = CLOCK_RADIUS + EXTRA_SPACE; @@ -230,9 +221,8 @@ cc_clock_class_init (CcClockClass *klass) object_class->get_property = cc_clock_get_property; widget_class->map = cc_clock_map; - widget_class->draw = cc_clock_draw; - widget_class->get_preferred_width = cc_clock_get_preferred_width; - widget_class->get_preferred_height = cc_clock_get_preferred_height; + widget_class->snapshot = cc_clock_snapshot; + widget_class->measure = cc_clock_measure; signals[FINISHED] = g_signal_new ("finished", @@ -256,7 +246,6 @@ cc_clock_class_init (CcClockClass *klass) static void cc_clock_init (CcClock *clock) { - gtk_widget_set_has_window (GTK_WIDGET (clock), FALSE); } GtkWidget * diff --git a/panels/wacom/calibrator/main.c b/panels/wacom/calibrator/main.c index 1a82e87b3..e35d48e49 100644 --- a/panels/wacom/calibrator/main.c +++ b/panels/wacom/calibrator/main.c @@ -34,6 +34,8 @@ #include "calibrator-gui.h" #include "calibrator.h" +static GMainLoop *mainloop = NULL; + /** * find a calibratable touchscreen device (using XInput) * @@ -383,7 +385,7 @@ calibration_finished_cb (CalibArea *area, else fprintf(stderr, "Error: unable to apply or save configuration values\n"); - gtk_main_quit (); + g_main_loop_quit (mainloop); } int main(int argc, char** argv) @@ -396,7 +398,7 @@ int main(int argc, char** argv) bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); - gtk_init (&argc, &argv); + gtk_init (); g_setenv ("G_MESSAGES_DEBUG", "all", TRUE); @@ -408,7 +410,8 @@ int main(int argc, char** argv) calibrator->threshold_doubleclick, calibrator->threshold_misclick); - gtk_main (); + mainloop = g_main_loop_new (NULL, FALSE); + g_main_loop_run (mainloop); calib_area_free (calib_area); diff --git a/panels/wacom/cc-drawing-area.c b/panels/wacom/cc-drawing-area.c index 6c635977f..3f570ad66 100644 --- a/panels/wacom/cc-drawing-area.c +++ b/panels/wacom/cc-drawing-area.c @@ -24,13 +24,13 @@ typedef struct _CcDrawingArea CcDrawingArea; struct _CcDrawingArea { - GtkEventBox parent; - GdkDevice *current_device; + GtkDrawingArea parent; + GtkGesture *stylus_gesture; cairo_surface_t *surface; cairo_t *cr; }; -G_DEFINE_TYPE (CcDrawingArea, cc_drawing_area, GTK_TYPE_EVENT_BOX) +G_DEFINE_TYPE (CcDrawingArea, cc_drawing_area, GTK_TYPE_DRAWING_AREA) static void ensure_drawing_surface (CcDrawingArea *area, @@ -61,18 +61,6 @@ ensure_drawing_surface (CcDrawingArea *area, } } -static void -cc_drawing_area_size_allocate (GtkWidget *widget, - GtkAllocation *allocation) -{ - CcDrawingArea *area = CC_DRAWING_AREA (widget); - - ensure_drawing_surface (area, allocation->width, allocation->height); - - GTK_WIDGET_CLASS (cc_drawing_area_parent_class)->size_allocate (widget, - allocation); -} - static void cc_drawing_area_map (GtkWidget *widget) { @@ -103,16 +91,17 @@ cc_drawing_area_unmap (GtkWidget *widget) GTK_WIDGET_CLASS (cc_drawing_area_parent_class)->unmap (widget); } -static gboolean -cc_drawing_area_draw (GtkWidget *widget, - cairo_t *cr) +static void +draw_cb (GtkDrawingArea *drawing_area, + cairo_t *cr, + gint width, + gint height, + gpointer user_data) { - CcDrawingArea *area = CC_DRAWING_AREA (widget); - GtkAllocation allocation; + CcDrawingArea *area = CC_DRAWING_AREA (drawing_area); - GTK_WIDGET_CLASS (cc_drawing_area_parent_class)->draw (widget, cr); + ensure_drawing_surface (area, width, height); - gtk_widget_get_allocation (widget, &allocation); cairo_set_source_rgb (cr, 1, 1, 1); cairo_paint (cr); @@ -120,69 +109,48 @@ cc_drawing_area_draw (GtkWidget *widget, cairo_paint (cr); cairo_set_source_rgb (cr, 0.6, 0.6, 0.6); - cairo_rectangle (cr, 0, 0, allocation.width, allocation.height); + cairo_rectangle (cr, 0, 0, width, height); cairo_stroke (cr); - - return FALSE; } -static gboolean -cc_drawing_area_event (GtkWidget *widget, - GdkEvent *event) +static void +stylus_down_cb (GtkGestureStylus *gesture, + double x, + double y, + CcDrawingArea *area) +{ + cairo_new_path (area->cr); +} + +static void +stylus_motion_cb (GtkGestureStylus *gesture, + double x, + double y, + CcDrawingArea *area) { - CcDrawingArea *area = CC_DRAWING_AREA (widget); - GdkInputSource source; GdkDeviceTool *tool; - GdkDevice *device; + gdouble pressure; - device = gdk_event_get_source_device (event); + tool = gtk_gesture_stylus_get_device_tool (gesture); + gtk_gesture_stylus_get_axis (gesture, + GDK_AXIS_PRESSURE, + &pressure); - if (!device) - return GDK_EVENT_PROPAGATE; - - source = gdk_device_get_source (device); - tool = gdk_event_get_device_tool (event); - - if (source != GDK_SOURCE_PEN && source != GDK_SOURCE_ERASER) - return GDK_EVENT_PROPAGATE; - - if (area->current_device && area->current_device != device) - return GDK_EVENT_PROPAGATE; - - if (event->type == GDK_BUTTON_PRESS && - event->button.button == 1 && !area->current_device) { - area->current_device = device; - } else if (event->type == GDK_BUTTON_RELEASE && - event->button.button == 1 && area->current_device) { - cairo_new_path (area->cr); - area->current_device = NULL; - } else if (event->type == GDK_MOTION_NOTIFY && - event->motion.state & GDK_BUTTON1_MASK) { - gdouble x, y, pressure; - - gdk_event_get_coords (event, &x, &y); - gdk_event_get_axis (event, GDK_AXIS_PRESSURE, &pressure); - - if (gdk_device_tool_get_tool_type (tool) == GDK_DEVICE_TOOL_TYPE_ERASER) { - cairo_set_line_width (area->cr, 10 * pressure); - cairo_set_operator (area->cr, CAIRO_OPERATOR_DEST_OUT); - } else { - cairo_set_line_width (area->cr, 4 * pressure); - cairo_set_operator (area->cr, CAIRO_OPERATOR_SATURATE); - } - - cairo_set_source_rgba (area->cr, 0, 0, 0, pressure); - cairo_line_to (area->cr, x, y); - cairo_stroke (area->cr); - - cairo_move_to (area->cr, x, y); - - gtk_widget_queue_draw (widget); - - return GDK_EVENT_STOP; + if (gdk_device_tool_get_tool_type (tool) == GDK_DEVICE_TOOL_TYPE_ERASER) { + cairo_set_line_width (area->cr, 10 * pressure); + cairo_set_operator (area->cr, CAIRO_OPERATOR_DEST_OUT); + } else { + cairo_set_line_width (area->cr, 4 * pressure); + cairo_set_operator (area->cr, CAIRO_OPERATOR_SATURATE); } - return GDK_EVENT_PROPAGATE; + cairo_set_source_rgba (area->cr, 0, 0, 0, pressure); + cairo_line_to (area->cr, x, y); + cairo_stroke (area->cr); + + cairo_move_to (area->cr, x, y); + + gtk_widget_queue_draw (GTK_WIDGET (area)); } static void @@ -190,9 +158,6 @@ cc_drawing_area_class_init (CcDrawingAreaClass *klass) { GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - widget_class->size_allocate = cc_drawing_area_size_allocate; - widget_class->draw = cc_drawing_area_draw; - widget_class->event = cc_drawing_area_event; widget_class->map = cc_drawing_area_map; widget_class->unmap = cc_drawing_area_unmap; } @@ -200,11 +165,14 @@ cc_drawing_area_class_init (CcDrawingAreaClass *klass) static void cc_drawing_area_init (CcDrawingArea *area) { - gtk_event_box_set_above_child (GTK_EVENT_BOX (area), TRUE); - gtk_widget_add_events (GTK_WIDGET (area), - GDK_BUTTON_PRESS_MASK | - GDK_BUTTON_RELEASE_MASK | - GDK_POINTER_MOTION_MASK); + gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (area), draw_cb, NULL, NULL); + area->stylus_gesture = gtk_gesture_stylus_new (); + g_signal_connect (area->stylus_gesture, "down", + G_CALLBACK (stylus_down_cb), area); + g_signal_connect (area->stylus_gesture, "motion", + G_CALLBACK (stylus_motion_cb), area); + gtk_widget_add_controller (GTK_WIDGET (area), + GTK_EVENT_CONTROLLER (area->stylus_gesture)); } GtkWidget * diff --git a/panels/wacom/cc-drawing-area.h b/panels/wacom/cc-drawing-area.h index 9b22a4233..1d3d6baad 100644 --- a/panels/wacom/cc-drawing-area.h +++ b/panels/wacom/cc-drawing-area.h @@ -24,7 +24,7 @@ G_BEGIN_DECLS #define CC_TYPE_DRAWING_AREA (cc_drawing_area_get_type ()) -G_DECLARE_FINAL_TYPE (CcDrawingArea, cc_drawing_area, CC, DRAWING_AREA, GtkEventBox) +G_DECLARE_FINAL_TYPE (CcDrawingArea, cc_drawing_area, CC, DRAWING_AREA, GtkDrawingArea) GtkWidget *cc_drawing_area_new (void); diff --git a/panels/wacom/cc-wacom-button-row.c b/panels/wacom/cc-wacom-button-row.c index b3ae07eae..3c8536b81 100644 --- a/panels/wacom/cc-wacom-button-row.c +++ b/panels/wacom/cc-wacom-button-row.c @@ -272,7 +272,7 @@ cc_wacom_button_row_new (guint button, row, G_CONNECT_SWAPPED); - gtk_container_add (GTK_CONTAINER (row), grid); + gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), grid); cc_wacom_button_row_update (CC_WACOM_BUTTON_ROW (row)); diff --git a/panels/wacom/cc-wacom-device.c b/panels/wacom/cc-wacom-device.c index 57893d241..28ee54f3e 100644 --- a/panels/wacom/cc-wacom-device.c +++ b/panels/wacom/cc-wacom-device.c @@ -339,7 +339,7 @@ cc_wacom_device_get_output (CcWacomDevice *device, GnomeRRCrtc *crtc; g_return_val_if_fail (CC_IS_WACOM_DEVICE (device), NULL); - g_return_val_if_fail (GNOME_IS_RR_SCREEN (rr_screen), NULL); + g_return_val_if_fail (GNOME_RR_IS_SCREEN (rr_screen), NULL); rr_output = find_output (rr_screen, device); if (rr_output == NULL) { diff --git a/panels/wacom/cc-wacom-device.h b/panels/wacom/cc-wacom-device.h index fae504a36..3e2c2ee61 100644 --- a/panels/wacom/cc-wacom-device.h +++ b/panels/wacom/cc-wacom-device.h @@ -27,7 +27,7 @@ #include "gsd-device-manager.h" #define GNOME_DESKTOP_USE_UNSTABLE_API -#include +#include #define CC_TYPE_WACOM_DEVICE (cc_wacom_device_get_type ()) G_DECLARE_FINAL_TYPE (CcWacomDevice, cc_wacom_device, CC, WACOM_DEVICE, GObject) diff --git a/panels/wacom/cc-wacom-mapping-panel.c b/panels/wacom/cc-wacom-mapping-panel.c index 2b8b012a8..eda914cfc 100644 --- a/panels/wacom/cc-wacom-mapping-panel.c +++ b/panels/wacom/cc-wacom-mapping-panel.c @@ -23,8 +23,8 @@ #include #include #define GNOME_DESKTOP_USE_UNSTABLE_API -#include -#include +#include +#include #include @@ -96,7 +96,7 @@ update_monitor_chooser (CcWacomMappingPanel *self) self->rr_screen); g_signal_handlers_block_by_func (G_OBJECT (self->checkbutton), checkbutton_toggled_cb, self); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(self->checkbutton), cur_output != NULL); + gtk_check_button_set_active (GTK_CHECK_BUTTON(self->checkbutton), cur_output != NULL); g_signal_handlers_unblock_by_func (G_OBJECT (self->checkbutton), checkbutton_toggled_cb, self); g_signal_handlers_block_by_func (G_OBJECT (self->aspectswitch), aspectswitch_toggled_cb, self); @@ -143,7 +143,7 @@ update_ui (CcWacomMappingPanel *self) { if (self->device == NULL) { gtk_widget_set_sensitive (GTK_WIDGET(self->checkbutton), FALSE); - gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON(self->checkbutton), TRUE); + gtk_check_button_set_inconsistent (GTK_CHECK_BUTTON(self->checkbutton), TRUE); } else { gboolean is_screen_tablet; @@ -152,7 +152,7 @@ update_ui (CcWacomMappingPanel *self) WACOM_DEVICE_INTEGRATED_DISPLAY; gtk_widget_set_sensitive (GTK_WIDGET(self->checkbutton), !is_screen_tablet); - gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON(self->checkbutton), FALSE); + gtk_check_button_set_inconsistent (GTK_CHECK_BUTTON(self->checkbutton), FALSE); } update_monitor_chooser (self); @@ -163,7 +163,7 @@ update_mapping (CcWacomMappingPanel *self) { GnomeRROutput *output = NULL; - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->checkbutton))) { + if (gtk_check_button_get_active (GTK_CHECK_BUTTON (self->checkbutton))) { GtkTreeIter iter; GtkTreeModel *model; char *name; @@ -193,7 +193,7 @@ checkbutton_toggled_cb (CcWacomMappingPanel *self) { gboolean active; - active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->checkbutton)); + active = gtk_check_button_get_active (GTK_CHECK_BUTTON (self->checkbutton)); set_combobox_sensitive (self, active); if (!active) gtk_switch_set_active (GTK_SWITCH(self->aspectswitch), FALSE); @@ -224,7 +224,7 @@ cc_wacom_mapping_panel_init (CcWacomMappingPanel *self) GtkCellRenderer *renderer; g_autoptr(GError) error = NULL; - self->rr_screen = gnome_rr_screen_new (gdk_screen_get_default (), &error); + self->rr_screen = gnome_rr_screen_new (gdk_display_get_default (), &error); if (error) g_warning ("Could not get RR screen: %s", error->message); @@ -233,8 +233,11 @@ cc_wacom_mapping_panel_init (CcWacomMappingPanel *self) G_CALLBACK (update_monitor_chooser), self, G_CONNECT_SWAPPED); vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8); - gtk_container_add (GTK_CONTAINER (self), vbox); - gtk_container_set_border_width (GTK_CONTAINER (self), 12); + gtk_box_append (GTK_BOX (self), vbox); + gtk_widget_set_margin_top (GTK_WIDGET (self), 12); + gtk_widget_set_margin_bottom (GTK_WIDGET (self), 12); + gtk_widget_set_margin_start (GTK_WIDGET (self), 12); + gtk_widget_set_margin_end (GTK_WIDGET (self), 12); gtk_widget_set_vexpand (GTK_WIDGET (vbox), TRUE); gtk_widget_set_hexpand (GTK_WIDGET (vbox), TRUE); @@ -266,18 +269,15 @@ cc_wacom_mapping_panel_init (CcWacomMappingPanel *self) /* Whole-desktop checkbox */ self->checkbutton = gtk_check_button_new_with_label (_("Map to single monitor")); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->checkbutton), FALSE); + gtk_check_button_set_active (GTK_CHECK_BUTTON (self->checkbutton), FALSE); g_signal_connect_object (self->checkbutton, "toggled", G_CALLBACK (checkbutton_toggled_cb), self, G_CONNECT_SWAPPED); - gtk_box_pack_start (GTK_BOX(vbox), GTK_WIDGET(self->checkbutton), - FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX(vbox), GTK_WIDGET(grid), - FALSE, FALSE, 8); + gtk_box_append (GTK_BOX(vbox), GTK_WIDGET(self->checkbutton)); + gtk_box_append (GTK_BOX(vbox), GTK_WIDGET(grid)); /* Update display */ cc_wacom_mapping_panel_set_device (self, NULL); - gtk_widget_show_all(GTK_WIDGET(self)); } GtkWidget * diff --git a/panels/wacom/cc-wacom-nav-button.c b/panels/wacom/cc-wacom-nav-button.c index 3239f5f1e..881a79938 100644 --- a/panels/wacom/cc-wacom-nav-button.c +++ b/panels/wacom/cc-wacom-nav-button.c @@ -173,44 +173,33 @@ cc_wacom_nav_button_class_init (CcWacomNavButtonClass *klass) static void cc_wacom_nav_button_init (CcWacomNavButton *self) { - GtkStyleContext *context; - GtkWidget *image, *box; + GtkWidget *box; + + gtk_box_set_spacing (GTK_BOX (self), 12); /* Label */ self->label = gtk_label_new (NULL); - gtk_style_context_add_class (gtk_widget_get_style_context (self->label), "dim-label"); - gtk_box_pack_start (GTK_BOX (self), self->label, - FALSE, FALSE, 8); + gtk_widget_add_css_class (self->label, "dim-label"); + gtk_box_append (GTK_BOX (self), self->label); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - context = gtk_widget_get_style_context (GTK_WIDGET (box)); - gtk_style_context_add_class (context, GTK_STYLE_CLASS_LINKED); - gtk_box_pack_start (GTK_BOX (self), box, - FALSE, FALSE, 0); + gtk_widget_add_css_class (box, "linked"); + gtk_box_append (GTK_BOX (self), box); /* Prev button */ - self->prev = gtk_button_new (); - image = gtk_image_new_from_icon_name ("go-previous-symbolic", GTK_ICON_SIZE_MENU); - gtk_container_add (GTK_CONTAINER (self->prev), image); + self->prev = gtk_button_new_from_icon_name ("go-previous-symbolic"); g_signal_connect_object (G_OBJECT (self->prev), "clicked", G_CALLBACK (prev_clicked), self, G_CONNECT_SWAPPED); gtk_widget_set_valign (self->prev, GTK_ALIGN_CENTER); /* Next button */ - self->next = gtk_button_new (); - image = gtk_image_new_from_icon_name ("go-next-symbolic", GTK_ICON_SIZE_MENU); - gtk_container_add (GTK_CONTAINER (self->next), image); + self->next = gtk_button_new_from_icon_name ("go-next-symbolic"); g_signal_connect_object (G_OBJECT (self->next), "clicked", G_CALLBACK (next_clicked), self, G_CONNECT_SWAPPED); gtk_widget_set_valign (self->next, GTK_ALIGN_CENTER); - gtk_box_pack_start (GTK_BOX (box), self->prev, - FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (box), self->next, - FALSE, FALSE, 0); - - gtk_widget_show (self->label); - gtk_widget_show_all (box); + gtk_box_append (GTK_BOX (box), self->prev); + gtk_box_append (GTK_BOX (box), self->next); } GtkWidget * diff --git a/panels/wacom/cc-wacom-page.c b/panels/wacom/cc-wacom-page.c index b85bce75e..86b098f10 100644 --- a/panels/wacom/cc-wacom-page.c +++ b/panels/wacom/cc-wacom-page.c @@ -29,10 +29,10 @@ #include #include #ifdef GDK_WINDOWING_X11 -#include +#include #endif #ifdef GDK_WINDOWING_WAYLAND -#include +#include #endif #include "cc-wacom-device.h" @@ -48,7 +48,6 @@ #include #define WID(x) (GtkWidget *) gtk_builder_get_object (page->builder, x) -#define CWID(x) (GtkContainer *) gtk_builder_get_object (page->builder, x) #define MWID(x) (GtkWidget *) gtk_builder_get_object (page->mapping_builder, x) #define THRESHOLD_MISCLICK 15 @@ -79,12 +78,12 @@ struct _CcWacomPage /* Button mapping */ GtkBuilder *mapping_builder; - GtkWidget *button_map; + GtkWindow *button_map; GtkListStore *action_store; /* Display mapping */ GtkWidget *mapping; - GtkWidget *dialog; + GtkWindow *dialog; GCancellable *cancellable; @@ -225,7 +224,7 @@ cc_wacom_page_get_gdk_device (CcWacomPage *page) display = gtk_widget_get_display (GTK_WIDGET (page)); seat = gdk_display_get_default_seat (display); - slaves = gdk_seat_get_slaves (seat, GDK_SEAT_CAPABILITY_TABLET_STYLUS); + slaves = gdk_seat_get_devices (seat, GDK_SEAT_CAPABILITY_TABLET_STYLUS); for (l = slaves; l && !gdk_device; l = l->next) { g_autofree gchar *device_node = NULL; @@ -256,12 +255,15 @@ run_calibration (CcWacomPage *page, GdkMonitor *monitor) { GdkDisplay *display = gdk_monitor_get_display (monitor); - gint i, n_monitor = 0; + GListModel *monitors; + guint i, n_monitor = 0; g_assert (page->area == NULL); - for (i = 0; i < gdk_display_get_n_monitors (display); i++) { - if (monitor == gdk_display_get_monitor (display, i)) { + monitors = gdk_display_get_monitors (display); + for (i = 0; i < g_list_model_get_n_items (monitors); i++) { + g_autoptr(GdkMonitor) m = g_list_model_get_item (monitors, i); + if (monitor == m) { n_monitor = i; break; } @@ -291,15 +293,16 @@ calibrate (CcWacomPage *page) g_autofree GVariant **tmp = NULL; g_autofree gdouble *calibration = NULL; gsize ncal; - GdkMonitor *monitor; - GdkScreen *screen; + g_autoptr(GdkMonitor) monitor = NULL; + GListModel *monitors; + GdkDisplay *display; g_autoptr(GnomeRRScreen) rr_screen = NULL; GnomeRROutput *output; g_autoptr(GError) error = NULL; gint x, y; - screen = gdk_screen_get_default (); - rr_screen = gnome_rr_screen_new (screen, &error); + display = gdk_display_get_default (); + rr_screen = gnome_rr_screen_new (display, &error); if (error) { g_warning ("Could not connect to display manager: %s", error->message); return; @@ -307,7 +310,19 @@ calibrate (CcWacomPage *page) output = cc_wacom_device_get_output (page->stylus, rr_screen); gnome_rr_output_get_position (output, &x, &y); - monitor = gdk_display_get_monitor_at_point (gdk_screen_get_display (screen), x, y); + + monitors = gdk_display_get_monitors (display); + for (i = 0; i < g_list_model_get_n_items (monitors); i++) { + g_autoptr(GdkMonitor) m = g_list_model_get_item (monitors, i); + GdkRectangle geometry; + + gdk_monitor_get_geometry (m, &geometry); + if (gdk_rectangle_contains_point (&geometry, x, y)) + { + monitor = g_steal_pointer (&m); + break; + } + } if (!monitor) { /* The display the tablet should be mapped to could not be located. @@ -364,11 +379,8 @@ create_row_from_button (GtkWidget *list_box, guint button, GSettings *settings) { - GtkWidget *row; - - row = cc_wacom_button_row_new (button, settings); - gtk_container_add (GTK_CONTAINER (list_box), row); - gtk_widget_show (row); + gtk_list_box_append (GTK_LIST_BOX (list_box), + cc_wacom_button_row_new (button, settings)); } static void @@ -400,7 +412,7 @@ setup_button_mapping (CcWacomPage *page) static void button_mapping_dialog_closed (CcWacomPage *page) { - gtk_widget_destroy (MWID ("button-mapping-dialog")); + gtk_window_destroy (GTK_WINDOW (MWID ("button-mapping-dialog"))); g_clear_object (&page->mapping_builder); } @@ -426,7 +438,7 @@ show_button_mapping_dialog (CcWacomPage *page) setup_button_mapping (page); dialog = MWID ("button-mapping-dialog"); - toplevel = gtk_widget_get_toplevel (GTK_WIDGET (page)); + toplevel = GTK_WIDGET (gtk_widget_get_native (GTK_WIDGET (page))); gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (toplevel)); gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); g_signal_connect_object (dialog, "response", @@ -434,7 +446,7 @@ show_button_mapping_dialog (CcWacomPage *page) gtk_widget_show (dialog); - page->button_map = dialog; + page->button_map = GTK_WINDOW (dialog); g_object_add_weak_pointer (G_OBJECT (dialog), (gpointer *) &page->button_map); } @@ -501,7 +513,7 @@ display_mapping_dialog_closed (CcWacomPage *page) { int layout; - gtk_widget_destroy (page->dialog); + gtk_window_destroy (page->dialog); page->dialog = NULL; page->mapping = NULL; layout = get_layout_type (page->stylus); @@ -511,22 +523,24 @@ display_mapping_dialog_closed (CcWacomPage *page) static void display_mapping_button_clicked_cb (CcWacomPage *page) { + GtkWidget *dialog; + g_assert (page->mapping == NULL); - page->dialog = gtk_dialog_new_with_buttons (_("Display Mapping"), - GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (page))), + dialog = gtk_dialog_new_with_buttons (_("Display Mapping"), + GTK_WINDOW (gtk_widget_get_native (GTK_WIDGET (page))), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, _("_Close"), GTK_RESPONSE_ACCEPT, NULL); + page->dialog = GTK_WINDOW (dialog); page->mapping = cc_wacom_mapping_panel_new (); cc_wacom_mapping_panel_set_device (CC_WACOM_MAPPING_PANEL (page->mapping), page->stylus); - gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (page->dialog))), - page->mapping); + gtk_window_set_child (page->dialog, page->mapping); g_signal_connect_object (page->dialog, "response", G_CALLBACK (display_mapping_dialog_closed), page, G_CONNECT_SWAPPED); - gtk_widget_show_all (page->dialog); + gtk_window_present (page->dialog); g_object_add_weak_pointer (G_OBJECT (page->mapping), (gpointer *) &page->dialog); } @@ -639,14 +653,14 @@ decouple_display_toggled_cb (CcWacomPage *page) if (!active) { cc_wacom_device_set_output (page->stylus, NULL); } else { - GdkScreen *screen; + GdkDisplay *display; GnomeRRScreen *rr_screen; GnomeRROutput **outputs, *picked = NULL; g_autoptr(GError) error = NULL; int i; - screen = gtk_widget_get_screen (GTK_WIDGET (WID ("switch-decouple-display"))); - rr_screen = gnome_rr_screen_new (screen, &error); + display = gtk_widget_get_display (GTK_WIDGET (WID ("switch-decouple-display"))); + rr_screen = gnome_rr_screen_new (display, &error); if (rr_screen == NULL) { g_warning ("Could not connect to display manager: %s", error->message); return; @@ -707,8 +721,8 @@ cc_wacom_page_dispose (GObject *object) g_cancellable_cancel (self->cancellable); g_clear_object (&self->cancellable); g_clear_pointer (&self->area, calib_area_free); - g_clear_pointer (&self->button_map, gtk_widget_destroy); - g_clear_pointer (&self->dialog, gtk_widget_destroy); + g_clear_pointer (&self->button_map, gtk_window_destroy); + g_clear_pointer (&self->dialog, gtk_window_destroy); g_clear_object (&self->builder); g_clear_object (&self->header_group); g_list_free_full (self->pads, g_object_unref); @@ -736,7 +750,7 @@ remove_link_padding (GtkWidget *widget) provider = gtk_css_provider_new (); gtk_css_provider_load_from_data (GTK_CSS_PROVIDER (provider), - ".link { padding: 0px; }", -1, NULL); + ".link { padding: 0px; }", -1); gtk_style_context_add_provider (gtk_widget_get_style_context (widget), GTK_STYLE_PROVIDER (provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); @@ -769,7 +783,7 @@ cc_wacom_page_init (CcWacomPage *page) } box = WID ("main-grid"); - gtk_container_add (GTK_CONTAINER (page), box); + gtk_box_append (GTK_BOX (page), box); gtk_widget_set_vexpand (GTK_WIDGET (box), TRUE); g_signal_connect_object (WID ("button-calibrate"), "clicked", @@ -804,7 +818,7 @@ cc_wacom_page_init (CcWacomPage *page) gtk_widget_set_halign (page->nav, GTK_ALIGN_END); gtk_widget_set_margin_start (page->nav, 10); gtk_widget_show (page->nav); - gtk_container_add (CWID ("navigation-placeholder"), page->nav); + gtk_revealer_set_child (GTK_REVEALER (WID ("navigation-placeholder")), page->nav); page->cancellable = g_cancellable_new (); } @@ -817,34 +831,34 @@ set_icon_name (CcWacomPage *page, g_autofree gchar *resource = NULL; resource = g_strdup_printf ("/org/gnome/control-center/wacom/%s.svg", icon_name); - gtk_image_set_from_resource (GTK_IMAGE (WID (widget_name)), resource); + gtk_picture_set_resource (GTK_PICTURE (WID (widget_name)), resource); } static void remove_left_handed (CcWacomPage *page) { - gtk_widget_destroy (WID ("label-left-handed")); - gtk_widget_destroy (WID ("switch-left-handed")); + gtk_grid_remove (GTK_GRID (WID ("main-controls-grid")), WID ("label-left-handed")); + gtk_grid_remove (GTK_GRID (WID ("main-controls-grid")), WID ("switch-left-handed")); } static void remove_display_link (CcWacomPage *page) { - gtk_widget_destroy (WID ("display-link")); + gtk_grid_remove (GTK_GRID (WID ("main-controls-grid")), WID ("display-link")); } static void remove_mouse_link (CcWacomPage *page) { - gtk_widget_destroy (WID ("mouse-link")); + gtk_grid_remove (GTK_GRID (WID ("main-controls-grid")), WID ("mouse-link")); } static void remove_decouple_options (CcWacomPage *page) { - gtk_widget_destroy (WID ("label-decouple-display")); - gtk_widget_destroy (WID ("switch-decouple-display")); - gtk_widget_destroy (WID ("display-mapping-button-2")); + gtk_grid_remove (GTK_GRID (WID ("main-controls-grid")), WID ("label-decouple-display")); + gtk_grid_remove (GTK_GRID (WID ("main-controls-grid")), WID ("switch-decouple-display")); + gtk_grid_remove (GTK_GRID (WID ("main-controls-grid")), WID ("display-mapping-button-2")); } static gboolean @@ -858,6 +872,17 @@ has_monitor (CcWacomPage *page) (WACOM_DEVICE_INTEGRATED_DISPLAY | WACOM_DEVICE_INTEGRATED_SYSTEM)) != 0); } +static void +set_grid_row (CcWacomPage *page, + const gchar *grid_name, + const gchar *widget_name, + gint row) +{ + GtkLayoutManager *layout_manager = gtk_widget_get_layout_manager (WID (grid_name)); + GtkLayoutChild *layout_child = gtk_layout_manager_get_layout_child (layout_manager, WID (widget_name)); + gtk_grid_layout_child_set_row (GTK_GRID_LAYOUT_CHILD (layout_child), row); +} + static void set_page_layout (CcWacomPage *page, int layout) @@ -885,18 +910,14 @@ set_page_layout (CcWacomPage *page, case LAYOUT_SCREEN: remove_left_handed (page); - gtk_widget_destroy (WID ("display-mapping-button")); + gtk_box_remove (GTK_BOX (WID ("tablet-buttons-box")), WID ("display-mapping-button")); gtk_widget_show (WID ("button-calibrate")); gtk_widget_set_sensitive (WID ("button-calibrate"), has_monitor (page)); - gtk_container_child_set (CWID ("main-controls-grid"), - WID ("label-trackingmode"), - "top_attach", 5, NULL); - gtk_container_child_set (CWID ("main-controls-grid"), - WID ("combo-tabletmode"), - "top_attach", 5, NULL); + set_grid_row (page, "main-controls-grid", "label-trackingmode", 5); + set_grid_row (page, "main-controls-grid", "combo-tabletmode", 5); break; default: g_assert_not_reached (); diff --git a/panels/wacom/cc-wacom-panel.c b/panels/wacom/cc-wacom-panel.c index 0c2b02f38..8d1660810 100644 --- a/panels/wacom/cc-wacom-panel.c +++ b/panels/wacom/cc-wacom-panel.c @@ -36,7 +36,7 @@ #include "gsd-device-manager.h" #ifdef GDK_WINDOWING_WAYLAND -#include +#include #endif #define WID(x) (GtkWidget *) gtk_builder_get_object (self->builder, x) @@ -60,6 +60,8 @@ struct _CcWacomPanel CcTabletToolMap *tablet_tool_map; + GtkGesture *stylus_gesture; + /* DBus */ GDBusProxy *proxy; }; @@ -255,6 +257,14 @@ static void cc_wacom_panel_dispose (GObject *object) { CcWacomPanel *self = CC_WACOM_PANEL (object); + CcShell *shell; + + shell = cc_panel_get_shell (CC_PANEL (self)); + if (shell) { + gtk_widget_remove_controller (GTK_WIDGET (shell), + GTK_EVENT_CONTROLLER (self->stylus_gesture)); + } + g_clear_object (&self->builder); @@ -289,9 +299,13 @@ check_remove_stylus_pages (CcWacomPanel *self) */ g_hash_table_iter_init (&iter, self->stylus_pages); while (g_hash_table_iter_next (&iter, (gpointer*) &tool, (gpointer*) &page)) { + gint page_num; + if (g_list_find (total, tool)) continue; - gtk_widget_destroy (page); + + page_num = gtk_notebook_page_num (GTK_NOTEBOOK (self->stylus_notebook), page); + gtk_notebook_remove_page (GTK_NOTEBOOK (self->stylus_notebook), page_num); g_hash_table_iter_remove (&iter); } } @@ -308,7 +322,6 @@ add_stylus (CcWacomPanel *self, page = cc_wacom_stylus_page_new (tool); cc_wacom_stylus_page_set_navigation (CC_WACOM_STYLUS_PAGE (page), GTK_NOTEBOOK (self->stylus_notebook)); - gtk_widget_show (page); gtk_notebook_append_page (GTK_NOTEBOOK (self->stylus_notebook), page, NULL); g_hash_table_insert (self->stylus_pages, tool, page); @@ -325,7 +338,7 @@ update_test_button (CcWacomPanel *self) return; if (g_hash_table_size (self->devices) == 0) { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->test_button), FALSE); + gtk_popover_popdown (GTK_POPOVER (self->test_popover)); gtk_widget_set_sensitive (self->test_button, FALSE); } else { gtk_widget_set_sensitive (self->test_button, TRUE); @@ -345,10 +358,8 @@ update_stylus_notebook (CcWacomPanel *panel, page = gtk_notebook_page_num (GTK_NOTEBOOK (panel->stylus_notebook), widget); gtk_notebook_set_current_page (GTK_NOTEBOOK (panel->stylus_notebook), page); } else { - gtk_container_child_set (GTK_CONTAINER (panel->stack), - panel->stylus_notebook, - "needs-attention", TRUE, - NULL); + GtkStackPage *page = gtk_stack_get_page (GTK_STACK (panel->stack), panel->stylus_notebook); + gtk_stack_page_set_needs_attention (page, TRUE); } } @@ -421,17 +432,18 @@ update_current_tool (CcWacomPanel *panel, wacom_device, stylus); } -static gboolean -on_shell_event_cb (CcWacomPanel *panel, - GdkEvent *event) +static void +on_stylus_proximity_cb (GtkGestureStylus *gesture, + double x, + double y, + CcWacomPanel *panel) { - if (event->type == GDK_MOTION_NOTIFY) { - update_current_tool (panel, - gdk_event_get_source_device (event), - gdk_event_get_device_tool (event)); - } + GdkDevice *device; + GdkDeviceTool *tool; - return GDK_EVENT_PROPAGATE; + device = gtk_event_controller_get_current_event_device (GTK_EVENT_CONTROLLER (gesture)); + tool = gtk_gesture_stylus_get_device_tool (gesture); + update_current_tool (panel, device, tool); } static gboolean @@ -474,29 +486,27 @@ cc_wacom_panel_constructed (GObject *object) /* Add test area button to shell header. */ shell = cc_panel_get_shell (CC_PANEL (self)); - button = gtk_toggle_button_new_with_mnemonic (_("Test Your _Settings")); - gtk_style_context_add_class (gtk_widget_get_style_context (button), - "text-button"); + button = gtk_menu_button_new (); + gtk_menu_button_set_use_underline (GTK_MENU_BUTTON (button), TRUE); + gtk_menu_button_set_label (GTK_MENU_BUTTON (button), _("Test Your _Settings")); + gtk_widget_add_css_class (button, "text-button"); gtk_widget_set_valign (button, GTK_ALIGN_CENTER); - gtk_widget_set_visible (button, TRUE); cc_shell_embed_widget_in_header (shell, button, GTK_POS_RIGHT); - self->test_popover = gtk_popover_new (button); - gtk_container_set_border_width (GTK_CONTAINER (self->test_popover), 6); + self->test_popover = gtk_popover_new (); + gtk_menu_button_set_popover (GTK_MENU_BUTTON (button), self->test_popover); self->test_draw_area = cc_drawing_area_new (); gtk_widget_set_size_request (self->test_draw_area, 400, 300); - gtk_container_add (GTK_CONTAINER (self->test_popover), - self->test_draw_area); + gtk_popover_set_child (GTK_POPOVER (self->test_popover), self->test_draw_area); gtk_widget_show (self->test_draw_area); - g_object_bind_property (button, "active", - self->test_popover, "visible", - G_BINDING_BIDIRECTIONAL); - - g_signal_connect_object (shell, "event", - G_CALLBACK (on_shell_event_cb), self, G_CONNECT_SWAPPED); + self->stylus_gesture = gtk_gesture_stylus_new (); + g_signal_connect (self->stylus_gesture, "proximity", + G_CALLBACK (on_stylus_proximity_cb), self); + gtk_widget_add_controller (GTK_WIDGET (shell), + GTK_EVENT_CONTROLLER (self->stylus_gesture)); if (g_getenv ("UMOCKDEV_DIR") != NULL) self->mock_stylus_id = g_idle_add (show_mock_stylus_cb, self); @@ -602,8 +612,9 @@ device_removed_cb (CcWacomPanel *self, page = g_hash_table_lookup (self->pages, device); if (page) { + gint page_num = gtk_notebook_page_num (GTK_NOTEBOOK (self->tablet_notebook), page); + gtk_notebook_remove_page (GTK_NOTEBOOK (self->tablet_notebook), page_num); g_hash_table_remove (self->pages, device); - gtk_widget_destroy (page); } g_hash_table_remove (self->devices, gsd_device); @@ -676,10 +687,8 @@ on_stack_visible_child_notify_cb (CcWacomPanel *panel) child = gtk_stack_get_visible_child (GTK_STACK (panel->stack)); if (child == panel->stylus_notebook) { - gtk_container_child_set (GTK_CONTAINER (panel->stack), - panel->stylus_notebook, - "needs-attention", FALSE, - NULL); + GtkStackPage *page = gtk_stack_get_page (GTK_STACK (panel->stack), panel->stylus_notebook); + gtk_stack_page_set_needs_attention (page, FALSE); } } @@ -741,22 +750,18 @@ cc_wacom_panel_init (CcWacomPanel *self) self->switcher = gtk_stack_switcher_new (); gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (self->switcher), GTK_STACK (self->stack)); - gtk_widget_show (self->switcher); - gtk_container_add (GTK_CONTAINER (self), GTK_WIDGET (self->stack)); + adw_bin_set_child (ADW_BIN (self), GTK_WIDGET (self->stack)); gtk_widget_show (self->stack); self->tablet_notebook = gtk_notebook_new (); - gtk_widget_show (self->tablet_notebook); gtk_notebook_set_show_tabs (GTK_NOTEBOOK (self->tablet_notebook), FALSE); gtk_notebook_set_show_border (GTK_NOTEBOOK (self->tablet_notebook), FALSE); gtk_widget_set_vexpand (self->tablet_notebook, TRUE); self->stylus_notebook = gtk_notebook_new (); - gtk_widget_show (self->stylus_notebook); gtk_notebook_set_show_tabs (GTK_NOTEBOOK (self->stylus_notebook), FALSE); gtk_notebook_set_show_border (GTK_NOTEBOOK (self->stylus_notebook), FALSE); - gtk_container_set_border_width (GTK_CONTAINER (self->stylus_notebook), 0); gtk_widget_set_vexpand (self->stylus_notebook, TRUE); gtk_stack_add_titled (GTK_STACK (self->stack), diff --git a/panels/wacom/cc-wacom-stylus-page.c b/panels/wacom/cc-wacom-stylus-page.c index 2fc6c5adb..5d60357a8 100644 --- a/panels/wacom/cc-wacom-stylus-page.c +++ b/panels/wacom/cc-wacom-stylus-page.c @@ -30,7 +30,6 @@ #include #define WID(x) (GtkWidget *) gtk_builder_get_object (page->builder, x) -#define CWID(x) (GtkContainer *) gtk_builder_get_object (page->builder, x) struct _CcWacomStylusPage { @@ -290,7 +289,7 @@ cc_wacom_stylus_page_init (CcWacomStylusPage *page) } box = WID ("stylus-grid"); - gtk_container_add (GTK_CONTAINER (page), box); + gtk_box_append (GTK_BOX (page), box); gtk_widget_set_vexpand (GTK_WIDGET (box), TRUE); add_marks (GTK_SCALE (WID ("scale-tip-feel"))); @@ -319,8 +318,7 @@ cc_wacom_stylus_page_init (CcWacomStylusPage *page) page->nav = cc_wacom_nav_button_new (); gtk_widget_set_halign (page->nav, GTK_ALIGN_END); gtk_widget_set_margin_start (page->nav, 10); - gtk_widget_show (page->nav); - gtk_container_add (CWID ("navigation-placeholder"), page->nav); + gtk_revealer_set_child (GTK_REVEALER (WID ("navigation-placeholder")), page->nav); } static void @@ -331,7 +329,7 @@ set_icon_name (CcWacomStylusPage *page, g_autofree gchar *resource = NULL; resource = g_strdup_printf ("/org/gnome/control-center/wacom/%s.svg", icon_name); - gtk_image_set_from_resource (GTK_IMAGE (WID (widget_name)), resource); + gtk_picture_set_resource (GTK_PICTURE (WID (widget_name)), resource); } /* Different types of layout for the stylus config */ @@ -348,25 +346,36 @@ static void remove_buttons (CcWacomStylusPage *page, int n) { if (n < 3) { - gtk_widget_destroy (WID ("combo-thirdbutton")); - gtk_widget_destroy (WID ("label-third-button")); + gtk_grid_remove (GTK_GRID (WID ("stylus-controls-grid")), WID ("combo-thirdbutton")); + gtk_grid_remove (GTK_GRID (WID ("stylus-controls-grid")), WID ("label-third-button")); } if (n < 2) { - gtk_widget_destroy (WID ("combo-topbutton")); - gtk_widget_destroy (WID ("label-top-button")); + gtk_grid_remove (GTK_GRID (WID ("stylus-controls-grid")), WID ("combo-topbutton")); + gtk_grid_remove (GTK_GRID (WID ("stylus-controls-grid")), WID ("label-top-button")); gtk_label_set_text (GTK_LABEL (WID ("label-lower-button")), _("Button")); } if (n < 1) { - gtk_widget_destroy (WID ("combo-bottombutton")); - gtk_widget_destroy (WID ("label-lower-button")); + gtk_grid_remove (GTK_GRID (WID ("stylus-controls-grid")), WID ("combo-bottombutton")); + gtk_grid_remove (GTK_GRID (WID ("stylus-controls-grid")), WID ("label-lower-button")); } } static void remove_eraser (CcWacomStylusPage *page) { - gtk_widget_destroy (WID ("eraser-box")); - gtk_widget_destroy (WID ("label-eraser-feel")); + gtk_grid_remove (GTK_GRID (WID ("stylus-controls-grid")), WID ("eraser-box")); + gtk_grid_remove (GTK_GRID (WID ("stylus-controls-grid")), WID ("label-eraser-feel")); +} + +static void +set_grid_row (CcWacomStylusPage *page, + const gchar *grid_name, + const gchar *widget_name, + gint row) +{ + GtkLayoutManager *layout_manager = gtk_widget_get_layout_manager (WID (grid_name)); + GtkLayoutChild *layout_child = gtk_layout_manager_get_layout_child (layout_manager, WID (widget_name)); + gtk_grid_layout_child_set_row (GTK_GRID_LAYOUT_CHILD (layout_child), row); } static void @@ -380,27 +389,15 @@ update_stylus_ui (CcWacomStylusPage *page, case LAYOUT_INKING: remove_buttons (page, 0); remove_eraser (page); - gtk_container_child_set (CWID ("stylus-controls-grid"), - WID ("label-tip-feel"), - "top_attach", 0, NULL); - gtk_container_child_set (CWID ("stylus-controls-grid"), - WID ("box-tip-feel"), - "top_attach", 0, NULL); + set_grid_row (page, "stylus-controls-grid", "label-tip-feel", 0); + set_grid_row (page, "stylus-controls-grid", "box-tip-feel", 0); break; case LAYOUT_AIRBRUSH: remove_buttons (page, 1); - gtk_container_child_set (CWID ("stylus-controls-grid"), - WID ("label-lower-button"), - "top_attach", 1, NULL); - gtk_container_child_set (CWID ("stylus-controls-grid"), - WID ("combo-bottombutton"), - "top_attach", 1, NULL); - gtk_container_child_set (CWID ("stylus-controls-grid"), - WID ("label-tip-feel"), - "top_attach", 2, NULL); - gtk_container_child_set (CWID ("stylus-controls-grid"), - WID ("box-tip-feel"), - "top_attach", 2, NULL); + set_grid_row (page, "stylus-controls-grid", "label-lower-button", 1); + set_grid_row (page, "stylus-controls-grid", "combo-bottombutton", 1); + set_grid_row (page, "stylus-controls-grid", "label-tip-feel", 2); + set_grid_row (page, "stylus-controls-grid", "box-tip-feel", 2); break; case LAYOUT_GENERIC_2_BUTTONS_NO_ERASER: remove_buttons (page, 2); diff --git a/panels/wacom/gnome-wacom-properties.ui b/panels/wacom/gnome-wacom-properties.ui index 8679bd26e..2527adb07 100644 --- a/panels/wacom/gnome-wacom-properties.ui +++ b/panels/wacom/gnome-wacom-properties.ui @@ -21,87 +21,57 @@ - False True - 5 Tablet Preferences False 675 460 input-tablet - dialog - + - False vertical 2 - - - False - end + + _Help False - True - True True False True - - False - False - 0 - _Close - False - True - True - True - False True - - False - False - 1 - - - False - True - end - 0 - - True - True + True True False False - True - False - True - False True True vertical + + 0 + 0 + 3 + 3 + - True False - False end True 96 @@ -111,349 +81,238 @@ - - False - True - 0 - - True - False False No tablet detected center 1 - - False - False - 1 - - True - False start True Please plug in or turn on your Wacom tablet center 0 - - False - True - 2 - - - 0 - 0 - 3 - 3 - Bluetooth Settings - False - True - True - True end end True - none + + 2 + 2 + - - 2 - 2 - - True - False Plugin - - False - - True - False 10 10 - True - False start center Wacom Tablet + + 0 + 0 + 2 + - - 0 - 0 - 2 - - - True - False + center start - wacom-tablet.svg + False + resource:///org/gnome/control-center/wacom/wacom-tablet.svg + + 0 + 1 + - - 0 - 1 - - True - False 16 vertical 10 10 + + 1 + 1 + - True - False end center Tracking Mode + + 0 + 0 + - - 0 - 0 - - True - False True liststore-tabletmode + + 1 + 0 + - - 1 - 0 - - True - False end center Left-Handed Orientation + + 0 + 1 + - - 0 - 1 - - False - True - True start center + + 1 + 1 + - - 1 - 1 - - True start 10 + + 1 + 2 + Map to Monitor… - False - True - True - True - - end - 0 - Map Buttons… - False False - True - True - - end - 1 - Calibrate… - False - True - True - - end - 2 - - - 1 - 2 - Adjust mouse settings - False - True - True - True start start - none + + 1 + 3 + - - 1 - 3 - Adjust display resolution - False - True - True - True start start - none + + 1 + 3 + - - 1 - 3 - - True - False end center Decouple Display + + 0 + 4 + - - 0 - 4 - - True - True start center True + + 1 + 4 + - - 1 - 4 - Map to Monitor… - False - True - True - True start + + 1 + 6 + - - 1 - 6 - - - 1 - 1 - - True - False end crossfade 100 - - - + + 1 + 0 + - - 1 - 0 - - - 1 - - True - False Wacom - - 1 - False - - - True - True - 1 - diff --git a/panels/wacom/gsd-wacom-key-shortcut-button.c b/panels/wacom/gsd-wacom-key-shortcut-button.c index fcc531372..aa15b0f84 100644 --- a/panels/wacom/gsd-wacom-key-shortcut-button.c +++ b/panels/wacom/gsd-wacom-key-shortcut-button.c @@ -60,8 +60,6 @@ struct _GsdWacomKeyShortcutButton gboolean editing_mode; - GdkSeat *grab_seat; - guint keyval; guint keycode; GdkModifierType mods; @@ -168,40 +166,15 @@ static void gsd_wacom_key_shortcut_set_editing_mode (GsdWacomKeyShortcutButton *self, GdkEvent *event) { - GdkWindow *window; - GdkSeat *seat; - self->editing_mode = TRUE; gsd_wacom_key_shortcut_button_changed (self); - - window = gtk_widget_get_window (GTK_WIDGET (self)); - - g_return_if_fail (window != NULL); - - seat = gdk_event_get_seat (event); - - if (gdk_seat_grab (seat, window, GDK_SEAT_CAPABILITY_ALL, - FALSE, NULL, event, NULL, NULL) != GDK_GRAB_SUCCESS) - return; - gtk_widget_grab_focus (GTK_WIDGET (self)); - - self->grab_seat = seat; } static void gsd_wacom_key_shortcut_remove_editing_mode (GsdWacomKeyShortcutButton *self) { self->editing_mode = FALSE; - - self->editing_mode = FALSE; - - if (self->grab_seat) - { - gdk_seat_ungrab (self->grab_seat); - self->grab_seat = NULL; - } - self->tmp_shortcut_keyval = 0; self->tmp_shortcut_mods = 0; self->tmp_shortcut_time = 0; @@ -241,22 +214,10 @@ gsd_wacom_key_shortcut_button_activate (GtkButton *self) GTK_BUTTON_CLASS (gsd_wacom_key_shortcut_button_parent_class)->activate (self); } -static void -gsd_wacom_key_shortcut_button_init (GsdWacomKeyShortcutButton *self) -{ - gtk_button_set_relief (GTK_BUTTON (self), GTK_RELIEF_NONE); - - self->cancel_keyval = DEFAULT_CANCEL_KEY; - self->clear_keyval = DEFAULT_CLEAR_KEY; -} - static void key_shortcut_finished_editing (GsdWacomKeyShortcutButton *self, guint32 time) { - gdk_seat_ungrab (self->grab_seat); - self->grab_seat = NULL; - self->editing_mode = FALSE; gsd_wacom_key_shortcut_remove_editing_mode (self); @@ -265,17 +226,14 @@ key_shortcut_finished_editing (GsdWacomKeyShortcutButton *self, } static gboolean -gsd_wacom_key_shortcut_button_key_release (GtkWidget *widget, - GdkEventKey *event) +gsd_wacom_key_shortcut_button_key_released_cb (GtkEventController *controller, + guint keyval, + guint keycode, + GdkModifierType state, + GsdWacomKeyShortcutButton *self) { - GsdWacomKeyShortcutButton *self = GSD_WACOM_KEY_SHORTCUT_BUTTON (widget); - if (self->tmp_shortcut_keyval == 0) - { - GTK_WIDGET_CLASS (gsd_wacom_key_shortcut_button_parent_class)->key_release_event (widget, event); - - return FALSE; - } + return FALSE; self->keyval = self->tmp_shortcut_keyval; self->mods = self->tmp_shortcut_mods; @@ -288,36 +246,34 @@ gsd_wacom_key_shortcut_button_key_release (GtkWidget *widget, } static gboolean -gsd_wacom_key_shortcut_button_key_press (GtkWidget *widget, - GdkEventKey *event) +gsd_wacom_key_shortcut_button_key_pressed_cb (GtkEventController *controller, + guint keyval, + guint keycode, + GdkModifierType state, + GsdWacomKeyShortcutButton *self) { /* This code is based on the gtk_cell_renderer_accel_start_editing */ - GsdWacomKeyShortcutButton *self = GSD_WACOM_KEY_SHORTCUT_BUTTON (widget); GdkModifierType mods = 0; + GdkEvent *event; guint shortcut_keyval; - guint keyval; gboolean edited; gboolean cleared; + event = gtk_event_controller_get_current_event (controller); + /* GTK and OTHER modes don't allow modifier keyvals */ - if (event->is_modifier && self->mode != GSD_WACOM_KEY_SHORTCUT_BUTTON_MODE_ALL) + if (gdk_key_event_is_modifier (event) && self->mode != GSD_WACOM_KEY_SHORTCUT_BUTTON_MODE_ALL) return TRUE; if (!self->editing_mode) - { - GTK_WIDGET_CLASS (gsd_wacom_key_shortcut_button_parent_class)->key_press_event (widget, event); - - return FALSE; - } + return FALSE; edited = FALSE; cleared = FALSE; - mods = event->state; + mods = state; - keyval = event->keyval; - if (keyval == GDK_KEY_Sys_Req && - (mods & GDK_MOD1_MASK) != 0) + if (keyval == GDK_KEY_Sys_Req && (mods & GDK_ALT_MASK) != 0) { /* HACK: we don't want to use SysRq as a keybinding (but we do * want Alt+Print), so we avoid translation from Alt+Print to SysRq @@ -356,7 +312,7 @@ gsd_wacom_key_shortcut_button_key_press (GtkWidget *widget, self->tmp_shortcut_mods = 0; self->tmp_shortcut_time = 0; - if (event->is_modifier) + if (gdk_key_event_is_modifier (event)) { /* when the user presses a non-modifier key, it readily assigns the * shortcut but since we also support modifiers-only shortcuts, we @@ -366,7 +322,7 @@ gsd_wacom_key_shortcut_button_key_press (GtkWidget *widget, * it is a modifier shortcut and assign them when a key-release happens */ self->tmp_shortcut_keyval = shortcut_keyval; self->tmp_shortcut_mods = mods; - self->tmp_shortcut_time = event->time; + self->tmp_shortcut_time = gtk_event_controller_get_current_event_time (controller); return TRUE; } @@ -387,7 +343,7 @@ gsd_wacom_key_shortcut_button_key_press (GtkWidget *widget, self->mods = 0; } - key_shortcut_finished_editing (GSD_WACOM_KEY_SHORTCUT_BUTTON (widget), event->time); + key_shortcut_finished_editing (self, gtk_event_controller_get_current_event_time (controller)); if (edited) g_signal_emit (self, signals[KEY_SHORTCUT_EDITED], 0); @@ -397,23 +353,15 @@ gsd_wacom_key_shortcut_button_key_press (GtkWidget *widget, return TRUE; } -static gboolean -gsd_wacom_key_shortcut_button_button_press (GtkWidget *widget, - GdkEventButton *event) +static void +gsd_wacom_key_shortcut_button_button_pressed_cb (GtkGestureClick *gesture, + gint n_press, + gdouble x, + gdouble y, + GsdWacomKeyShortcutButton *self) { - GsdWacomKeyShortcutButton *self; - - self = GSD_WACOM_KEY_SHORTCUT_BUTTON (widget); - - if (self->editing_mode) - return TRUE; - - gsd_wacom_key_shortcut_set_editing_mode (self, NULL); - - GTK_WIDGET_CLASS (gsd_wacom_key_shortcut_button_parent_class)->button_press_event (widget, - event); - - return TRUE; + if (!self->editing_mode) + gsd_wacom_key_shortcut_set_editing_mode (self, NULL); } static void @@ -499,9 +447,6 @@ gsd_wacom_key_shortcut_button_class_init (GsdWacomKeyShortcutButtonClass *klass) N_PROPERTIES, obj_properties); - widget_class->key_press_event = gsd_wacom_key_shortcut_button_key_press; - widget_class->button_press_event = gsd_wacom_key_shortcut_button_button_press; - widget_class->key_release_event = gsd_wacom_key_shortcut_button_key_release; widget_class->unrealize = gsd_wacom_key_shortcut_button_unrealize; button_class->activate = gsd_wacom_key_shortcut_button_activate; @@ -538,6 +483,25 @@ gsd_wacom_key_shortcut_button_class_init (GsdWacomKeyShortcutButtonClass *klass) G_TYPE_NONE, 0); } +static void +gsd_wacom_key_shortcut_button_init (GsdWacomKeyShortcutButton *self) +{ + GtkEventController *controller; + GtkGesture *gesture; + + self->cancel_keyval = DEFAULT_CANCEL_KEY; + self->clear_keyval = DEFAULT_CLEAR_KEY; + + controller = gtk_event_controller_key_new (); + g_signal_connect (controller, "key-pressed", G_CALLBACK (gsd_wacom_key_shortcut_button_key_pressed_cb), self); + g_signal_connect (controller, "key-released", G_CALLBACK (gsd_wacom_key_shortcut_button_key_released_cb), self); + gtk_widget_add_controller (GTK_WIDGET (self), controller); + + gesture = gtk_gesture_click_new (); + g_signal_connect (gesture, "pressed", G_CALLBACK (gsd_wacom_key_shortcut_button_button_pressed_cb), self); + gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (gesture)); +} + /** * gsd_wacom_key_shortcut_button_new: * diff --git a/panels/wacom/meson.build b/panels/wacom/meson.build index 5f6222071..30bbb6b04 100644 --- a/panels/wacom/meson.build +++ b/panels/wacom/meson.build @@ -1,5 +1,5 @@ -deps = wacom_deps + [ - gnome_desktop_dep, +deps = common_deps + wacom_deps + [ + gnome_rr_dep, gnome_settings_dep, x11_dep, xi_dep diff --git a/panels/wacom/test-wacom.c b/panels/wacom/test-wacom.c index a8d4f6948..97803a12f 100644 --- a/panels/wacom/test-wacom.c +++ b/panels/wacom/test-wacom.c @@ -43,16 +43,6 @@ add_page (GList *devices, gtk_widget_show (widget); } -static gboolean -delete_event_cb (GtkWidget *widget, - GdkEvent *event, - gpointer user_data) -{ - gtk_main_quit (); - - return FALSE; -} - static GList * create_fake_cintiq (void) { @@ -122,19 +112,16 @@ int main (int argc, char **argv) bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); - gtk_init (&argc, &argv); + gtk_init (); - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + window = gtk_window_new (); gtk_window_set_resizable (GTK_WINDOW (window), FALSE); gtk_window_set_default_size (GTK_WINDOW (window), FIXED_WIDTH, -1); - g_signal_connect (G_OBJECT (window), "delete-event", - G_CALLBACK (delete_event_cb), NULL); notebook = gtk_notebook_new (); gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE); gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE); gtk_widget_set_vexpand (notebook, TRUE); - gtk_container_set_border_width (GTK_CONTAINER (notebook), 24); - gtk_container_add (GTK_CONTAINER (window), notebook); + gtk_window_set_child (GTK_WINDOW (window), notebook); gtk_widget_show (notebook); devices = create_fake_intuos4 (); @@ -154,7 +141,8 @@ int main (int argc, char **argv) gtk_widget_show (window); - gtk_main (); + while (g_list_model_get_n_items (gtk_window_get_toplevels ()) > 0) + g_main_context_iteration (NULL, TRUE); return 0; } diff --git a/panels/wacom/wacom-stylus-page.ui b/panels/wacom/wacom-stylus-page.ui index 133f3c8fb..91d3e70c9 100644 --- a/panels/wacom/wacom-stylus-page.ui +++ b/panels/wacom/wacom-stylus-page.ui @@ -44,19 +44,13 @@ stylus-notebook - True - True False False - True - False vertical - True - False end True 96 @@ -66,28 +60,14 @@ - - False - True - 0 - - True - False No stylus found - - False - True - 1 - - True - False start True Please move your stylus to the proximity of the tablet to configure it @@ -95,323 +75,242 @@ True 30 - - False - True - 2 - - True - False True 10 10 - True - False start center Stylus + + 0 + 0 + 2 + - - 0 - 0 - 2 - - - True - False + end start - wacom-stylus.svg + False + resource:///org/gnome/control-center/wacom/wacom-stylus.svg + + 0 + 1 + - - 0 - 1 - - True - False 16 12 True vertical 6 10 + + 1 + 1 + - True - False end center Eraser Pressure Feel right + + 0 + 0 + - - 0 - 0 - - True - False True 10 + + 1 + 0 + - True - False Soft - - False - True - 0 - - True - True center + True adjustment-eraser-feel 0 False 0 - - True - True - 1 - - True - False Firm - - False - True - 2 - - - 1 - 0 - - True - False end center Top Button right + + 0 + 1 + - - 0 - 1 - - True - False center liststore-buttons + + 1 + 1 + - - 1 - 1 - - True - False end center Lower Button right + + 0 + 2 + - - 0 - 2 - - True - False center liststore-buttons + + 1 + 2 + - - 1 - 2 - - True - False end center Lowest Button right + + 0 + 3 + - - 0 - 3 - - True - False center liststore-buttons + + 1 + 3 + - - 1 - 3 - - True - False end center Tip Pressure Feel right + + 0 + 4 + - - 0 - 4 - - True - False 10 + + 1 + 4 + - True - False Soft - - False - True - 0 - - True - True True adjustment-tip-feel 0 False 0 - - True - True - 1 - - True - False Firm - - False - True - 2 - - - 1 - 4 - - - 1 - 1 - - True - False end crossfade 100 - - - + + 1 + 0 + - - 1 - 0 - - - 1 - diff --git a/shell/cc-panel-loader.c b/shell/cc-panel-loader.c index a3622ef86..31db92748 100644 --- a/shell/cc-panel-loader.c +++ b/shell/cc-panel-loader.c @@ -63,7 +63,7 @@ extern GType cc_bolt_panel_get_type (void); extern GType cc_ua_panel_get_type (void); //extern GType cc_user_panel_get_type (void); #ifdef BUILD_WACOM -//extern GType cc_wacom_panel_get_type (void); +extern GType cc_wacom_panel_get_type (void); #endif /* BUILD_WACOM */ #ifdef BUILD_WWAN //extern GType cc_wwan_panel_get_type (void); @@ -81,7 +81,7 @@ extern void cc_diagnostics_panel_static_init_func (void); //extern void cc_wifi_panel_static_init_func (void); #endif /* BUILD_NETWORK */ #ifdef BUILD_WACOM -//extern void cc_wacom_panel_static_init_func (void); +extern void cc_wacom_panel_static_init_func (void); #endif /* BUILD_WACOM */ #ifdef BUILD_WWAN //extern void cc_wwan_panel_static_init_func (void); @@ -135,7 +135,7 @@ static CcPanelLoaderVtable default_panels[] = PANEL_TYPE("usage", cc_usage_panel_get_type, NULL), //PANEL_TYPE("user-accounts", cc_user_panel_get_type, NULL), #ifdef BUILD_WACOM - //PANEL_TYPE("wacom", cc_wacom_panel_get_type, cc_wacom_panel_static_init_func), + PANEL_TYPE("wacom", cc_wacom_panel_get_type, cc_wacom_panel_static_init_func), #endif #ifdef BUILD_WWAN //PANEL_TYPE("wwan", cc_wwan_panel_get_type, cc_wwan_panel_static_init_func),