Commit a4cc9d35 authored by Carlos Garnacho's avatar Carlos Garnacho Committed by Georges Basile Stavracas Neto

wacom: Always try to add the stylus page UI on proximity

This used to be done only if the stylus was "brand new", because pages for
previously known styli are added when the tablet is detected/plugged. There
are however situations where this may break: eg. the stylus was previously
known through a tablet that is not plugged ATM. The tool is however "not
new" so no UI is added for it.

We should try to add the stylus invariably on proximity, add_stylus_page()
ensures there is only one page per tool anyway.

Closes: GNOME/gnome-control-center#315
parent 2e250f9d
......@@ -346,6 +346,7 @@ update_current_tool (CcWacomPanel *panel,
CcWacomTool *stylus;
GsdDevice *gsd_device;
guint64 serial, id;
gboolean added;
if (!tool)
return;
......@@ -375,8 +376,6 @@ update_current_tool (CcWacomPanel *panel,
wacom_device, serial);
if (!stylus) {
gboolean added;
id = gdk_device_tool_get_hardware_id (tool);
/* The wacom driver sends a hw id of 0x2 for stylus and 0xa
......@@ -395,24 +394,24 @@ update_current_tool (CcWacomPanel *panel,
stylus = cc_wacom_tool_new (serial, id, wacom_device);
if (!stylus)
return;
}
added = add_stylus (panel, stylus);
added = add_stylus (panel, stylus);
if (added) {
if (panel->stylus_notebook ==
gtk_stack_get_visible_child (GTK_STACK (panel->stack))) {
GtkWidget *widget;
gint page;
if (added) {
if (panel->stylus_notebook ==
gtk_stack_get_visible_child (GTK_STACK (panel->stack))) {
GtkWidget *widget;
gint page;
widget = g_hash_table_lookup (panel->stylus_pages, stylus);
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);
}
widget = g_hash_table_lookup (panel->stylus_pages, stylus);
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);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment