summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Fourdan <fourdan@xfce.org>2020-10-31 11:42:45 +0100
committerOlivier Fourdan <fourdan@xfce.org>2020-10-31 22:03:07 +0100
commit39eb0435df51d30a88c01677a85ffe90256ad819 (patch)
treefbdc8fee5ae8fdb06a3973b2a44983ec9e731530
parente5502ad4aff7f7e10e4aeecc21927dbdd563ed66 (diff)
downloadxfwm4-39eb0435df51d30a88c01677a85ffe90256ad819.tar.gz
compositor: Make cursor zoom optional
Xfwm4 4.14 made the cursor zoom along with the desktop. While this sounds like a sensible thing to do, it's not necessarily an improvement for accessibility, because an enlarged cursor also hides what's being zoomed underneath. Add a new option to control whether the pointer is zoomed along with the rest of the desktop. Signed-off-by: Olivier Fourdan <fourdan@xfce.org> Closes: https://gitlab.xfce.org/xfce/xfwm4/-/issues/439
-rw-r--r--defaults/defaults1
-rw-r--r--settings-dialogs/tweaks-settings.c5
-rw-r--r--settings-dialogs/xfwm4-tweaks-dialog.glade34
-rw-r--r--src/compositor.c28
-rw-r--r--src/screen.h1
-rw-r--r--src/settings.c7
-rw-r--r--src/settings.h1
7 files changed, 60 insertions, 17 deletions
diff --git a/defaults/defaults b/defaults/defaults
index 38d34704b..930beb983 100644
--- a/defaults/defaults
+++ b/defaults/defaults
@@ -77,3 +77,4 @@ wrap_resistance=10
wrap_windows=true
wrap_workspaces=false
zoom_desktop=true
+zoom_pointer=true
diff --git a/settings-dialogs/tweaks-settings.c b/settings-dialogs/tweaks-settings.c
index d5f711be6..a8efafd09 100644
--- a/settings-dialogs/tweaks-settings.c
+++ b/settings-dialogs/tweaks-settings.c
@@ -215,6 +215,7 @@ wm_tweaks_dialog_configure_widgets (GtkBuilder *builder)
GtkWidget *show_frame_shadow_check = GTK_WIDGET (gtk_builder_get_object (builder, "show_frame_shadow_check"));
GtkWidget *show_popup_shadow_check = GTK_WIDGET (gtk_builder_get_object (builder, "show_popup_shadow_check"));
GtkWidget *show_dock_shadow_check = GTK_WIDGET (gtk_builder_get_object (builder, "show_dock_shadow_check"));
+ GtkWidget *zoom_pointer_check = GTK_WIDGET (gtk_builder_get_object (builder, "zoom_pointer_check"));
GtkWidget *frame_opacity_scale = GTK_WIDGET (gtk_builder_get_object (builder, "frame_opacity_scale"));
GtkWidget *inactive_opacity_scale = GTK_WIDGET (gtk_builder_get_object (builder, "inactive_opacity_scale"));
@@ -425,6 +426,10 @@ wm_tweaks_dialog_configure_widgets (GtkBuilder *builder)
G_TYPE_BOOLEAN,
(GObject *)show_dock_shadow_check, "active");
xfconf_g_property_bind (xfwm4_channel,
+ "/general/zoom_pointer",
+ G_TYPE_BOOLEAN,
+ (GObject *)zoom_pointer_check, "active");
+ xfconf_g_property_bind (xfwm4_channel,
"/general/frame_opacity",
G_TYPE_INT,
(GObject *) range_debouncer_bind (GTK_RANGE (frame_opacity_scale)), "value");
diff --git a/settings-dialogs/xfwm4-tweaks-dialog.glade b/settings-dialogs/xfwm4-tweaks-dialog.glade
index a9273a75e..ed54d7ad6 100644
--- a/settings-dialogs/xfwm4-tweaks-dialog.glade
+++ b/settings-dialogs/xfwm4-tweaks-dialog.glade
@@ -978,6 +978,22 @@ when switching via keyboard shortcuts</property>
</packing>
</child>
<child>
+ <object class="GtkCheckButton" id="zoom_pointer_check">
+ <property name="label" translatable="yes">Zoom pointer along with the desktop</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">6</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkLabel" id="label12">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -989,7 +1005,7 @@ when switching via keyboard shortcuts</property>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">6</property>
+ <property name="position">7</property>
</packing>
</child>
<child>
@@ -1050,7 +1066,7 @@ when switching via keyboard shortcuts</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">7</property>
+ <property name="position">8</property>
</packing>
</child>
<child>
@@ -1065,7 +1081,7 @@ when switching via keyboard shortcuts</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">8</property>
+ <property name="position">9</property>
</packing>
</child>
<child>
@@ -1126,7 +1142,7 @@ when switching via keyboard shortcuts</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">9</property>
+ <property name="position">10</property>
</packing>
</child>
<child>
@@ -1141,7 +1157,7 @@ when switching via keyboard shortcuts</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">10</property>
+ <property name="position">11</property>
</packing>
</child>
<child>
@@ -1202,7 +1218,7 @@ when switching via keyboard shortcuts</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">11</property>
+ <property name="position">12</property>
</packing>
</child>
<child>
@@ -1217,7 +1233,7 @@ when switching via keyboard shortcuts</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">12</property>
+ <property name="position">13</property>
</packing>
</child>
<child>
@@ -1278,7 +1294,7 @@ when switching via keyboard shortcuts</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">13</property>
+ <property name="position">14</property>
</packing>
</child>
<child>
@@ -1293,7 +1309,7 @@ when switching via keyboard shortcuts</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">14</property>
+ <property name="position">15</property>
</packing>
</child>
<child>
diff --git a/src/compositor.c b/src/compositor.c
index a51596c80..e23de49bd 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -2335,7 +2335,7 @@ paint_all (ScreenInfo *screen_info, XserverRegion region, gushort buffer)
#ifdef HAVE_EPOXY
if (screen_info->use_glx)
{
- if (screen_info->zoomed)
+ if (screen_info->zoomed && screen_info->cursor_is_zoomed)
{
paint_cursor (screen_info, region, paint_buffer);
}
@@ -2346,7 +2346,10 @@ paint_all (ScreenInfo *screen_info, XserverRegion region, gushort buffer)
{
if (screen_info->zoomed)
{
- paint_cursor (screen_info, region, paint_buffer);
+ if (screen_info->cursor_is_zoomed)
+ {
+ paint_cursor (screen_info, region, paint_buffer);
+ }
/* Fixme: copy back whole screen if zoomed
It would be better to scale the clipping region if possible. */
XFixesSetPictureClipRegion (dpy, screen_info->rootBuffer[buffer], 0, 0, None);
@@ -3287,7 +3290,7 @@ destroy_win (DisplayInfo *display_info, Window id)
}
static void
-update_cursor(ScreenInfo *screen_info)
+update_cursor (ScreenInfo *screen_info)
{
XFixesCursorImage *cursor;
@@ -3758,7 +3761,7 @@ compositorHandleCursorNotify (DisplayInfo *display_info, XFixesCursorNotifyEvent
TRACE ("window 0x%lx", ev->window);
screen_info = myDisplayGetScreenFromRoot (display_info, ev->window);
- if (screen_info)
+ if (screen_info && screen_info->cursor_is_zoomed)
{
update_cursor (screen_info);
}
@@ -4249,9 +4252,15 @@ compositorZoomIn (ScreenInfo *screen_info, XfwmEventButton *event)
if (!screen_info->zoomed)
{
- XFixesHideCursor (screen_info->display_info->dpy, screen_info->xroot);
- screen_info->cursorLocation.x = event->x_root - screen_info->cursorOffsetX;
- screen_info->cursorLocation.y = event->y_root - screen_info->cursorOffsetY;
+ screen_info->cursor_is_zoomed = screen_info->params->zoom_pointer;
+
+ if (screen_info->cursor_is_zoomed)
+ {
+ XFixesHideCursor (screen_info->display_info->dpy, screen_info->xroot);
+ screen_info->cursorLocation.x = event->x_root - screen_info->cursorOffsetX;
+ screen_info->cursorLocation.y = event->y_root - screen_info->cursorOffsetY;
+ update_cursor (screen_info);
+ }
}
screen_info->zoomed = TRUE;
@@ -4285,7 +4294,10 @@ compositorZoomOut (ScreenInfo *screen_info, XfwmEventButton *event)
screen_info->transform.matrix[1][2] = 0;
screen_info->zoomed = FALSE;
- XFixesShowCursor (screen_info->display_info->dpy, screen_info->xroot);
+ if (screen_info->cursor_is_zoomed)
+ {
+ XFixesShowCursor (screen_info->display_info->dpy, screen_info->xroot);
+ }
}
recenter_zoomed_area (screen_info, event->x_root, event->y_root);
}
diff --git a/src/screen.h b/src/screen.h
index 198bb827e..296df85c5 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -210,6 +210,7 @@ struct _ScreenInfo
gint cursorOffsetX;
gint cursorOffsetY;
XRectangle cursorLocation;
+ gboolean cursor_is_zoomed;
guint wins_unredirected;
gboolean compositor_active;
diff --git a/src/settings.c b/src/settings.c
index 2bcdd9d50..dc630d17b 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -745,6 +745,7 @@ loadSettings (ScreenInfo *screen_info)
{"wrap_windows", NULL, G_TYPE_BOOLEAN, TRUE},
{"wrap_workspaces", NULL, G_TYPE_BOOLEAN, TRUE},
{"zoom_desktop", NULL, G_TYPE_BOOLEAN, TRUE},
+ {"zoom_pointer", NULL, G_TYPE_BOOLEAN, TRUE},
{NULL, NULL, G_TYPE_INVALID, FALSE}
};
@@ -849,6 +850,8 @@ loadSettings (ScreenInfo *screen_info)
getBoolValue ("wrap_workspaces", rc);
screen_info->params->zoom_desktop =
getBoolValue ("zoom_desktop", rc);
+ screen_info->params->zoom_pointer =
+ getBoolValue ("zoom_pointer", rc);
screen_info->params->wrap_layout =
getBoolValue ("wrap_layout", rc);
@@ -1300,6 +1303,10 @@ cb_xfwm4_channel_property_changed(XfconfChannel *channel, const gchar *property_
{
screen_info->params->zoom_desktop = g_value_get_boolean (value);
}
+ else if (!strcmp (name, "zoom_pointer"))
+ {
+ screen_info->params->zoom_pointer = g_value_get_boolean (value);
+ }
else if (!strcmp (name, "wrap_windows"))
{
screen_info->params->wrap_windows = g_value_get_boolean (value);
diff --git a/src/settings.h b/src/settings.h
index f20c6db46..9bcdee84d 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -245,6 +245,7 @@ struct _XfwmParams
gboolean wrap_windows;
gboolean wrap_workspaces;
gboolean zoom_desktop;
+ gboolean zoom_pointer;
};
gboolean loadSettings (ScreenInfo *);