diff --git a/gtk/Makefile.am b/gtk/Makefile.am index 80dc18f491..877ba7cace 100644 --- a/gtk/Makefile.am +++ b/gtk/Makefile.am @@ -731,19 +731,13 @@ gtk_use_x11_c_sources = \ gtktrayicon-x11.c \ gtkmountoperation-x11.c gtk_use_win32_c_sources = \ - gtkplug-win32.c \ - gtksocket-win32.c \ gtkwin32embed.c \ gtkwin32embedwidget.c \ gtkmountoperation-stub.c gtk_use_quartz_c_sources = \ gtksearchenginequartz.c \ - gtkplug-stub.c \ - gtksocket-stub.c \ gtkmountoperation-stub.c gtk_use_stub_c_sources = \ - gtkplug-stub.c \ - gtksocket-stub.c \ gtkmountoperation-stub.c gtk_all_c_sources += $(gtk_use_x11_c_sources) $(gtk_use_win32_c_sources) $(gtk_use_quartz_c_sources) $(gtk_use_stub_c_sources) if USE_X11 diff --git a/gtk/gtkplug-stub.c b/gtk/gtkplug-stub.c deleted file mode 100644 index 3bd1024aab..0000000000 --- a/gtk/gtkplug-stub.c +++ /dev/null @@ -1,83 +0,0 @@ -/* GTK - The GIMP Toolkit - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -/* Stub implementation of backend-specific GtkPlug functions. */ - -/* - * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GTK+ Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GTK+ at ftp://ftp.gtk.org/pub/gtk/. - */ - -#include "gtkplug.h" -#include "gtkplugprivate.h" - -GdkNativeWindow -_gtk_plug_windowing_get_id (GtkPlug *plug) -{ - return 0; -} - -void -_gtk_plug_windowing_realize_toplevel (GtkPlug *plug) -{ -} - -void -_gtk_plug_windowing_map_toplevel (GtkPlug *plug) -{ -} - -void -_gtk_plug_windowing_unmap_toplevel (GtkPlug *plug) -{ -} - -void -_gtk_plug_windowing_set_focus (GtkPlug *plug) -{ -} - -void -_gtk_plug_windowing_add_grabbed_key (GtkPlug *plug, - guint accelerator_key, - GdkModifierType accelerator_mods) -{ -} - -void -_gtk_plug_windowing_remove_grabbed_key (GtkPlug *plug, - guint accelerator_key, - GdkModifierType accelerator_mods) -{ -} - -void -_gtk_plug_windowing_focus_to_parent (GtkPlug *plug, - GtkDirectionType direction) -{ -} - -GdkFilterReturn -_gtk_plug_windowing_filter_func (GdkXEvent *gdk_xevent, - GdkEvent *event, - gpointer data) -{ - return GDK_FILTER_CONTINUE; -} diff --git a/gtk/gtkplug-win32.c b/gtk/gtkplug-win32.c deleted file mode 100644 index 7116b31628..0000000000 --- a/gtk/gtkplug-win32.c +++ /dev/null @@ -1,322 +0,0 @@ -/* GTK - The GIMP Toolkit - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * Copyright (C) 2005 Novell, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -/* By Tor Lillqvist 2005 */ - -/* - * Modified by the GTK+ Team and others 1997-2005. See the AUTHORS - * file for a list of people on the GTK+ Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GTK+ at ftp://ftp.gtk.org/pub/gtk/. - */ - -#include "gtkmarshalers.h" -#include "gtkplug.h" -#include "gtkplugprivate.h" -#include "gtkwindowprivate.h" -#include "gtkdebug.h" - -#include "win32/gdkwin32.h" - -#include "gtkwin32embed.h" - -#if defined(_MSC_VER) && (WINVER < 0x0500) -#ifndef GA_PARENT -#define GA_PARENT 1 -#endif -WINUSERAPI HWND WINAPI GetAncestor(HWND,UINT); -#endif - -GdkNativeWindow -_gtk_plug_windowing_get_id (GtkPlug *plug) -{ - return (GdkNativeWindow) GDK_WINDOW_HWND (gtk_widget_get_window (GTK_WIDGET (plug))); -} - -void -_gtk_plug_windowing_realize_toplevel (GtkPlug *plug) -{ - GtkPlugPrivate *priv = plug->priv; - - if (priv->socket_window) - { - _gtk_win32_embed_send (priv->socket_window, - GTK_WIN32_EMBED_PARENT_NOTIFY, - (WPARAM) GDK_WINDOW_HWND (gtk_widget_get_window (GTK_WIDGET (plug))), - GTK_WIN32_EMBED_PROTOCOL_VERSION); - _gtk_win32_embed_send (priv->socket_window, - GTK_WIN32_EMBED_EVENT_PLUG_MAPPED, 0, 0); - } -} - -void -_gtk_plug_windowing_map_toplevel (GtkPlug *plug) -{ - GtkPlugPrivate *priv = plug->priv; - - if (priv->socket_window) - _gtk_win32_embed_send (priv->socket_window, - GTK_WIN32_EMBED_EVENT_PLUG_MAPPED, - 1, 0); -} - -void -_gtk_plug_windowing_unmap_toplevel (GtkPlug *plug) -{ - GtkPlugPrivate *priv = plug->priv; - - if (priv->socket_window) - _gtk_win32_embed_send (priv->socket_window, - GTK_WIN32_EMBED_EVENT_PLUG_MAPPED, - 0, 0); -} - -void -_gtk_plug_windowing_set_focus (GtkPlug *plug) -{ - GtkPlugPrivate *priv = plug->priv; - - if (priv->socket_window) - _gtk_win32_embed_send (priv->socket_window, - GTK_WIN32_EMBED_REQUEST_FOCUS, - 0, 0); -} - -void -_gtk_plug_windowing_add_grabbed_key (GtkPlug *plug, - guint accelerator_key, - GdkModifierType accelerator_mods) -{ - GtkPlugPrivate *priv = plug->priv; - - if (priv->socket_window) - _gtk_win32_embed_send (priv->socket_window, - GTK_WIN32_EMBED_GRAB_KEY, - accelerator_key, accelerator_mods); -} - -void -_gtk_plug_windowing_remove_grabbed_key (GtkPlug *plug, - guint accelerator_key, - GdkModifierType accelerator_mods) -{ - GtkPlugPrivate *priv = plug->priv; - - if (priv->socket_window) - _gtk_win32_embed_send (priv->socket_window, - GTK_WIN32_EMBED_UNGRAB_KEY, - accelerator_key, accelerator_mods); -} - -void -_gtk_plug_windowing_focus_to_parent (GtkPlug *plug, - GtkDirectionType direction) -{ - GtkPlugPrivate *priv = plug->priv; - GtkWin32EmbedMessageType message = GTK_WIN32_EMBED_FOCUS_PREV; - - switch (direction) - { - case GTK_DIR_UP: - case GTK_DIR_LEFT: - case GTK_DIR_TAB_BACKWARD: - message = GTK_WIN32_EMBED_FOCUS_PREV; - break; - case GTK_DIR_DOWN: - case GTK_DIR_RIGHT: - case GTK_DIR_TAB_FORWARD: - message = GTK_WIN32_EMBED_FOCUS_NEXT; - break; - } - - _gtk_win32_embed_send_focus_message (priv->socket_window, message, 0); -} - -GdkFilterReturn -_gtk_plug_windowing_filter_func (GdkXEvent *gdk_xevent, - GdkEvent *event, - gpointer data) -{ - GtkPlug *plug = GTK_PLUG (data); - GtkPlugPrivate *priv = plug->priv; - MSG *msg = (MSG *) gdk_xevent; - GdkFilterReturn return_val = GDK_FILTER_CONTINUE; - - switch (msg->message) - { - /* What message should we look for to notice the reparenting? - * Maybe WM_WINDOWPOSCHANGED will work? This is handled in the - * X11 implementation by handling ReparentNotify. Handle this - * only for cross-process embedding, otherwise we get odd - * crashes in testsocket. - */ - case WM_WINDOWPOSCHANGED: - if (!priv->same_app) - { - HWND parent = GetAncestor (msg->hwnd, GA_PARENT); - gboolean was_embedded = priv->socket_window != NULL; - GdkScreen *screen = gdk_window_get_screen (event->any.window); - GdkDisplay *display = gdk_screen_get_display (screen); - - GTK_NOTE (PLUGSOCKET, g_printerr ("WM_WINDOWPOSCHANGED: hwnd=%p GA_PARENT=%p socket_window=%p\n", msg->hwnd, parent, priv->socket_window)); - g_object_ref (plug); - if (was_embedded) - { - /* End of embedding protocol for previous socket */ - if (parent != GDK_WINDOW_HWND (priv->socket_window)) - { - GtkWidget *widget = GTK_WIDGET (plug); - - GTK_NOTE (PLUGSOCKET, g_printerr ("was_embedded, current parent != socket_window\n")); - gdk_window_set_user_data (priv->socket_window, NULL); - g_object_unref (priv->socket_window); - priv->socket_window = NULL; - - /* Emit a delete window, as if the user attempted to - * close the toplevel. Only do this if we are being - * reparented to the desktop window. Moving from one - * embedder to another should be invisible to the app. - */ - if (parent == GetDesktopWindow ()) - { - GTK_NOTE (PLUGSOCKET, g_printerr ("current parent is root window\n")); - _gtk_plug_send_delete_event (widget); - return_val = GDK_FILTER_REMOVE; - } - } - else - { - GTK_NOTE (PLUGSOCKET, g_printerr ("still same parent\n")); - goto done; - } - } - - if (parent != GetDesktopWindow ()) - { - /* Start of embedding protocol */ - - GTK_NOTE (PLUGSOCKET, g_printerr ("start of embedding\n")); - priv->socket_window = gdk_win32_window_lookup_for_display (display, (GdkNativeWindow) parent); - if (priv->socket_window) - { - gpointer user_data = NULL; - - GTK_NOTE (PLUGSOCKET, g_printerr ("already had socket_window\n")); - gdk_window_get_user_data (priv->socket_window, &user_data); - - if (user_data) - { - g_warning (G_STRLOC "Plug reparented unexpectedly into window in the same process"); - priv->socket_window = NULL; - break; - } - - g_object_ref (priv->socket_window); - } - else - { - priv->socket_window = gdk_win32_window_foreign_new_for_display (display, (GdkNativeWindow) parent); - if (!priv->socket_window) /* Already gone */ - break; - } - - _gtk_plug_add_all_grabbed_keys (plug); - - if (!was_embedded) - g_signal_emit_by_name (plug, "embedded"); - } - done: - g_object_unref (plug); - } - break; - - case WM_SIZE: - if (!priv->same_app && priv->socket_window) - { - _gtk_win32_embed_send (priv->socket_window, - GTK_WIN32_EMBED_PLUG_RESIZED, - 0, 0); - } - break; - - default: - if (msg->message == _gtk_win32_embed_message_type (GTK_WIN32_EMBED_WINDOW_ACTIVATE)) - { - GTK_NOTE (PLUGSOCKET, g_printerr ("GtkPlug: WINDOW_ACTIVATE received\n")); - _gtk_win32_embed_push_message (msg); - _gtk_window_set_is_active (GTK_WINDOW (plug), TRUE); - _gtk_win32_embed_pop_message (); - return_val = GDK_FILTER_REMOVE; - } - else if (msg->message == _gtk_win32_embed_message_type (GTK_WIN32_EMBED_WINDOW_DEACTIVATE)) - { - GTK_NOTE (PLUGSOCKET, g_printerr ("GtkPlug: WINDOW_DEACTIVATE received\n")); - _gtk_win32_embed_push_message (msg); - _gtk_window_set_is_active (GTK_WINDOW (plug), FALSE); - _gtk_win32_embed_pop_message (); - return_val = GDK_FILTER_REMOVE; - } - else if (msg->message == _gtk_win32_embed_message_type (GTK_WIN32_EMBED_FOCUS_IN)) - { - GTK_NOTE (PLUGSOCKET, g_printerr ("GtkPlug: FOCUS_IN received\n")); - _gtk_win32_embed_push_message (msg); - _gtk_window_set_has_toplevel_focus (GTK_WINDOW (plug), TRUE); - switch (msg->wParam) - { - case GTK_WIN32_EMBED_FOCUS_CURRENT: - break; - case GTK_WIN32_EMBED_FOCUS_FIRST: - _gtk_plug_focus_first_last (plug, GTK_DIR_TAB_FORWARD); - break; - case GTK_WIN32_EMBED_FOCUS_LAST: - _gtk_plug_focus_first_last (plug, GTK_DIR_TAB_BACKWARD); - break; - } - _gtk_win32_embed_pop_message (); - return_val = GDK_FILTER_REMOVE; - } - else if (msg->message == _gtk_win32_embed_message_type (GTK_WIN32_EMBED_FOCUS_OUT)) - { - GTK_NOTE (PLUGSOCKET, g_printerr ("GtkPlug: FOCUS_OUT received\n")); - _gtk_win32_embed_push_message (msg); - _gtk_window_set_has_toplevel_focus (GTK_WINDOW (plug), FALSE); - _gtk_win32_embed_pop_message (); - return_val = GDK_FILTER_REMOVE; - } - else if (msg->message == _gtk_win32_embed_message_type (GTK_WIN32_EMBED_MODALITY_ON)) - { - GTK_NOTE (PLUGSOCKET, g_printerr ("GtkPlug: MODALITY_ON received\n")); - _gtk_win32_embed_push_message (msg); - _gtk_plug_handle_modality_on (plug); - _gtk_win32_embed_pop_message (); - return_val = GDK_FILTER_REMOVE; - } - else if (msg->message == _gtk_win32_embed_message_type (GTK_WIN32_EMBED_MODALITY_OFF)) - { - GTK_NOTE (PLUGSOCKET, g_printerr ("GtkPlug: MODALITY_OFF received\n")); - _gtk_win32_embed_push_message (msg); - _gtk_plug_handle_modality_off (plug); - _gtk_win32_embed_pop_message (); - return_val = GDK_FILTER_REMOVE; - } - break; - } - - return return_val; -} diff --git a/gtk/gtksocket-stub.c b/gtk/gtksocket-stub.c deleted file mode 100644 index b839048b88..0000000000 --- a/gtk/gtksocket-stub.c +++ /dev/null @@ -1,120 +0,0 @@ -/* GTK - The GIMP Toolkit - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -/* Stub implementation of backend-specific GtkPlug functions. */ - -/* - * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GTK+ Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GTK+ at ftp://ftp.gtk.org/pub/gtk/. - */ - -#include "gtksocket.h" -#include "gtksocketprivate.h" - -GdkNativeWindow -_gtk_socket_windowing_get_id (GtkSocket *socket) -{ - return 0; -} - -void -_gtk_socket_windowing_realize_window (GtkSocket *socket) -{ -} - -void -_gtk_socket_windowing_end_embedding_toplevel (GtkSocket *socket) -{ -} - -void -_gtk_socket_windowing_size_request (GtkSocket *socket) -{ -} - -void -_gtk_socket_windowing_send_key_event (GtkSocket *socket, - GdkEvent *gdk_event, - gboolean mask_key_presses) -{ -} - -void -_gtk_socket_windowing_focus_change (GtkSocket *socket, - gboolean focus_in) -{ -} - -void -_gtk_socket_windowing_update_active (GtkSocket *socket, - gboolean active) -{ -} - -void -_gtk_socket_windowing_update_modality (GtkSocket *socket, - gboolean modality) -{ -} - -void -_gtk_socket_windowing_focus (GtkSocket *socket, - GtkDirectionType direction) -{ -} - -void -_gtk_socket_windowing_send_configure_event (GtkSocket *socket) -{ -} - -void -_gtk_socket_windowing_select_plug_window_input (GtkSocket *socket) -{ -} - -void -_gtk_socket_windowing_embed_get_info (GtkSocket *socket) -{ -} - -void -_gtk_socket_windowing_embed_notify (GtkSocket *socket) -{ -} - -gboolean -_gtk_socket_windowing_embed_get_focus_wrapped (void) -{ - return FALSE; -} - -void -_gtk_socket_windowing_embed_set_focus_wrapped (void) -{ -} - -GdkFilterReturn -_gtk_socket_windowing_filter_func (GdkXEvent *gdk_xevent, - GdkEvent *event, - gpointer data) -{ - return GDK_FILTER_CONTINUE; -} diff --git a/gtk/gtksocket-win32.c b/gtk/gtksocket-win32.c deleted file mode 100644 index 1e745f55ff..0000000000 --- a/gtk/gtksocket-win32.c +++ /dev/null @@ -1,322 +0,0 @@ -/* GTK - The GIMP Toolkit - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * Copyright (C) 2005 Novell, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -/* By Tor Lillqvist 2005 */ - -/* - * Modified by the GTK+ Team and others 1997-2005. See the AUTHORS - * file for a list of people on the GTK+ Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GTK+ at ftp://ftp.gtk.org/pub/gtk/. - */ - -#include "config.h" -#include - -#include "gtkwindow.h" -#include "gtkplug.h" -#include "gtkprivate.h" -#include "gtksocket.h" -#include "gtksocketprivate.h" -#include "gtkplugprivate.h" -#include "gtkwindowprivate.h" -#include "gtkdebug.h" - -#include "win32/gdkwin32.h" - -#include "gtkwin32embed.h" -#include "gtkwidgetprivate.h" - -GdkNativeWindow -_gtk_socket_windowing_get_id (GtkSocket *socket) -{ - g_return_val_if_fail (GTK_IS_SOCKET (socket), 0); - g_return_val_if_fail (_gtk_widget_get_anchored (GTK_WIDGET (socket)), 0); - - if (!gtk_widget_get_realized (GTK_WIDGET (socket))) - gtk_widget_realize (GTK_WIDGET (socket)); - - return (GdkNativeWindow) GDK_WINDOW_HWND (gtk_widget_get_window (GTK_WIDGET (socket))); -} - -void -_gtk_socket_windowing_realize_window (GtkSocket *socket) -{ - /* XXX Anything needed? */ -} - -void -_gtk_socket_windowing_end_embedding_toplevel (GtkSocket *socket) -{ - GtkSocketPrivate *priv = socket->priv; - gtk_window_remove_embedded_xid (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (socket))), - GDK_WINDOW_HWND (priv->plug_window)); -} - -void -_gtk_socket_windowing_size_request (GtkSocket *socket) -{ - GtkSocketPrivate *priv = socket->priv; - MINMAXINFO mmi; - - priv->request_width = 1; - priv->request_height = 1; - - mmi.ptMaxSize.x = mmi.ptMaxSize.y = 16000; /* ??? */ - mmi.ptMinTrackSize.x = mmi.ptMinTrackSize.y = 1; - mmi.ptMaxTrackSize.x = mmi.ptMaxTrackSize.y = 16000; /* ??? */ - mmi.ptMaxPosition.x = mmi.ptMaxPosition.y = 0; - - if (SendMessage (GDK_WINDOW_HWND (priv->plug_window), WM_GETMINMAXINFO, - 0, (LPARAM) &mmi) == 0) - { - priv->request_width = mmi.ptMinTrackSize.x; - priv->request_height = mmi.ptMinTrackSize.y; - } - priv->have_size = TRUE; -} - -void -_gtk_socket_windowing_send_key_event (GtkSocket *socket, - GdkEvent *gdk_event, - gboolean mask_key_presses) -{ - GtkSocketPrivate *priv = socket->priv; - PostMessage (GDK_WINDOW_HWND (priv->plug_window), - (gdk_event->type == GDK_KEY_PRESS ? WM_KEYDOWN : WM_KEYUP), - gdk_event->key.hardware_keycode, 0); -} - -void -_gtk_socket_windowing_focus_change (GtkSocket *socket, - gboolean focus_in) -{ - GtkSocketPrivate *priv = socket->priv; - - if (focus_in) - _gtk_win32_embed_send_focus_message (priv->plug_window, - GTK_WIN32_EMBED_FOCUS_IN, - GTK_WIN32_EMBED_FOCUS_CURRENT); - else - _gtk_win32_embed_send (priv->plug_window, - GTK_WIN32_EMBED_FOCUS_OUT, - 0, 0); -} - -void -_gtk_socket_windowing_update_active (GtkSocket *socket, - gboolean active) -{ - GtkSocketPrivate *priv = socket->priv; - - _gtk_win32_embed_send (priv->plug_window, - (active ? GTK_WIN32_EMBED_WINDOW_ACTIVATE : GTK_WIN32_EMBED_WINDOW_DEACTIVATE), - 0, 0); -} - -void -_gtk_socket_windowing_update_modality (GtkSocket *socket, - gboolean modality) -{ - GtkSocketPrivate *priv = socket->priv; - _gtk_win32_embed_send (priv->plug_window, - (modality ? GTK_WIN32_EMBED_MODALITY_ON : GTK_WIN32_EMBED_MODALITY_OFF), - 0, 0); -} - -void -_gtk_socket_windowing_focus (GtkSocket *socket, - GtkDirectionType direction) -{ - int detail = -1; - GtkSocketPrivate *priv = socket->priv; - - switch (direction) - { - case GTK_DIR_UP: - case GTK_DIR_LEFT: - case GTK_DIR_TAB_BACKWARD: - detail = GTK_WIN32_EMBED_FOCUS_LAST; - break; - case GTK_DIR_DOWN: - case GTK_DIR_RIGHT: - case GTK_DIR_TAB_FORWARD: - detail = GTK_WIN32_EMBED_FOCUS_FIRST; - break; - } - - _gtk_win32_embed_send_focus_message (priv->plug_window, - GTK_WIN32_EMBED_FOCUS_IN, - detail); -} - -void -_gtk_socket_windowing_send_configure_event (GtkSocket *socket) -{ - /* XXX Nothing needed? */ -} - -void -_gtk_socket_windowing_select_plug_window_input (GtkSocket *socket) -{ - /* XXX Nothing needed? */ -} - -void -_gtk_socket_windowing_embed_get_info (GtkSocket *socket) -{ - GtkSocketPrivate *priv = socket->priv; - - priv->is_mapped = TRUE; /* XXX ? */ -} - -void -_gtk_socket_windowing_embed_notify (GtkSocket *socket) -{ - /* XXX Nothing needed? */ -} - -gboolean -_gtk_socket_windowing_embed_get_focus_wrapped (void) -{ - return _gtk_win32_embed_get_focus_wrapped (); -} - -void -_gtk_socket_windowing_embed_set_focus_wrapped (void) -{ - _gtk_win32_embed_set_focus_wrapped (); -} - -GdkFilterReturn -_gtk_socket_windowing_filter_func (GdkXEvent *gdk_xevent, - GdkEvent *event, - gpointer data) -{ - GtkSocket *socket; - GtkWidget *widget; - MSG *msg; - GdkFilterReturn return_val; - GtkSocketPrivate *priv = socket->priv; - - socket = GTK_SOCKET (data); - - return_val = GDK_FILTER_CONTINUE; - - if (priv->plug_widget) - return return_val; - - widget = GTK_WIDGET (socket); - msg = (MSG *) gdk_xevent; - - switch (msg->message) - { - default: - if (msg->message == _gtk_win32_embed_message_type (GTK_WIN32_EMBED_PARENT_NOTIFY)) - { - GTK_NOTE (PLUGSOCKET, g_printerr ("GtkSocket: PARENT_NOTIFY received window=%p version=%d\n", - (gpointer) msg->wParam, (int) msg->lParam)); - /* If we some day different protocols deployed need to add - * some more elaborate version handshake - */ - if (msg->lParam != GTK_WIN32_EMBED_PROTOCOL_VERSION) - g_warning ("GTK Win32 embedding protocol version mismatch, " - "client uses version %d, we understand version %d", - (int) msg->lParam, GTK_WIN32_EMBED_PROTOCOL_VERSION); - if (!priv->plug_window) - { - _gtk_socket_add_window (socket, (GdkNativeWindow) msg->wParam, FALSE); - - if (priv->plug_window) - GTK_NOTE (PLUGSOCKET, g_printerr ("GtkSocket: window created")); - - return_val = GDK_FILTER_REMOVE; - } - } - else if (msg->message == _gtk_win32_embed_message_type (GTK_WIN32_EMBED_EVENT_PLUG_MAPPED)) - { - gboolean was_mapped = priv->is_mapped; - gboolean is_mapped = msg->wParam != 0; - - GTK_NOTE (PLUGSOCKET, g_printerr ("GtkSocket: PLUG_MAPPED received is_mapped:%d\n", is_mapped)); - if (was_mapped != is_mapped) - { - if (is_mapped) - _gtk_socket_handle_map_request (socket); - else - { - gdk_window_show (priv->plug_window); - _gtk_socket_unmap_notify (socket); - } - } - return_val = GDK_FILTER_REMOVE; - } - else if (msg->message == _gtk_win32_embed_message_type (GTK_WIN32_EMBED_PLUG_RESIZED)) - { - GTK_NOTE (PLUGSOCKET, g_printerr ("GtkSocket: PLUG_RESIZED received\n")); - priv->have_size = FALSE; - gtk_widget_queue_resize (widget); - return_val = GDK_FILTER_REMOVE; - } - else if (msg->message == _gtk_win32_embed_message_type (GTK_WIN32_EMBED_REQUEST_FOCUS)) - { - GTK_NOTE (PLUGSOCKET, g_printerr ("GtkSocket: REQUEST_FOCUS received\n")); - _gtk_win32_embed_push_message (msg); - _gtk_socket_claim_focus (socket, TRUE); - _gtk_win32_embed_pop_message (); - return_val = GDK_FILTER_REMOVE; - } - else if (msg->message == _gtk_win32_embed_message_type (GTK_WIN32_EMBED_FOCUS_NEXT)) - { - GTK_NOTE (PLUGSOCKET, g_printerr ("GtkSocket: FOCUS_NEXT received\n")); - _gtk_win32_embed_push_message (msg); - _gtk_socket_advance_toplevel_focus (socket, GTK_DIR_TAB_FORWARD); - _gtk_win32_embed_pop_message (); - return_val = GDK_FILTER_REMOVE; - } - else if (msg->message == _gtk_win32_embed_message_type (GTK_WIN32_EMBED_FOCUS_PREV)) - { - GTK_NOTE (PLUGSOCKET, g_printerr ("GtkSocket: FOCUS_PREV received\n")); - _gtk_win32_embed_push_message (msg); - _gtk_socket_advance_toplevel_focus (socket, GTK_DIR_TAB_BACKWARD); - _gtk_win32_embed_pop_message (); - return_val = GDK_FILTER_REMOVE; - } - else if (msg->message == _gtk_win32_embed_message_type (GTK_WIN32_EMBED_GRAB_KEY)) - { - GTK_NOTE (PLUGSOCKET, g_printerr ("GtkSocket: GRAB_KEY received\n")); - _gtk_win32_embed_push_message (msg); - _gtk_socket_add_grabbed_key (socket, msg->wParam, msg->lParam); - _gtk_win32_embed_pop_message (); - return_val = GDK_FILTER_REMOVE; - } - else if (msg->message == _gtk_win32_embed_message_type (GTK_WIN32_EMBED_UNGRAB_KEY)) - { - GTK_NOTE (PLUGSOCKET, g_printerr ("GtkSocket: UNGRAB_KEY received\n")); - _gtk_win32_embed_push_message (msg); - _gtk_socket_remove_grabbed_key (socket, msg->wParam, msg->lParam); - _gtk_win32_embed_pop_message (); - return_val = GDK_FILTER_REMOVE; - } - break; - } - - return return_val; -} -