filename | src/gtkui/gtkui.c |
changeset | 618:3ade50e8603c |
prev | 608:4f588e52bce0 |
next | 622:3554650afb26 |
author | nkeynes |
date | Wed Jan 30 02:39:57 2008 +0000 (15 years ago) |
permissions | -rw-r--r-- |
last change | Embed gdk_display_warp_pointer for GTK 2.6 implementations that lack in (mainly for OSX) Perform real modifier mapping to get CTRL+ALT for screen ungrab rather than assuming the keysyms. |
view | annotate | diff | log | raw |
1 /**
2 * $Id$
3 *
4 * Core GTK-based user interface
5 *
6 * Copyright (c) 2005 Nathan Keynes.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 */
19 #include "lxdream.h"
20 #include <sys/time.h>
21 #include <time.h>
22 #include <glib/gi18n.h>
23 #include <gtk/gtkversion.h>
24 #include "dreamcast.h"
25 #include "display.h"
26 #include "gdrom/gdrom.h"
27 #include "gtkui/gtkui.h"
30 void gtk_gui_start( void );
31 void gtk_gui_stop( void );
32 void gtk_gui_alloc_resources ( void );
33 uint32_t gtk_gui_run_slice( uint32_t nanosecs );
35 struct dreamcast_module gtk_gui_module = { "gui", NULL,
36 gtk_gui_update,
37 gtk_gui_start,
38 gtk_gui_run_slice,
39 gtk_gui_stop,
40 NULL, NULL };
42 /**
43 * Single-instance windows (at most one)
44 */
45 static main_window_t main_win = NULL;
46 static debug_window_t debug_win = NULL;
47 static mmio_window_t mmio_win = NULL;
49 /**
50 * UIManager and action helpers
51 */
52 static GtkUIManager *global_ui_manager;
53 static GtkActionGroup *global_action_group;
55 /**
56 * Count of running nanoseconds - used to cut back on the GUI runtime
57 */
58 static uint32_t gtk_gui_nanos = 0;
59 static struct timeval gtk_gui_lasttv;
61 static gboolean gtk_gui_init_ok = FALSE;
63 #define ENABLE_ACTION(win,name) SET_ACTION_ENABLED(win,name,TRUE)
64 #define DISABLE_ACTION(win,name) SET_ACTION_ENABLED(win,name,FALSE)
66 // UI Actions
67 static const GtkActionEntry ui_actions[] = {
68 { "FileMenu", NULL, N_("_File") },
69 { "SettingsMenu", NULL, N_("_Settings") },
70 { "HelpMenu", NULL, N_("_Help") },
71 { "LoadBinary", NULL, N_("Load _Binary..."), NULL, N_("Load and run a program binary"), G_CALLBACK(load_binary_action_callback) },
72 { "Reset", GTK_STOCK_REFRESH, N_("_Reset"), "<control>R", N_("Reset dreamcast"), G_CALLBACK(reset_action_callback) },
73 { "Pause", GTK_STOCK_MEDIA_PAUSE, N_("_Pause"), NULL, N_("Pause dreamcast"), G_CALLBACK(pause_action_callback) },
74 { "Run", GTK_STOCK_MEDIA_PLAY, N_("Resume"), NULL, N_("Resume"), G_CALLBACK(resume_action_callback) },
75 { "LoadState", GTK_STOCK_REVERT_TO_SAVED, N_("_Load state..."), "F4", N_("Load an lxdream save state"), G_CALLBACK(load_state_action_callback) },
76 { "SaveState", GTK_STOCK_SAVE_AS, N_("_Save state..."), "F3", N_("Create an lxdream save state"), G_CALLBACK(save_state_action_callback) },
77 { "Exit", GTK_STOCK_QUIT, N_("E_xit"), NULL, N_("Exit lxdream"), G_CALLBACK(exit_action_callback) },
78 { "GdromSettings", NULL, N_("_GD-Rom...") },
79 { "GdromUnmount", NULL, N_("_Empty") },
80 { "GdromMount", GTK_STOCK_CDROM, N_("_Open Image..."), "<control>O", N_("Mount a cdrom disc"), G_CALLBACK(mount_action_callback) },
81 { "PathSettings", NULL, N_("_Paths..."), NULL, N_("Configure files and paths"), G_CALLBACK(path_settings_callback) },
82 { "AudioSettings", NULL, N_("_Audio..."), NULL, N_("Configure audio output"), G_CALLBACK(audio_settings_callback) },
83 { "ControllerSettings", NULL, N_("_Controllers..."), NULL, N_("Configure controllers"), G_CALLBACK(maple_settings_callback) },
84 { "NetworkSettings", NULL, N_("_Network..."), NULL, N_("Configure network settings"), G_CALLBACK(network_settings_callback) },
85 { "VideoSettings", NULL, N_("_Video..."), NULL,N_( "Configure video output"), G_CALLBACK(video_settings_callback) },
86 { "About", GTK_STOCK_ABOUT, N_("_About..."), NULL, N_("About lxdream"), G_CALLBACK(about_action_callback) },
87 { "DebugMenu", NULL, N_("_Debug") },
88 { "Debugger", NULL, N_("_Debugger"), NULL, N_("Open debugger window"), G_CALLBACK(debugger_action_callback) },
89 { "DebugMem", NULL, N_("View _Memory"), NULL, N_("View memory dump"), G_CALLBACK(debug_memory_action_callback) },
90 { "DebugMmio", NULL, N_("View IO _Registers"), NULL, N_("View MMIO Registers"), G_CALLBACK(debug_mmio_action_callback) },
91 { "SaveScene", NULL, N_("_Save Scene"), NULL, N_("Save next rendered scene"), G_CALLBACK(save_scene_action_callback) },
92 { "SingleStep", GTK_STOCK_REDO, N_("_Single Step"), NULL, N_("Single step"), G_CALLBACK(debug_step_action_callback) },
93 { "RunTo", GTK_STOCK_GOTO_LAST, N_("Run _To"), NULL, N_("Run to"), G_CALLBACK( debug_runto_action_callback) },
94 { "SetBreakpoint", GTK_STOCK_CLOSE, N_("_Breakpoint"), NULL, N_("Toggle breakpoint"), G_CALLBACK( debug_breakpoint_action_callback) }
95 };
96 static const GtkToggleActionEntry ui_toggle_actions[] = {
97 { "FullScreen", NULL, "_Full Screen", "<alt>Return", "Toggle full screen video", G_CALLBACK(fullscreen_toggle_callback), 0 },
98 };
100 // Menus and toolbars
101 static const char *ui_description =
102 "<ui>"
103 " <menubar name='MainMenu'>"
104 " <menu action='FileMenu'>"
105 " <menuitem action='LoadBinary'/>"
106 " <menuitem action='GdromSettings'/>"
107 " <separator/>"
108 " <menuitem action='Reset'/>"
109 " <menuitem action='Pause'/>"
110 " <menuitem action='Run'/>"
111 " <menuitem action='Debugger'/>"
112 " <separator/>"
113 " <menuitem action='LoadState'/>"
114 " <menuitem action='SaveState'/>"
115 " <separator/>"
116 " <menuitem action='Exit'/>"
117 " </menu>"
118 " <menu action='SettingsMenu'>"
119 " <menuitem action='PathSettings'/>"
120 " <menuitem action='AudioSettings'/>"
121 " <menuitem action='ControllerSettings'/>"
122 " <menuitem action='NetworkSettings'/>"
123 " <menuitem action='VideoSettings'/>"
124 " <separator/>"
125 " <menuitem action='FullScreen'/>"
126 " </menu>"
127 " <menu action='HelpMenu'>"
128 " <menuitem action='About'/>"
129 " </menu>"
130 " </menubar>"
131 " <toolbar name='MainToolbar'>"
132 " <toolitem action='GdromMount'/>"
133 " <toolitem action='Reset'/>"
134 " <toolitem action='Pause'/>"
135 " <toolitem action='Run'/>"
136 " <separator/>"
137 " <toolitem action='LoadState'/>"
138 " <toolitem action='SaveState'/>"
139 " </toolbar>"
140 " <menubar name='DebugMenu'>"
141 " <menu action='FileMenu'>"
142 " <menuitem action='GdromSettings'/>"
143 " <separator/>"
144 " <menuitem action='Reset'/>"
145 " <separator/>"
146 " <menuitem action='LoadState'/>"
147 " <menuitem action='SaveState'/>"
148 " <separator/>"
149 " <menuitem action='Exit'/>"
150 " </menu>"
151 " <menu action='DebugMenu'>"
152 " <menuitem action='DebugMem'/>"
153 " <menuitem action='DebugMmio'/>"
154 " <menuitem action='SaveScene'/>"
155 " <separator/>"
156 " <menuitem action='SetBreakpoint'/>"
157 " <menuitem action='Pause'/>"
158 " <menuitem action='SingleStep'/>"
159 " <menuitem action='RunTo'/>"
160 " <menuitem action='Run'/>"
161 " </menu>"
162 " <menu action='SettingsMenu'>"
163 " <menuitem action='PathSettings'/>"
164 " <menuitem action='AudioSettings'/>"
165 " <menuitem action='ControllerSettings'/>"
166 " <menuitem action='NetworkSettings'/>"
167 " <menuitem action='VideoSettings'/>"
168 " <separator/>"
169 " <menuitem action='FullScreen'/>"
170 " </menu>"
171 " <menu action='HelpMenu'>"
172 " <menuitem action='About'/>"
173 " </menu>"
174 " </menubar>"
175 " <toolbar name='DebugToolbar'>"
176 " <toolitem action='GdromMount'/>"
177 " <toolitem action='Reset'/>"
178 " <toolitem action='Pause'/>"
179 " <separator/>"
180 " <toolitem action='SingleStep'/>"
181 " <toolitem action='RunTo'/>"
182 " <toolitem action='Run'/>"
183 " <toolitem action='SetBreakpoint'/>"
184 " <separator/>"
185 " <toolitem action='LoadState'/>"
186 " <toolitem action='SaveState'/>"
187 " </toolbar>"
188 "</ui>";
190 gboolean gui_parse_cmdline( int *argc, char **argv[] )
191 {
192 gtk_gui_init_ok = gtk_init_check( argc, argv );
193 return gtk_gui_init_ok;
194 }
196 gboolean gui_init( gboolean withDebug )
197 {
198 if( gtk_gui_init_ok ) {
199 GError *error = NULL;
200 dreamcast_register_module( >k_gui_module );
201 gtk_gui_alloc_resources();
203 global_action_group = gtk_action_group_new("MenuActions");
204 gtk_action_group_set_translation_domain( global_action_group, NULL );
205 gtk_action_group_add_actions( global_action_group, ui_actions, G_N_ELEMENTS(ui_actions), NULL );
206 gtk_action_group_add_toggle_actions( global_action_group, ui_toggle_actions, G_N_ELEMENTS(ui_toggle_actions), NULL );
207 gtk_gui_enable_action("AudioSettings", FALSE);
208 gtk_gui_enable_action("NetworkSettings", FALSE);
209 gtk_gui_enable_action("VideoSettings", FALSE);
211 global_ui_manager = gtk_ui_manager_new();
212 gtk_ui_manager_set_add_tearoffs(global_ui_manager, TRUE);
213 gtk_ui_manager_insert_action_group( global_ui_manager, global_action_group, 0 );
215 if (!gtk_ui_manager_add_ui_from_string (global_ui_manager, ui_description, -1, &error)) {
216 g_message ("building menus failed: %s", error->message);
217 g_error_free (error);
218 exit(1);
219 }
220 GtkAccelGroup *accel_group = gtk_ui_manager_get_accel_group (global_ui_manager);
221 GtkWidget *menubar = gtk_ui_manager_get_widget(global_ui_manager, "/MainMenu");
222 GtkWidget *toolbar = gtk_ui_manager_get_widget(global_ui_manager, "/MainToolbar");
224 GtkWidget *gdrommenuitem = gtk_ui_manager_get_widget(global_ui_manager, "/MainMenu/FileMenu/GdromSettings");
225 gdrom_menu_init();
226 GtkWidget *gdrommenu = gdrom_menu_new();
227 gtk_menu_item_set_submenu( GTK_MENU_ITEM(gdrommenuitem), gdrommenu );
228 main_win = main_window_new( APP_NAME " " APP_VERSION, menubar, toolbar, accel_group );
229 main_window_set_use_grab(main_win, TRUE);
230 if( withDebug ) {
231 gtk_gui_show_debugger();
232 }
234 return TRUE;
235 } else {
236 return FALSE;
237 }
238 }
240 void gui_main_loop(void)
241 {
242 gtk_gui_update();
243 gtk_main();
244 }
246 void gui_update_state(void)
247 {
248 gtk_gui_update();
249 }
251 gboolean gui_error_dialog( const char *msg, ... )
252 {
253 if( main_win != NULL ) {
254 va_list args;
255 GtkWidget *dialog =
256 gtk_message_dialog_new( main_window_get_frame(main_win), GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
257 GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, NULL );
258 va_start(args, msg);
259 gchar *markup = g_markup_vprintf_escaped( msg, args );
260 va_end( args );
261 gtk_message_dialog_set_markup( GTK_MESSAGE_DIALOG(dialog), markup );
262 g_free(markup);
263 gtk_dialog_run(GTK_DIALOG(dialog));
264 gtk_widget_destroy(dialog);
265 return TRUE;
266 }
267 return FALSE;
268 }
270 void gui_update_io_activity( io_activity_type io, gboolean active )
271 {
273 }
275 void gtk_gui_show_debugger()
276 {
277 if( debug_win ) {
278 debug_window_show(debug_win, TRUE);
279 } else {
280 GtkAccelGroup *accel_group = gtk_ui_manager_get_accel_group (global_ui_manager);
281 GtkWidget *menubar = gtk_ui_manager_get_widget(global_ui_manager, "/DebugMenu");
282 GtkWidget *toolbar = gtk_ui_manager_get_widget(global_ui_manager, "/DebugToolbar");
283 GtkWidget *gdrommenuitem = gtk_ui_manager_get_widget(global_ui_manager, "/DebugMenu/FileMenu/GdromSettings");
284 GtkWidget *gdrommenu = gdrom_menu_new();
285 gtk_menu_item_set_submenu( GTK_MENU_ITEM(gdrommenuitem), gdrommenu );
286 gchar *title = g_strdup_printf( APP_NAME " " APP_VERSION " :: %s", _("Debugger"));
287 debug_win = debug_window_new( title, menubar, toolbar, accel_group );
288 g_free(title);
289 }
290 }
292 void gtk_gui_show_mmio()
293 {
294 if( mmio_win ) {
295 mmio_window_show(mmio_win, TRUE);
296 } else {
297 gchar *title = g_strdup_printf( APP_NAME " " APP_VERSION " :: %s", _("MMIO Registers"));
298 mmio_win = mmio_window_new( title );
299 g_free(title);
300 }
301 }
304 main_window_t gtk_gui_get_main()
305 {
306 return main_win;
307 }
309 debug_window_t gtk_gui_get_debugger()
310 {
311 return debug_win;
312 }
314 mmio_window_t gtk_gui_get_mmio()
315 {
316 return mmio_win;
317 }
319 GtkWidget *gtk_gui_get_renderarea()
320 {
321 if( main_win == NULL ) {
322 return NULL;
323 } else {
324 return main_window_get_renderarea(main_win);
325 }
326 }
328 /**
329 * Hook called when DC starts running. Just disables the run/step buttons
330 * and enables the stop button.
331 */
332 void gtk_gui_start( void )
333 {
334 main_window_set_running( main_win, TRUE );
335 if( debug_win != NULL ) {
336 debug_window_set_running( debug_win, TRUE );
337 }
338 gtk_gui_nanos = 0;
339 gettimeofday(>k_gui_lasttv,NULL);
340 }
342 /**
343 * Hook called when DC stops running. Enables the run/step buttons
344 * and disables the stop button.
345 */
346 void gtk_gui_stop( void )
347 {
348 main_window_set_running( main_win, FALSE );
349 gtk_gui_update();
350 }
352 void gtk_gui_update( void )
353 {
354 if( global_action_group ) {
355 gtk_gui_enable_action("Run", dreamcast_can_run() && !dreamcast_is_running() );
356 gtk_gui_enable_action("Pause", dreamcast_is_running() );
357 }
358 if( debug_win ) {
359 debug_window_set_running( debug_win, FALSE );
360 debug_window_update(debug_win);
361 }
362 if( mmio_win ) {
363 mmio_window_update(mmio_win);
364 }
365 dump_window_update_all();
366 }
368 /**
369 * Module run-slice. Because UI processing is fairly expensive, only
370 * run the processing about 10 times a second while we're emulating.
371 */
372 uint32_t gtk_gui_run_slice( uint32_t nanosecs )
373 {
374 gtk_gui_nanos += nanosecs;
375 if( gtk_gui_nanos > 100000000 ) {
376 struct timeval tv;
377 while( gtk_events_pending() )
378 gtk_main_iteration();
380 gettimeofday(&tv,NULL);
381 double ns = ((tv.tv_sec - gtk_gui_lasttv.tv_sec) * 1000000000.0) +
382 ((tv.tv_usec - gtk_gui_lasttv.tv_usec)*1000.0);
383 double speed = (float)( (double)gtk_gui_nanos * 100.0 / ns );
384 gtk_gui_lasttv.tv_sec = tv.tv_sec;
385 gtk_gui_lasttv.tv_usec = tv.tv_usec;
386 main_window_set_speed( main_win, speed );
387 gtk_gui_nanos = 0;
388 }
389 return nanosecs;
390 }
393 PangoFontDescription *gui_fixed_font;
394 GdkColor gui_colour_normal, gui_colour_changed, gui_colour_error;
395 GdkColor gui_colour_warn, gui_colour_pc, gui_colour_debug;
396 GdkColor gui_colour_trace, gui_colour_break, gui_colour_temp_break;
397 GdkColor gui_colour_white;
399 void gtk_gui_alloc_resources() {
400 GdkColormap *map;
402 gui_colour_normal.red = gui_colour_normal.green = gui_colour_normal.blue = 0;
403 gui_colour_changed.red = gui_colour_changed.green = 64*256;
404 gui_colour_changed.blue = 154*256;
405 gui_colour_error.red = 65535;
406 gui_colour_error.green = gui_colour_error.blue = 64*256;
407 gui_colour_pc.red = 32*256;
408 gui_colour_pc.green = 170*256;
409 gui_colour_pc.blue = 52*256;
410 gui_colour_warn = gui_colour_changed;
411 gui_colour_trace.red = 156*256;
412 gui_colour_trace.green = 78*256;
413 gui_colour_trace.blue = 201*256;
414 gui_colour_debug = gui_colour_pc;
415 gui_colour_break.red = 65535;
416 gui_colour_break.green = gui_colour_break.blue = 192*256;
417 gui_colour_temp_break.red = gui_colour_temp_break.green = 128*256;
418 gui_colour_temp_break.blue = 32*256;
419 gui_colour_white.red = gui_colour_white.green = gui_colour_white.blue = 65535;
421 map = gdk_colormap_new(gdk_visual_get_best(), TRUE);
422 gdk_colormap_alloc_color(map, &gui_colour_normal, TRUE, TRUE);
423 gdk_colormap_alloc_color(map, &gui_colour_changed, TRUE, TRUE);
424 gdk_colormap_alloc_color(map, &gui_colour_error, TRUE, TRUE);
425 gdk_colormap_alloc_color(map, &gui_colour_warn, TRUE, TRUE);
426 gdk_colormap_alloc_color(map, &gui_colour_pc, TRUE, TRUE);
427 gdk_colormap_alloc_color(map, &gui_colour_debug, TRUE, TRUE);
428 gdk_colormap_alloc_color(map, &gui_colour_trace, TRUE, TRUE);
429 gdk_colormap_alloc_color(map, &gui_colour_break, TRUE, TRUE);
430 gdk_colormap_alloc_color(map, &gui_colour_temp_break, TRUE, TRUE);
431 gdk_colormap_alloc_color(map, &gui_colour_white, TRUE, TRUE);
432 gui_fixed_font = pango_font_description_from_string("Courier 10");
433 }
435 gint gtk_gui_run_property_dialog( const gchar *title, GtkWidget *panel, gtk_dialog_done_fn fn )
436 {
437 GtkWidget *dialog =
438 gtk_dialog_new_with_buttons(title, main_window_get_frame(main_win),
439 GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
440 GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
441 GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
442 NULL);
443 gint result;
444 gtk_widget_show_all(panel);
445 gtk_container_add( GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), panel );
446 result = gtk_dialog_run( GTK_DIALOG(dialog) );
447 if( fn != NULL ) {
448 fn(panel, result == GTK_RESPONSE_ACCEPT);
449 }
450 gtk_widget_destroy( dialog );
451 return result;
452 }
454 void gtk_gui_enable_action( const gchar *action, gboolean enable )
455 {
456 gtk_action_set_sensitive( gtk_action_group_get_action( global_action_group, action), enable);
457 }
459 static void delete_frame_buffer( guchar *pixels, gpointer buffer )
460 {
461 if( buffer != NULL ) {
462 g_free(buffer);
463 }
464 }
466 GdkPixbuf *gdk_pixbuf_new_from_frame_buffer( frame_buffer_t buffer )
467 {
468 return gdk_pixbuf_new_from_data( (unsigned char *)buffer->data,
469 GDK_COLORSPACE_RGB,
470 (buffer->colour_format == COLFMT_BGRA8888),
471 8,
472 buffer->width,
473 buffer->height,
474 buffer->rowstride,
475 delete_frame_buffer,
476 buffer );
477 }
479 /**
480 * Extract the keyval of the key event if no modifier keys were pressed -
481 * in other words get the keyval of the key by itself. The other way around
482 * would be to use the hardware keysyms directly rather than the keyvals,
483 * but the mapping looks to be messier.
484 */
485 uint16_t gtk_get_unmodified_keyval( GdkEventKey *event )
486 {
487 GdkKeymap *keymap = gdk_keymap_get_default();
488 guint keyval;
490 gdk_keymap_translate_keyboard_state( keymap, event->hardware_keycode, 0, 0, &keyval,
491 NULL, NULL, NULL );
492 return keyval;
493 }
495 /************* X11-specificness **********/
496 #include <gdk/gdkx.h>
498 guint gdk_keycode_to_modifier( GdkDisplay *display, guint keycode )
499 {
500 int i;
501 int result = 0;
502 Display *xdisplay = GDK_DISPLAY_XDISPLAY (display);
503 XModifierKeymap *keymap = XGetModifierMapping( xdisplay );
504 for( i=0; i<8*keymap->max_keypermod; i++ ) {
505 if( keymap->modifiermap[i] == keycode ) {
506 result = 1 << (i/keymap->max_keypermod);
507 break;
508 }
509 }
510 XFreeModifiermap(keymap);
511 return result;
512 }
514 #if !(GTK_CHECK_VERSION(2,8,0))
515 /* gdk_display_warp_pointer was added in GTK 2.8. If we're using an earlier
516 * version, include the code here. (Can't just set the dependency on 2.8 as
517 * it still hasn't been ported to OSX...) Original copyright statement belo
518 */
520 /* GDK - The GIMP Drawing Kit
521 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
522 *
523 * This library is free software; you can redistribute it and/or
524 * modify it under the terms of the GNU Lesser General Public
525 * License as published by the Free Software Foundation; either
526 * version 2 of the License, or (at your option) any later version.
527 *
528 * This library is distributed in the hope that it will be useful,
529 * but WITHOUT ANY WARRANTY; without even the implied warranty of
530 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
531 * Lesser General Public License for more details.
532 *
533 * You should have received a copy of the GNU Lesser General Public
534 * License along with this library; if not, write to the
535 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
536 * Boston, MA 02111-1307, USA.
537 */
539 /*
540 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
541 * file for a list of people on the GTK+ Team. See the ChangeLog
542 * files for a list of changes. These files are distributed with
543 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
544 */
545 void gdk_display_warp_pointer (GdkDisplay *display,
546 GdkScreen *screen,
547 gint x,
548 gint y)
549 {
550 Display *xdisplay;
551 Window dest;
553 xdisplay = GDK_DISPLAY_XDISPLAY (display);
554 dest = GDK_WINDOW_XWINDOW (gdk_screen_get_root_window (screen));
556 XWarpPointer (xdisplay, None, dest, 0, 0, 0, 0, x, y);
557 }
559 #endif
.