wacom: Port to GTK4
Many part of this commit were made by Carlos Garnacho <carlosg@gnome.org> WIP wacom: Port to GTK4 Lots of stuff missing and probably broken. wacom: Port CcDrawingArea input to gestures We have a handy GtkGestureStylus to use here, which avoids direct handling of GdkEvents. wacom: Update current stylus tracking to GtkGestureStylus Use the ::proximity signal to notice when we are being hovered with a tablet stylus, and look up the tool from there.
This commit is contained in:
parent
f598fb3ed6
commit
816e6203e3
23 changed files with 564 additions and 1000 deletions
|
@ -39,7 +39,7 @@ if host_is_linux_not_s390
|
|||
panels += [
|
||||
'bluetooth',
|
||||
'thunderbolt',
|
||||
# 'wacom'
|
||||
'wacom'
|
||||
]
|
||||
endif
|
||||
|
||||
|
|
|
@ -4,141 +4,73 @@
|
|||
<object class="GtkDialog" id="button-mapping-dialog">
|
||||
<property name="width_request">600</property>
|
||||
<property name="height_request">450</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">5</property>
|
||||
<property name="title" translatable="yes">Map Buttons</property>
|
||||
<property name="resizable">False</property>
|
||||
<property name="modal">True</property>
|
||||
<property name="default_width">600</property>
|
||||
<property name="default_height">450</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<child internal-child="vbox">
|
||||
<child>
|
||||
<object class="GtkBox" id="top_vbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkButtonBox" id="dialog-action_area1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="close_button">
|
||||
<property name="label" translatable="yes">_Close</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkVBox" id="shortcuts_vbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<object class="GtkBox" id="shortcuts_vbox">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">6</property>
|
||||
<property name="expand">True</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="ypad">12</property>
|
||||
<property name="margin-top">12</property>
|
||||
<property name="label" translatable="yes">Map buttons to functions</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTable" id="table11">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="column_spacing">5</property>
|
||||
<object class="GtkScrolledWindow" id="actions_swindow">
|
||||
<property name="hscrollbar_policy">never</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="actions_swindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">never</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<child>
|
||||
<object class="GtkListBox" id="shortcuts_list">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<object class="GtkListBox" id="shortcuts_list">
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">5</property>
|
||||
<object class="GtkBox" id="hbox1">
|
||||
<property name="margin-top">5</property>
|
||||
<property name="margin-bottom">5</property>
|
||||
<property name="margin-start">5</property>
|
||||
<property name="margin-end">5</property>
|
||||
<property name="spacing">12</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label12">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">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.</property>
|
||||
<property name="justify">fill</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButtonBox" id="dialog-action_area1">
|
||||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="close_button">
|
||||
<property name="label" translatable="yes">_Close</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <gdk/gdkx.h>
|
||||
#include <gdk/x11/gdkx.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -5,46 +5,39 @@
|
|||
<property name="name">calibrator</property>
|
||||
<child>
|
||||
<object class="GtkStack" id="stack">
|
||||
<property name="visible">True</property>
|
||||
<property name="transition_duration">0</property>
|
||||
<child>
|
||||
<object class="GtkGrid">
|
||||
<property name="visible">True</property>
|
||||
<property name="row_homogeneous">True</property>
|
||||
<property name="column_homogeneous">True</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">0</property>
|
||||
<property name="column-span">8</property>
|
||||
<property name="row-span">8</property>
|
||||
</layout>
|
||||
<child>
|
||||
<object class="GtkBox" id="box1">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="vexpand">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="CcClock" id="clock">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
<object class="CcClock" id="clock" />
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="box2">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="vexpand">True</property>
|
||||
<child>
|
||||
<object class="GtkRevealer" id="title_revealer">
|
||||
<property name="visible">True</property>
|
||||
<property name="transition_duration">300</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="name">title</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Screen Calibration</property>
|
||||
</object>
|
||||
</child>
|
||||
|
@ -52,143 +45,117 @@
|
|||
</child>
|
||||
<child>
|
||||
<object class="GtkRevealer" id="subtitle_revealer">
|
||||
<property name="visible">True</property>
|
||||
<property name="transition_duration">300</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="name">subtitle</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Please tap the target markers as they appear on screen to calibrate the tablet.</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRevealer" id="error_revealer">
|
||||
<property name="visible">True</property>
|
||||
<property name="transition_type">crossfade</property>
|
||||
<property name="transition_duration">500</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="name">error</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Mis-click detected, restarting…</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="width">8</property>
|
||||
<property name="height">8</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEventBox" id="target1">
|
||||
<property name="name">target</property>
|
||||
<property name="width_request">100</property>
|
||||
<property name="height_request">100</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="visible_window">True</property>
|
||||
<property name="visible_window">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">0</property>
|
||||
<property name="column-span">2</property>
|
||||
<property name="row-span">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="width">2</property>
|
||||
<property name="height">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEventBox" id="target2">
|
||||
<property name="name">target</property>
|
||||
<property name="width_request">100</property>
|
||||
<property name="height_request">100</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="visible_window">True</property>
|
||||
<property name="visible_window">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<layout>
|
||||
<property name="column">6</property>
|
||||
<property name="row">0</property>
|
||||
<property name="column-span">2</property>
|
||||
<property name="row-span">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">6</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="width">2</property>
|
||||
<property name="height">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEventBox" id="target3">
|
||||
<property name="name">target</property>
|
||||
<property name="width_request">100</property>
|
||||
<property name="height_request">100</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="visible_window">True</property>
|
||||
<property name="visible_window">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">6</property>
|
||||
<property name="column-span">2</property>
|
||||
<property name="row-span">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">6</property>
|
||||
<property name="width">2</property>
|
||||
<property name="height">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEventBox" id="target4">
|
||||
<property name="name">target</property>
|
||||
<property name="width_request">100</property>
|
||||
<property name="height_request">100</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="visible_window">True</property>
|
||||
<property name="visible_window">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<layout>
|
||||
<property name="column">6</property>
|
||||
<property name="row">6</property>
|
||||
<property name="column-span">2</property>
|
||||
<property name="row-span">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">6</property>
|
||||
<property name="top_attach">6</property>
|
||||
<property name="width">2</property>
|
||||
<property name="height">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRevealer">
|
||||
<property name="visible">True</property>
|
||||
<property name="transition_type">none</property>
|
||||
<property name="transition_duration">0</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">0</property>
|
||||
<property name="column-span">8</property>
|
||||
<property name="row-span">8</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="width">8</property>
|
||||
<property name="height">8</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<layout>
|
||||
<property name="name">page0</property>
|
||||
</packing>
|
||||
</layout>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixel_size">300</property>
|
||||
<property name="icon_name">emblem-ok-symbolic</property>
|
||||
</object>
|
||||
<packing>
|
||||
<layout>
|
||||
<property name="name">page1</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</layout>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
|
|
@ -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 *
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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 *
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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));
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "gsd-device-manager.h"
|
||||
|
||||
#define GNOME_DESKTOP_USE_UNSTABLE_API
|
||||
#include <libgnome-desktop/gnome-rr.h>
|
||||
#include <gnome-rr/gnome-rr.h>
|
||||
|
||||
#define CC_TYPE_WACOM_DEVICE (cc_wacom_device_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (CcWacomDevice, cc_wacom_device, CC, WACOM_DEVICE, GObject)
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
#include <gtk/gtk.h>
|
||||
#include <glib/gi18n.h>
|
||||
#define GNOME_DESKTOP_USE_UNSTABLE_API
|
||||
#include <libgnome-desktop/gnome-rr.h>
|
||||
#include <libgnome-desktop/gnome-rr-config.h>
|
||||
#include <gnome-rr/gnome-rr.h>
|
||||
#include <gnome-rr/gnome-rr-config.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
@ -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 *
|
||||
|
|
|
@ -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 *
|
||||
|
|
|
@ -29,10 +29,10 @@
|
|||
#include <gtk/gtk.h>
|
||||
#include <gdesktop-enums.h>
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
#include <gdk/gdkx.h>
|
||||
#include <gdk/x11/gdkx.h>
|
||||
#endif
|
||||
#ifdef GDK_WINDOWING_WAYLAND
|
||||
#include <gdk/gdkwayland.h>
|
||||
#include <gdk/wayland/gdkwayland.h>
|
||||
#endif
|
||||
|
||||
#include "cc-wacom-device.h"
|
||||
|
@ -48,7 +48,6 @@
|
|||
#include <string.h>
|
||||
|
||||
#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 ();
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#include "gsd-device-manager.h"
|
||||
|
||||
#ifdef GDK_WINDOWING_WAYLAND
|
||||
#include <gdk/gdkwayland.h>
|
||||
#include <gdk/wayland/gdkwayland.h>
|
||||
#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),
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include <string.h>
|
||||
|
||||
#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);
|
||||
|
|
|
@ -21,87 +21,57 @@
|
|||
</data>
|
||||
</object>
|
||||
<object class="GtkDialog" id="wacom_properties_dialog">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="border_width">5</property>
|
||||
<property name="title" translatable="yes">Tablet Preferences</property>
|
||||
<property name="resizable">False</property>
|
||||
<property name="default_width">675</property>
|
||||
<property name="default_height">460</property>
|
||||
<property name="icon_name">input-tablet</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<child internal-child="vbox">
|
||||
<child>
|
||||
<object class="GtkBox" id="dialog-vbox1">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkButtonBox" id="dialog-action_area1">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="dialog-action_area1">
|
||||
<child>
|
||||
<object class="GtkButton" id="helpbutton1">
|
||||
<property name="label" translatable="yes">_Help</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="closebutton1">
|
||||
<property name="label" translatable="yes">_Close</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkNotebook" id="main-notebook">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="show_tabs">False</property>
|
||||
<property name="show_border">False</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="main-box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">0</property>
|
||||
<property name="column-span">3</property>
|
||||
<property name="row-span">3</property>
|
||||
</layout>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">end</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="pixel_size">96</property>
|
||||
|
@ -111,349 +81,238 @@
|
|||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="advice-label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="vexpand">False</property>
|
||||
<property name="label" translatable="yes">No tablet detected</property>
|
||||
<property name="justify">center</property>
|
||||
<property name="yalign">1</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="advice-label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="label" translatable="yes">Please plug in or turn on your Wacom tablet</property>
|
||||
<property name="justify">center</property>
|
||||
<property name="yalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="width">3</property>
|
||||
<property name="height">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLinkButton" id="linkbutton">
|
||||
<property name="label" translatable="yes">Bluetooth Settings</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">end</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="relief">none</property>
|
||||
<layout>
|
||||
<property name="column">2</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="tab">
|
||||
<object class="GtkLabel" id="label4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label">Plugin</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="tab_fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid" id="main-grid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="row_spacing">10</property>
|
||||
<property name="column_spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label-tabletmodel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="label" translatable="yes">Wacom Tablet</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">0</property>
|
||||
<property name="column-span">2</property>
|
||||
</layout>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="width">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage" id="image-tablet">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<object class="GtkPicture" id="image-tablet">
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="pixbuf">wacom-tablet.svg</property>
|
||||
<property name="can-shrink">False</property>
|
||||
<property name="file">resource:///org/gnome/control-center/wacom/wacom-tablet.svg</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid" id="main-controls-grid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_start">16</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="row_spacing">10</property>
|
||||
<property name="column_spacing">10</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label-trackingmode">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="label" translatable="yes">Tracking Mode</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">0</property>
|
||||
</layout>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="combo-tabletmode">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="model">liststore-tabletmode</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label-left-handed">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="label" translatable="yes">Left-Handed Orientation</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="switch-left-handed">
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">center</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="tablet-buttons-box">
|
||||
<property name="visible">True</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="spacing">10</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
<child>
|
||||
<object class="GtkButton" id="display-mapping-button">
|
||||
<property name="label" translatable="yes">Map to Monitor…</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="map-buttons-button">
|
||||
<property name="label" translatable="yes">Map Buttons…</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button-calibrate">
|
||||
<property name="label" translatable="yes">Calibrate…</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLinkButton" id="mouse-link">
|
||||
<property name="label" translatable="yes">Adjust mouse settings</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="relief">none</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLinkButton" id="display-link">
|
||||
<property name="label" translatable="yes">Adjust display resolution</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="relief">none</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label-decouple-display">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="label" translatable="yes">Decouple Display</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">4</property>
|
||||
</layout>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="switch-decouple-display">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="active">True</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">4</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="display-mapping-button-2">
|
||||
<property name="label" translatable="yes">Map to Monitor…</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="halign">start</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">6</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRevealer" id="navigation-placeholder">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="transition_type">crossfade</property>
|
||||
<property name="transition_duration">100</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child type="tab">
|
||||
<object class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label">Wacom</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
<property name="tab_fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
|
|
@ -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:
|
||||
*
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -44,19 +44,13 @@
|
|||
</object>
|
||||
<object class="GtkNotebook" id="stylus-notebook">
|
||||
<property name="name">stylus-notebook</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="show_tabs">False</property>
|
||||
<property name="show_border">False</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="no-stylus-page">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">end</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="pixel_size">96</property>
|
||||
|
@ -66,28 +60,14 @@
|
|||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="no-stylus-label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">No stylus found</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="label" translatable="yes">Please move your stylus to the proximity of the tablet to configure it</property>
|
||||
|
@ -95,323 +75,242 @@
|
|||
<property name="wrap">True</property>
|
||||
<property name="width_chars">30</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid" id="stylus-grid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="row_spacing">10</property>
|
||||
<property name="column_spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label-stylus">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="label" translatable="yes">Stylus</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">0</property>
|
||||
<property name="column-span">2</property>
|
||||
</layout>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="width">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage" id="image-stylus">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<object class="GtkPicture" id="image-stylus">
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="pixbuf">wacom-stylus.svg</property>
|
||||
<property name="can-shrink">False</property>
|
||||
<property name="file">resource:///org/gnome/control-center/wacom/wacom-stylus.svg</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid" id="stylus-controls-grid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_start">16</property>
|
||||
<property name="margin_top">12</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<property name="column_spacing">10</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label-eraser-feel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="label" translatable="yes">Eraser Pressure Feel</property>
|
||||
<property name="justify">right</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">0</property>
|
||||
</layout>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="eraser-box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="spacing">10</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">0</property>
|
||||
</layout>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label-eraser-soft">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Soft</property>
|
||||
<attributes>
|
||||
<attribute name="scale" value="0.82999999999999996"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScale" id="scale-eraser-feel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="adjustment">adjustment-eraser-feel</property>
|
||||
<property name="digits">0</property>
|
||||
<property name="draw_value">False</property>
|
||||
<property name="round_digits">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label-eraser-firm">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Firm</property>
|
||||
<attributes>
|
||||
<attribute name="scale" value="0.82999999999999996"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label-top-button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="label" translatable="yes">Top Button</property>
|
||||
<property name="justify">right</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="combo-topbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="model">liststore-buttons</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label-lower-button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="label" translatable="yes">Lower Button</property>
|
||||
<property name="justify">right</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="combo-bottombutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="model">liststore-buttons</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label-third-button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="label" translatable="yes">Lowest Button</property>
|
||||
<property name="justify">right</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">3</property>
|
||||
</layout>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="combo-thirdbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="model">liststore-buttons</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label-tip-feel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="label" translatable="yes">Tip Pressure Feel</property>
|
||||
<property name="justify">right</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">4</property>
|
||||
</layout>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="box-tip-feel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">10</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">4</property>
|
||||
</layout>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label-tip-soft">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Soft</property>
|
||||
<attributes>
|
||||
<attribute name="scale" value="0.82999999999999996"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScale" id="scale-tip-feel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="adjustment">adjustment-tip-feel</property>
|
||||
<property name="digits">0</property>
|
||||
<property name="draw_value">False</property>
|
||||
<property name="round_digits">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label-tip-firm">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Firm</property>
|
||||
<attributes>
|
||||
<attribute name="scale" value="0.82999999999999996"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRevealer" id="navigation-placeholder">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="transition_type">crossfade</property>
|
||||
<property name="transition_duration">100</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
|
|
|
@ -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),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue