summaryrefslogtreecommitdiff
path: root/gtk/gtkplug.c
diff options
context:
space:
mode:
authorTor Lillqvist <tml@src.gnome.org>1999-03-15 00:03:37 +0000
committerTor Lillqvist <tml@src.gnome.org>1999-03-15 00:03:37 +0000
commitc65508d2723d255a9fcdfa8ac2a5f82b0667a7c6 (patch)
tree57c568358f89e9d1ec3c561bae77f5b76adc6417 /gtk/gtkplug.c
parent044fd2db4700cf34d4a2b06424be0bbe2dce5b78 (diff)
downloadgtk+-c65508d2723d255a9fcdfa8ac2a5f82b0667a7c6.tar.gz
This might seem like a large patch, but it isn't that bad, and nothing
should break on Unix/X11. Win32 merge and general portability stuff: * acconfig.h,configure.in: Check for <sys/time.h>. * gdk/win32: New directory (actually, been there for a while). * gtk/fnmatch.c: Include <glib.h> for G_DIR_SEPARATOR, WIN32 and NATIVE_WIN32, and use these. Always case fold on Win32. No backslashed escapes on native Win32. * gtk/{gtk.def,makefile.msc}: New files. * gtk/Makefile.am: Add above new files. * gtk/{gtkaccelgroup,gtkbindings}.c: Include <string.h> instead of <strings.h>. * gtk/{gtkcalendar,gtkitemfactory,gtkpreview,gtkrc}.c: Include config.h. Protect inclusion of <sys/param.h>, <sys/time.h>, and <unistd.h> appropriately. * gtk/gtkdnd.c: Merge in Win32 version (which doesn't do much). Use ABS() (from <glib.h>) instead of abs(). * gtk/gtkfilesel.c: Moved Win32-specific includes after inclusion of gtk (and thus glib) headers, so that WIN32 will be defined. With MS C, include <direct.h> for mkdir prototype. * gtk/gtkitemfactory.c (gtk_item_factory_callback_marshal): Add some casts, needed by MS C. * gtk/{gtklayout,gtkplug}.c: Merge in Win32 version (which isn't implemented). * gtk/gtkmain.c: Include gdk/gdkx.h for GDK_WINDOWING. Include <X11/Xlocale.h> only on X11 platform, otherwise <locale.h>. Use G_SEARCHPATH_SEPARATOR_S and g_module_build_path. * gtk/gtkmain.h: Mark variables for export/import on Win32. * gtk/gtkrange.c (gtk_range_motion_notify): Set mods also in case the event is not a hint, or its window is not the slider. Needed on Win32, at least. * gtk/gtkrc.c: Include config.h and gdk/gdkx.h. Use <locale.h> unless on X11. Skip \r chars, too. Use G_DIR_SEPARATOR and G_SEARCHPATH_SEPARATOR(_S). Use g_path_is_absolute. On Win32, use a subdirectory of the Windows directory as gtk system configuration directory. * gtk/gtkselection.c: No chunks on Win32. * gtk/gtksocket.c: Not implemented on Win32. * gtk/gtkthemes.c (gtk_theme_engine_get): Use g_module_build_path. * gtk/makeenums.h: Include gdkprivate.h after gdk.h. * gtk/testrgb.c: Use dynamically allocated buffer. Use GTimers.
Diffstat (limited to 'gtk/gtkplug.c')
-rw-r--r--gtk/gtkplug.c150
1 files changed, 150 insertions, 0 deletions
diff --git a/gtk/gtkplug.c b/gtk/gtkplug.c
index e2ad46ef9d..cf7506e321 100644
--- a/gtk/gtkplug.c
+++ b/gtk/gtkplug.c
@@ -271,9 +271,13 @@ gtk_plug_key_press_event (GtkWidget *widget,
gtk_window_set_focus (GTK_WINDOW (widget), NULL);
gdk_error_trap_push ();
+#if GDK_WINDOWING == GDK_WINDOWING_X11
XSetInputFocus (GDK_DISPLAY (),
GDK_WINDOW_XWINDOW (plug->socket_window),
RevertToParent, event->time);
+#elif GDK_WINDOWING == GDK_WINDOWING_WIN32
+ SetFocus (GDK_WINDOW_XWINDOW (plug->socket_window));
+#endif
gdk_flush ();
gdk_error_trap_pop ();
@@ -292,6 +296,7 @@ gtk_plug_key_press_event (GtkWidget *widget,
static void
gtk_plug_forward_key_press (GtkPlug *plug, GdkEventKey *event)
{
+#if GDK_WINDOWING == GDK_WINDOWING_X11
XEvent xevent;
xevent.xkey.type = KeyPress;
@@ -316,6 +321,147 @@ gtk_plug_forward_key_press (GtkPlug *plug, GdkEventKey *event)
False, NoEventMask, &xevent);
gdk_flush ();
gdk_error_trap_pop ();
+#elif GDK_WINDOWING == GDK_WINDOWING_WIN32
+ /* This is pretty bogus, and not tested at all. */
+ WPARAM wParam;
+ LPARAM lParam;
+ gboolean no_WM_CHAR = TRUE;
+
+ lParam = 0;
+ switch (event->keyval)
+ {
+ case GDK_Cancel:
+ wParam = VK_CANCEL; break;
+ case GDK_BackSpace:
+ wParam = VK_BACK; break;
+ case GDK_Tab:
+ wParam = VK_TAB; break;
+ case GDK_Clear:
+ wParam = VK_CLEAR; break;
+ case GDK_Return:
+ wParam = VK_RETURN; break;
+ case GDK_Shift_L:
+ wParam = VK_SHIFT; break;
+ case GDK_Control_L:
+ wParam = VK_CONTROL; break;
+ case GDK_Control_R:
+ wParam = VK_CONTROL; lParam |= 0x01000000; break;
+ case GDK_Alt_L:
+ wParam = VK_MENU; break;
+ case GDK_Alt_R:
+ wParam = VK_MENU; lParam |= 0x01000000; break;
+ case GDK_Pause:
+ wParam = VK_PAUSE; break;
+ case GDK_Caps_Lock:
+ wParam = VK_CAPITAL; break;
+ case GDK_Escape:
+ wParam = VK_ESCAPE; break;
+ case GDK_Prior:
+ wParam = VK_PRIOR; break;
+ case GDK_Next:
+ wParam = VK_NEXT; break;
+ case GDK_End:
+ wParam = VK_END; break;
+ case GDK_Home:
+ wParam = VK_HOME; break;
+ case GDK_Left:
+ wParam = VK_LEFT; break;
+ case GDK_Up:
+ wParam = VK_UP; break;
+ case GDK_Right:
+ wParam = VK_RIGHT; break;
+ case GDK_Down:
+ wParam = VK_DOWN; break;
+ case GDK_Select:
+ wParam = VK_SELECT; break;
+ case GDK_Print:
+ wParam = VK_PRINT; break;
+ case GDK_Execute:
+ wParam = VK_EXECUTE; break;
+ case GDK_Insert:
+ wParam = VK_INSERT; break;
+ case GDK_Delete:
+ wParam = VK_DELETE; break;
+ case GDK_Help:
+ wParam = VK_HELP; break;
+ case GDK_KP_0:
+ wParam = VK_NUMPAD0; break;
+ case GDK_KP_1:
+ wParam = VK_NUMPAD1; break;
+ case GDK_KP_2:
+ wParam = VK_NUMPAD2; break;
+ case GDK_KP_3:
+ wParam = VK_NUMPAD3; break;
+ case GDK_KP_4:
+ wParam = VK_NUMPAD4; break;
+ case GDK_KP_5:
+ wParam = VK_NUMPAD5; break;
+ case GDK_KP_6:
+ wParam = VK_NUMPAD6; break;
+ case GDK_KP_7:
+ wParam = VK_NUMPAD7; break;
+ case GDK_KP_8:
+ wParam = VK_NUMPAD8; break;
+ case GDK_KP_9:
+ wParam = VK_NUMPAD9; break;
+ case GDK_KP_Multiply:
+ wParam = VK_MULTIPLY; break;
+ case GDK_KP_Add:
+ wParam = VK_ADD; break;
+ case GDK_KP_Separator:
+ wParam = VK_SEPARATOR; break;
+ case GDK_KP_Subtract:
+ wParam = VK_SUBTRACT; break;
+ case GDK_KP_Decimal:
+ wParam = VK_DECIMAL; break;
+ case GDK_KP_Divide:
+ wParam = VK_DIVIDE; break;
+ case GDK_F1:
+ wParam = VK_F1; break;
+ case GDK_F2:
+ wParam = VK_F2; break;
+ case GDK_F3:
+ wParam = VK_F3; break;
+ case GDK_F4:
+ wParam = VK_F4; break;
+ case GDK_F5:
+ wParam = VK_F5; break;
+ case GDK_F6:
+ wParam = VK_F6; break;
+ case GDK_F7:
+ wParam = VK_F7; break;
+ case GDK_F8:
+ wParam = VK_F8; break;
+ case GDK_F9:
+ wParam = VK_F9; break;
+ case GDK_F10:
+ wParam = VK_F10; break;
+ case GDK_F11:
+ wParam = VK_F11; break;
+ case GDK_F12:
+ wParam = VK_F12; break;
+ case GDK_F13:
+ wParam = VK_F13; break;
+ case GDK_F14:
+ wParam = VK_F14; break;
+ case GDK_F15:
+ wParam = VK_F15; break;
+ case GDK_F16:
+ wParam = VK_F16; break;
+ default:
+ wParam = event->keyval;
+ no_WM_CHAR = FALSE;
+ break;
+ }
+
+ PostMessage (GDK_WINDOW_XWINDOW (plug->socket_window),
+ WM_KEYDOWN, wParam, lParam);
+ if (!no_WM_CHAR)
+ PostMessage (GDK_WINDOW_XWINDOW (plug->socket_window),
+ WM_CHAR, wParam, lParam);
+ PostMessage (GDK_WINDOW_XWINDOW (plug->socket_window),
+ WM_KEYUP, wParam, lParam);
+#endif
}
/* Copied from Window, Ughh */
@@ -422,6 +568,7 @@ gtk_plug_set_focus (GtkWindow *window,
if (focus && !GTK_WIDGET_HAS_FOCUS(window))
{
+#if GDK_WINDOWING == GDK_WINDOWING_X11
XEvent xevent;
xevent.xfocus.type = FocusIn;
@@ -436,5 +583,8 @@ gtk_plug_set_focus (GtkWindow *window,
False, NoEventMask, &xevent);
gdk_flush ();
gdk_error_trap_pop ();
+#elif GDK_WINDOWING == GDK_WINDOWING_WIN32
+ /* XXX Not implemented */
+#endif
}
}