[Xfce4-commits] [xfce/xfce4-settings] 16/27: Reduce hardcoded circle sizes

noreply at xfce.org noreply at xfce.org
Sun Feb 25 23:56:25 CET 2018


This is an automated email from the git hooks/post-receive script.

o   c   h   o   s   i       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       x   f   c   e   -   4   .   1   2   
   in repository xfce/xfce4-settings.

commit c1f700b8ff4d9eb2210ed55c2d3855400cc08355
Author: Florian Schüller <florian.schueller at gmail.com>
Date:   Sat Feb 24 00:38:50 2018 +0100

    Reduce hardcoded circle sizes
---
 dialogs/accessibility-settings/find-cursor.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/dialogs/accessibility-settings/find-cursor.c b/dialogs/accessibility-settings/find-cursor.c
index d4d994a..73706d8 100644
--- a/dialogs/accessibility-settings/find-cursor.c
+++ b/dialogs/accessibility-settings/find-cursor.c
@@ -38,6 +38,8 @@
 /* global var to keep track of the circle size */
 double px = 1;
 
+/* size of the final circles */
+gint circle_size=500;
 
 gboolean timeout (gpointer data)
 {
@@ -59,8 +61,8 @@ static GdkPixbuf
                                       x,
                                       y,
                                       0, 0,
-                                      500,
-                                      500);
+                                      circle_size,
+                                      circle_size);
     return screenshot;
 }
 
@@ -76,7 +78,7 @@ find_cursor_motion_notify_event (GtkWidget      *widget,
 
     gdk_window_get_pointer (window, &x, &y, NULL);
     gtk_window_get_position (GTK_WINDOW (widget), &root_x, &root_y);
-    gtk_window_move (GTK_WINDOW (widget), root_x + x - 250, root_y + y - 250);
+    gtk_window_move (GTK_WINDOW (widget), root_x + x - (circle_size/2), root_y + y - (circle_size/2));
     return FALSE;
 }
 
@@ -125,7 +127,7 @@ find_cursor_window_expose (GtkWidget *widget,
     else {
         /* only take a screenshot once in the first iteration */
         if (px == 1) {
-            pixbuf = get_rectangle_screenshot (root_x + x - 250 + 1, root_y + y - 250 , widget);
+            pixbuf = get_rectangle_screenshot (root_x + x - (circle_size / 2) + 1, root_y + y - (circle_size / 2) , widget);
             if (!pixbuf)
                 g_warning("Getting screenshot failed");
         }
@@ -161,7 +163,7 @@ find_cursor_window_expose (GtkWidget *widget,
     }
 
     /* stop before the circles get bigger than the window */
-    if (px > 200) {
+    if (px >= (circle_size/2)) {
         if (pixbuf)
             g_object_unref (pixbuf);
         gtk_main_quit();
@@ -211,14 +213,14 @@ main (gint argc, gchar **argv)
     window = gtk_window_new (GTK_WINDOW_POPUP);
     gtk_container_set_border_width (GTK_CONTAINER (window), 0);
     gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
-    gtk_window_set_default_size (GTK_WINDOW (window), 500, 500);
-    gtk_widget_set_size_request (window, 500, 500);
+    gtk_window_set_default_size (GTK_WINDOW (window), circle_size, circle_size);
+    gtk_widget_set_size_request (window, circle_size, circle_size);
     gtk_window_set_decorated (GTK_WINDOW (window), FALSE);
     gtk_widget_set_app_paintable (window, TRUE);
     gtk_window_set_skip_taskbar_hint (GTK_WINDOW (window), FALSE);
 
     /* center the window around the mouse cursor */
-    gtk_window_move (GTK_WINDOW (window), x - 250, y - 250);
+    gtk_window_move (GTK_WINDOW (window), x - (circle_size/2), y - (circle_size/2));
 
     /* check if we're in a composited environment */
     composited = find_cursor_window_composited (window);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list