1 /* Lepton EDA Schematic Capture
2 * Copyright (C) 1998-2010 Ales Hvezda
3 * Copyright (C) 1998-2016 gEDA Contributors
4 * Copyright (C) 2017-2021 Lepton EDA Contributors
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20 #include <config.h>
21
22 #include <stdio.h>
23 #include <math.h>
24
25 #include "gschem.h"
26
27 /*! \todo Finish function documentation!!!
28 * \brief
29 * \par Function Description
30 *
31 */
x_basic_warp_cursor(GtkWidget * widget,gint x,gint y)32 void x_basic_warp_cursor (GtkWidget* widget, gint x, gint y)
33 {
34 GdkScreen *screen;
35 GdkDisplay *display;
36 int window_x, window_y;
37
38 gdk_window_get_origin (gtk_widget_get_window (widget), &window_x, &window_y);
39
40 screen = gtk_widget_get_screen (widget);
41 display = gdk_screen_get_display (screen);
42
43 #ifdef ENABLE_GTK3
44 GdkDeviceManager *device_manager = gdk_display_get_device_manager (display);
45 GdkDevice *pointer = gdk_device_manager_get_client_pointer (device_manager);
46 gdk_device_warp (pointer, screen, window_x + x, window_y + y);
47 #else
48 gdk_display_warp_pointer (display, screen, window_x + x, window_y + y);
49 #endif
50 }
51