Search
lxdream.org :: lxdream/src/gtkui/gtkui.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/gtkui/gtkui.c
changeset 618:3ade50e8603c
prev608:4f588e52bce0
next622:3554650afb26
author nkeynes
date Wed Jan 30 02:39:57 2008 +0000 (13 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.
file annotate diff log raw
1.1 --- a/src/gtkui/gtkui.c Sat Jan 26 02:45:27 2008 +0000
1.2 +++ b/src/gtkui/gtkui.c Wed Jan 30 02:39:57 2008 +0000
1.3 @@ -20,6 +20,7 @@
1.4 #include <sys/time.h>
1.5 #include <time.h>
1.6 #include <glib/gi18n.h>
1.7 +#include <gtk/gtkversion.h>
1.8 #include "dreamcast.h"
1.9 #include "display.h"
1.10 #include "gdrom/gdrom.h"
1.11 @@ -491,3 +492,69 @@
1.12 return keyval;
1.13 }
1.14
1.15 +/************* X11-specificness **********/
1.16 +#include <gdk/gdkx.h>
1.17 +
1.18 +guint gdk_keycode_to_modifier( GdkDisplay *display, guint keycode )
1.19 +{
1.20 + int i;
1.21 + int result = 0;
1.22 + Display *xdisplay = GDK_DISPLAY_XDISPLAY (display);
1.23 + XModifierKeymap *keymap = XGetModifierMapping( xdisplay );
1.24 + for( i=0; i<8*keymap->max_keypermod; i++ ) {
1.25 + if( keymap->modifiermap[i] == keycode ) {
1.26 + result = 1 << (i/keymap->max_keypermod);
1.27 + break;
1.28 + }
1.29 + }
1.30 + XFreeModifiermap(keymap);
1.31 + return result;
1.32 +}
1.33 +
1.34 +#if !(GTK_CHECK_VERSION(2,8,0))
1.35 +/* gdk_display_warp_pointer was added in GTK 2.8. If we're using an earlier
1.36 + * version, include the code here. (Can't just set the dependency on 2.8 as
1.37 + * it still hasn't been ported to OSX...) Original copyright statement belo
1.38 + */
1.39 +
1.40 +/* GDK - The GIMP Drawing Kit
1.41 + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
1.42 + *
1.43 + * This library is free software; you can redistribute it and/or
1.44 + * modify it under the terms of the GNU Lesser General Public
1.45 + * License as published by the Free Software Foundation; either
1.46 + * version 2 of the License, or (at your option) any later version.
1.47 + *
1.48 + * This library is distributed in the hope that it will be useful,
1.49 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.50 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1.51 + * Lesser General Public License for more details.
1.52 + *
1.53 + * You should have received a copy of the GNU Lesser General Public
1.54 + * License along with this library; if not, write to the
1.55 + * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
1.56 + * Boston, MA 02111-1307, USA.
1.57 + */
1.58 +
1.59 +/*
1.60 + * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
1.61 + * file for a list of people on the GTK+ Team. See the ChangeLog
1.62 + * files for a list of changes. These files are distributed with
1.63 + * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
1.64 + */
1.65 +void gdk_display_warp_pointer (GdkDisplay *display,
1.66 + GdkScreen *screen,
1.67 + gint x,
1.68 + gint y)
1.69 +{
1.70 + Display *xdisplay;
1.71 + Window dest;
1.72 +
1.73 + xdisplay = GDK_DISPLAY_XDISPLAY (display);
1.74 + dest = GDK_WINDOW_XWINDOW (gdk_screen_get_root_window (screen));
1.75 +
1.76 + XWarpPointer (xdisplay, None, dest, 0, 0, 0, 0, x, y);
1.77 +}
1.78 +
1.79 +#endif
1.80 +
.