Fix Win32 build

This commit is contained in:
Tor Lillqvist
2010-08-29 12:40:56 +03:00
parent 8d36170b8d
commit 87bf99dcc5
4 changed files with 47 additions and 36 deletions

View File

@ -308,7 +308,6 @@ static ATOM
RegisterGdkClass (GdkWindowType wtype, GdkWindowTypeHint wtype_hint) RegisterGdkClass (GdkWindowType wtype, GdkWindowTypeHint wtype_hint)
{ {
static ATOM klassTOPLEVEL = 0; static ATOM klassTOPLEVEL = 0;
static ATOM klassDIALOG = 0;
static ATOM klassCHILD = 0; static ATOM klassCHILD = 0;
static ATOM klassTEMP = 0; static ATOM klassTEMP = 0;
static ATOM klassTEMPSHADOW = 0; static ATOM klassTEMPSHADOW = 0;
@ -482,7 +481,7 @@ _gdk_window_impl_new (GdkWindow *window,
(attributes->window_type == GDK_WINDOW_TOPLEVEL ? "TOPLEVEL" : (attributes->window_type == GDK_WINDOW_TOPLEVEL ? "TOPLEVEL" :
(attributes->window_type == GDK_WINDOW_CHILD ? "CHILD" : (attributes->window_type == GDK_WINDOW_CHILD ? "CHILD" :
(attributes->window_type == GDK_WINDOW_TEMP ? "TEMP" : (attributes->window_type == GDK_WINDOW_TEMP ? "TEMP" :
"???")))))); "???")))));
hparent = GDK_WINDOW_HWND (real_parent); hparent = GDK_WINDOW_HWND (real_parent);

View File

@ -389,8 +389,6 @@ gtk_size_request_mode_get_type G_GNUC_CONST
gtk_sort_type_get_type G_GNUC_CONST gtk_sort_type_get_type G_GNUC_CONST
gtk_spin_type_get_type G_GNUC_CONST gtk_spin_type_get_type G_GNUC_CONST
gtk_state_type_get_type G_GNUC_CONST gtk_state_type_get_type G_GNUC_CONST
gtk_submenu_direction_get_type G_GNUC_CONST
gtk_submenu_placement_get_type G_GNUC_CONST
gtk_target_flags_get_type G_GNUC_CONST gtk_target_flags_get_type G_GNUC_CONST
gtk_text_direction_get_type G_GNUC_CONST gtk_text_direction_get_type G_GNUC_CONST
gtk_text_buffer_target_info_get_type G_GNUC_CONST gtk_text_buffer_target_info_get_type G_GNUC_CONST

View File

@ -1727,7 +1727,7 @@ insert_text_callback (GtkFileChooserEntry *chooser_entry,
*position + (colon - new_text) != 1) || *position + (colon - new_text) != 1) ||
(new_text_length > 0 && (new_text_length > 0 &&
*position <= 1 && *position <= 1 &&
GTK_ENTRY (chooser_entry)->text_length >= 2 && gtk_entry_get_text_length (GTK_ENTRY (chooser_entry)) >= 2 &&
gtk_entry_get_text (GTK_ENTRY (chooser_entry))[1] == ':')) gtk_entry_get_text (GTK_ENTRY (chooser_entry))[1] == ':'))
{ {
gtk_widget_error_bell (GTK_WIDGET (chooser_entry)); gtk_widget_error_bell (GTK_WIDGET (chooser_entry));
@ -1746,7 +1746,7 @@ delete_text_callback (GtkFileChooserEntry *chooser_entry,
{ {
/* If deleting a drive letter, delete the colon, too */ /* If deleting a drive letter, delete the colon, too */
if (start_pos == 0 && end_pos == 1 && if (start_pos == 0 && end_pos == 1 &&
GTK_ENTRY (chooser_entry)->text_length >= 2 && gtk_entry_get_text_length (GTK_ENTRY (chooser_entry)) >= 2 &&
gtk_entry_get_text (GTK_ENTRY (chooser_entry))[1] == ':') gtk_entry_get_text (GTK_ENTRY (chooser_entry))[1] == ':')
{ {
g_signal_handlers_block_by_func (chooser_entry, g_signal_handlers_block_by_func (chooser_entry,

View File

@ -50,13 +50,15 @@ _gtk_plug_windowing_get_id (GtkPlug *plug)
void void
_gtk_plug_windowing_realize_toplevel (GtkPlug *plug) _gtk_plug_windowing_realize_toplevel (GtkPlug *plug)
{ {
if (plug->socket_window) GtkPlugPrivate *priv = plug->priv;
if (priv->socket_window)
{ {
_gtk_win32_embed_send (plug->socket_window, _gtk_win32_embed_send (priv->socket_window,
GTK_WIN32_EMBED_PARENT_NOTIFY, GTK_WIN32_EMBED_PARENT_NOTIFY,
(WPARAM) GDK_WINDOW_HWND (GTK_WIDGET (plug)->window), (WPARAM) GDK_WINDOW_HWND (GTK_WIDGET (plug)->window),
GTK_WIN32_EMBED_PROTOCOL_VERSION); GTK_WIN32_EMBED_PROTOCOL_VERSION);
_gtk_win32_embed_send (plug->socket_window, _gtk_win32_embed_send (priv->socket_window,
GTK_WIN32_EMBED_EVENT_PLUG_MAPPED, 0, 0); GTK_WIN32_EMBED_EVENT_PLUG_MAPPED, 0, 0);
} }
} }
@ -64,8 +66,10 @@ _gtk_plug_windowing_realize_toplevel (GtkPlug *plug)
void void
_gtk_plug_windowing_map_toplevel (GtkPlug *plug) _gtk_plug_windowing_map_toplevel (GtkPlug *plug)
{ {
if (plug->socket_window) GtkPlugPrivate *priv = plug->priv;
_gtk_win32_embed_send (plug->socket_window,
if (priv->socket_window)
_gtk_win32_embed_send (priv->socket_window,
GTK_WIN32_EMBED_EVENT_PLUG_MAPPED, GTK_WIN32_EMBED_EVENT_PLUG_MAPPED,
1, 0); 1, 0);
} }
@ -73,8 +77,10 @@ _gtk_plug_windowing_map_toplevel (GtkPlug *plug)
void void
_gtk_plug_windowing_unmap_toplevel (GtkPlug *plug) _gtk_plug_windowing_unmap_toplevel (GtkPlug *plug)
{ {
if (plug->socket_window) GtkPlugPrivate *priv = plug->priv;
_gtk_win32_embed_send (plug->socket_window,
if (priv->socket_window)
_gtk_win32_embed_send (priv->socket_window,
GTK_WIN32_EMBED_EVENT_PLUG_MAPPED, GTK_WIN32_EMBED_EVENT_PLUG_MAPPED,
0, 0); 0, 0);
} }
@ -82,8 +88,10 @@ _gtk_plug_windowing_unmap_toplevel (GtkPlug *plug)
void void
_gtk_plug_windowing_set_focus (GtkPlug *plug) _gtk_plug_windowing_set_focus (GtkPlug *plug)
{ {
if (plug->socket_window) GtkPlugPrivate *priv = plug->priv;
_gtk_win32_embed_send (plug->socket_window,
if (priv->socket_window)
_gtk_win32_embed_send (priv->socket_window,
GTK_WIN32_EMBED_REQUEST_FOCUS, GTK_WIN32_EMBED_REQUEST_FOCUS,
0, 0); 0, 0);
} }
@ -93,8 +101,10 @@ _gtk_plug_windowing_add_grabbed_key (GtkPlug *plug,
guint accelerator_key, guint accelerator_key,
GdkModifierType accelerator_mods) GdkModifierType accelerator_mods)
{ {
if (plug->socket_window) GtkPlugPrivate *priv = plug->priv;
_gtk_win32_embed_send (plug->socket_window,
if (priv->socket_window)
_gtk_win32_embed_send (priv->socket_window,
GTK_WIN32_EMBED_GRAB_KEY, GTK_WIN32_EMBED_GRAB_KEY,
accelerator_key, accelerator_mods); accelerator_key, accelerator_mods);
} }
@ -104,8 +114,10 @@ _gtk_plug_windowing_remove_grabbed_key (GtkPlug *plug,
guint accelerator_key, guint accelerator_key,
GdkModifierType accelerator_mods) GdkModifierType accelerator_mods)
{ {
if (plug->socket_window) GtkPlugPrivate *priv = plug->priv;
_gtk_win32_embed_send (plug->socket_window,
if (priv->socket_window)
_gtk_win32_embed_send (priv->socket_window,
GTK_WIN32_EMBED_UNGRAB_KEY, GTK_WIN32_EMBED_UNGRAB_KEY,
accelerator_key, accelerator_mods); accelerator_key, accelerator_mods);
} }
@ -114,6 +126,7 @@ void
_gtk_plug_windowing_focus_to_parent (GtkPlug *plug, _gtk_plug_windowing_focus_to_parent (GtkPlug *plug,
GtkDirectionType direction) GtkDirectionType direction)
{ {
GtkPlugPrivate *priv = plug->priv;
GtkWin32EmbedMessageType message = GTK_WIN32_EMBED_FOCUS_PREV; GtkWin32EmbedMessageType message = GTK_WIN32_EMBED_FOCUS_PREV;
switch (direction) switch (direction)
@ -130,7 +143,7 @@ _gtk_plug_windowing_focus_to_parent (GtkPlug *plug,
break; break;
} }
_gtk_win32_embed_send_focus_message (plug->socket_window, message, 0); _gtk_win32_embed_send_focus_message (priv->socket_window, message, 0);
} }
GdkFilterReturn GdkFilterReturn
@ -139,6 +152,7 @@ _gtk_plug_windowing_filter_func (GdkXEvent *gdk_xevent,
gpointer data) gpointer data)
{ {
GtkPlug *plug = GTK_PLUG (data); GtkPlug *plug = GTK_PLUG (data);
GtkPlugPrivate *priv = plug->priv;
MSG *msg = (MSG *) gdk_xevent; MSG *msg = (MSG *) gdk_xevent;
GdkFilterReturn return_val = GDK_FILTER_CONTINUE; GdkFilterReturn return_val = GDK_FILTER_CONTINUE;
@ -151,26 +165,26 @@ _gtk_plug_windowing_filter_func (GdkXEvent *gdk_xevent,
* crashes in testsocket. * crashes in testsocket.
*/ */
case WM_WINDOWPOSCHANGED: case WM_WINDOWPOSCHANGED:
if (!plug->same_app) if (!priv->same_app)
{ {
HWND parent = GetAncestor (msg->hwnd, GA_PARENT); HWND parent = GetAncestor (msg->hwnd, GA_PARENT);
gboolean was_embedded = plug->socket_window != NULL; gboolean was_embedded = priv->socket_window != NULL;
GdkScreen *screen = gdk_drawable_get_screen (event->any.window); GdkScreen *screen = gdk_drawable_get_screen (event->any.window);
GdkDisplay *display = gdk_screen_get_display (screen); 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, plug->socket_window)); 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); g_object_ref (plug);
if (was_embedded) if (was_embedded)
{ {
/* End of embedding protocol for previous socket */ /* End of embedding protocol for previous socket */
if (parent != GDK_WINDOW_HWND (plug->socket_window)) if (parent != GDK_WINDOW_HWND (priv->socket_window))
{ {
GtkWidget *widget = GTK_WIDGET (plug); GtkWidget *widget = GTK_WIDGET (plug);
GTK_NOTE (PLUGSOCKET, g_printerr ("was_embedded, current parent != socket_window\n")); GTK_NOTE (PLUGSOCKET, g_printerr ("was_embedded, current parent != socket_window\n"));
gdk_window_set_user_data (plug->socket_window, NULL); gdk_window_set_user_data (priv->socket_window, NULL);
g_object_unref (plug->socket_window); g_object_unref (priv->socket_window);
plug->socket_window = NULL; priv->socket_window = NULL;
/* Emit a delete window, as if the user attempted to /* Emit a delete window, as if the user attempted to
* close the toplevel. Only do this if we are being * close the toplevel. Only do this if we are being
@ -196,27 +210,27 @@ _gtk_plug_windowing_filter_func (GdkXEvent *gdk_xevent,
/* Start of embedding protocol */ /* Start of embedding protocol */
GTK_NOTE (PLUGSOCKET, g_printerr ("start of embedding\n")); GTK_NOTE (PLUGSOCKET, g_printerr ("start of embedding\n"));
plug->socket_window = gdk_window_lookup_for_display (display, (GdkNativeWindow) parent); priv->socket_window = gdk_window_lookup_for_display (display, (GdkNativeWindow) parent);
if (plug->socket_window) if (priv->socket_window)
{ {
gpointer user_data = NULL; gpointer user_data = NULL;
GTK_NOTE (PLUGSOCKET, g_printerr ("already had socket_window\n")); GTK_NOTE (PLUGSOCKET, g_printerr ("already had socket_window\n"));
gdk_window_get_user_data (plug->socket_window, &user_data); gdk_window_get_user_data (priv->socket_window, &user_data);
if (user_data) if (user_data)
{ {
g_warning (G_STRLOC "Plug reparented unexpectedly into window in the same process"); g_warning (G_STRLOC "Plug reparented unexpectedly into window in the same process");
plug->socket_window = NULL; priv->socket_window = NULL;
break; break;
} }
g_object_ref (plug->socket_window); g_object_ref (priv->socket_window);
} }
else else
{ {
plug->socket_window = gdk_window_foreign_new_for_display (display, (GdkNativeWindow) parent); priv->socket_window = gdk_window_foreign_new_for_display (display, (GdkNativeWindow) parent);
if (!plug->socket_window) /* Already gone */ if (!priv->socket_window) /* Already gone */
break; break;
} }
@ -231,9 +245,9 @@ _gtk_plug_windowing_filter_func (GdkXEvent *gdk_xevent,
break; break;
case WM_SIZE: case WM_SIZE:
if (!plug->same_app && plug->socket_window) if (!priv->same_app && priv->socket_window)
{ {
_gtk_win32_embed_send (plug->socket_window, _gtk_win32_embed_send (priv->socket_window,
GTK_WIN32_EMBED_PLUG_RESIZED, GTK_WIN32_EMBED_PLUG_RESIZED,
0, 0); 0, 0);
} }