mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-11 13:10:07 +00:00
win32: no more GdkNativeWindow and related changes
- replace GdkNativeWindow with HWND, remove type casts - no more GdkDisplayClass::get_drag_protocol but GdkWindowImpl::get_drag_protocol - remove *_client_message*()
This commit is contained in:
parent
f55ccce2d9
commit
b41ee31a16
@ -290,7 +290,7 @@ gdk_device_win32_query_state (GdkDevice *device,
|
||||
hwndc = ChildWindowFromPoint (hwnd, point);
|
||||
|
||||
if (hwndc && hwndc != hwnd)
|
||||
*child_window = gdk_win32_handle_table_lookup ((GdkNativeWindow) hwndc);
|
||||
*child_window = gdk_win32_handle_table_lookup (hwndc);
|
||||
else
|
||||
*child_window = NULL; /* Direct child unknown to gdk */
|
||||
}
|
||||
@ -372,7 +372,7 @@ gdk_device_win32_window_at_position (GdkDevice *device,
|
||||
do
|
||||
{
|
||||
if (get_toplevel &&
|
||||
(window = gdk_win32_handle_table_lookup ((GdkNativeWindow) hwnd)) != NULL &&
|
||||
(window = gdk_win32_handle_table_lookup (hwnd)) != NULL &&
|
||||
GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN)
|
||||
break;
|
||||
|
||||
@ -382,7 +382,7 @@ gdk_device_win32_window_at_position (GdkDevice *device,
|
||||
}
|
||||
while (hwndc != hwnd && (hwnd = hwndc, 1));
|
||||
|
||||
window = gdk_win32_handle_table_lookup ((GdkNativeWindow) hwnd);
|
||||
window = gdk_win32_handle_table_lookup (hwnd);
|
||||
|
||||
if (window && (win_x || win_y))
|
||||
{
|
||||
|
@ -495,10 +495,7 @@ gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
|
||||
display_class->supports_composite = gdk_win32_display_supports_composite;
|
||||
|
||||
display_class->list_devices = _gdk_win32_display_list_devices;
|
||||
display_class->send_client_message = _gdk_win32_display_send_client_message;
|
||||
display_class->add_client_message_filter = _gdk_win32_display_add_client_message_filter;
|
||||
//? display_class->get_app_launch_context = _gdk_win32_display_get_app_launch_context;
|
||||
display_class->get_drag_protocol = _gdk_win32_display_get_drag_protocol;
|
||||
display_class->get_cursor_for_type = _gdk_win32_display_get_cursor_for_type;
|
||||
display_class->get_cursor_for_name = _gdk_win32_display_get_cursor_for_name;
|
||||
display_class->get_cursor_for_pixbuf = _gdk_win32_display_get_cursor_for_pixbuf;
|
||||
|
@ -1972,33 +1972,32 @@ _gdk_win32_dnd_do_dragdrop (void)
|
||||
}
|
||||
}
|
||||
|
||||
GdkNativeWindow
|
||||
_gdk_win32_display_get_drag_protocol (GdkDisplay *display,
|
||||
GdkNativeWindow xid,
|
||||
GdkDragProtocol *protocol,
|
||||
guint *version)
|
||||
/* Untested, may not work ...
|
||||
* ... but as of this writing is only used by exlusive X11 gtksocket.c
|
||||
*/
|
||||
GdkDragProtocol
|
||||
_gdk_win32_window_get_drag_protocol (GdkWindow *window,
|
||||
GdkWindow **target)
|
||||
{
|
||||
GdkWindow *window;
|
||||
GdkDragProtocol protocol = GDK_DRAG_PROTO_NONE;
|
||||
|
||||
window = gdk_win32_window_lookup_for_display (display, xid);
|
||||
if (window &&
|
||||
gdk_window_get_window_type (window) != GDK_WINDOW_FOREIGN)
|
||||
if (gdk_window_get_window_type (window) != GDK_WINDOW_FOREIGN)
|
||||
{
|
||||
if (g_object_get_data (G_OBJECT (window), "gdk-dnd-registered") != NULL)
|
||||
{
|
||||
if (use_ole2_dnd)
|
||||
*protocol = GDK_DRAG_PROTO_OLE2;
|
||||
protocol = GDK_DRAG_PROTO_OLE2;
|
||||
else
|
||||
*protocol = GDK_DRAG_PROTO_LOCAL;
|
||||
|
||||
/* even X11 code not always intializes it */
|
||||
*version = 0;
|
||||
|
||||
return xid;
|
||||
protocol = GDK_DRAG_PROTO_LOCAL;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
if (target)
|
||||
{
|
||||
*target = NULL;
|
||||
}
|
||||
|
||||
return protocol;
|
||||
}
|
||||
|
||||
static GdkWindow *
|
||||
|
@ -527,7 +527,7 @@ find_window_for_mouse_event (GdkWindow* reported_window,
|
||||
if (!PtInRect (&rect, pt))
|
||||
return _gdk_root;
|
||||
|
||||
other_window = gdk_win32_handle_table_lookup ((GdkNativeWindow) hwnd);
|
||||
other_window = gdk_win32_handle_table_lookup (hwnd);
|
||||
}
|
||||
|
||||
if (other_window == NULL)
|
||||
@ -544,21 +544,6 @@ find_window_for_mouse_event (GdkWindow* reported_window,
|
||||
return other_window;
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_win32_display_add_client_message_filter (GdkDisplay *display,
|
||||
GdkAtom message_type,
|
||||
GdkFilterFunc func,
|
||||
gpointer data)
|
||||
{
|
||||
GdkClientFilter *filter = g_new (GdkClientFilter, 1);
|
||||
|
||||
filter->type = message_type;
|
||||
filter->function = func;
|
||||
filter->data = data;
|
||||
|
||||
client_filters = g_list_append (client_filters, filter);
|
||||
}
|
||||
|
||||
static void
|
||||
build_key_event_state (GdkEvent *event,
|
||||
BYTE *key_state)
|
||||
@ -834,14 +819,7 @@ _gdk_win32_print_event (const GdkEvent *event)
|
||||
event->dnd.context->dest_window == NULL ? NULL : GDK_WINDOW_HWND (event->dnd.context->dest_window));
|
||||
break;
|
||||
case GDK_CLIENT_EVENT:
|
||||
g_print ("%s %d %ld %ld %ld %ld %ld",
|
||||
gdk_atom_name (event->client.message_type),
|
||||
event->client.data_format,
|
||||
event->client.data.l[0],
|
||||
event->client.data.l[1],
|
||||
event->client.data.l[2],
|
||||
event->client.data.l[3],
|
||||
event->client.data.l[4]);
|
||||
/* no more GdkEventClient */
|
||||
break;
|
||||
case GDK_SCROLL:
|
||||
g_print ("(%.4g,%.4g) (%.4g,%.4g) %s ",
|
||||
@ -1756,7 +1734,7 @@ gdk_event_translate (MSG *msg,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
window = gdk_win32_handle_table_lookup ((GdkNativeWindow) msg->hwnd);
|
||||
window = gdk_win32_handle_table_lookup (msg->hwnd);
|
||||
orig_window = window;
|
||||
|
||||
if (window == NULL)
|
||||
@ -1868,15 +1846,7 @@ gdk_event_translate (MSG *msg,
|
||||
goto done;
|
||||
|
||||
case GDK_FILTER_CONTINUE:
|
||||
/* Send unknown client messages on to Gtk for it to use */
|
||||
|
||||
event->client.type = GDK_CLIENT_EVENT;
|
||||
event->client.window = window;
|
||||
event->client.message_type = GDK_POINTER_TO_ATOM (msg->wParam);
|
||||
event->client.data_format = 32;
|
||||
event->client.data.l[0] = msg->lParam;
|
||||
for (i = 1; i < 5; i++)
|
||||
event->client.data.l[i] = 0;
|
||||
/* No more: Send unknown client messages on to Gtk for it to use */
|
||||
GDK_NOTE (EVENTS, _gdk_win32_print_event (event));
|
||||
return_val = TRUE;
|
||||
goto done;
|
||||
@ -2235,7 +2205,7 @@ gdk_event_translate (MSG *msg,
|
||||
GDK_NOTE (EVENTS, g_print (" %d (%ld,%ld)",
|
||||
HIWORD (msg->wParam), msg->pt.x, msg->pt.y));
|
||||
|
||||
if (!gdk_win32_handle_table_lookup ((GdkNativeWindow) WindowFromPoint (msg->pt)))
|
||||
if (!gdk_win32_handle_table_lookup (WindowFromPoint (msg->pt)))
|
||||
{
|
||||
/* we are only interested if we don't know the new window */
|
||||
if (current_toplevel)
|
||||
@ -2266,7 +2236,7 @@ gdk_event_translate (MSG *msg,
|
||||
break;
|
||||
|
||||
msg->hwnd = hwnd;
|
||||
if ((new_window = gdk_win32_handle_table_lookup ((GdkNativeWindow) msg->hwnd)) == NULL)
|
||||
if ((new_window = gdk_win32_handle_table_lookup (msg->hwnd)) == NULL)
|
||||
break;
|
||||
|
||||
if (new_window != window)
|
||||
@ -2994,7 +2964,7 @@ gdk_event_translate (MSG *msg,
|
||||
event->selection.selection = GDK_SELECTION_CLIPBOARD;
|
||||
event->selection.target = target;
|
||||
event->selection.property = _gdk_selection;
|
||||
event->selection.requestor = msg->hwnd;
|
||||
event->selection.requestor = gdk_win32_handle_table_lookup (msg->hwnd);
|
||||
event->selection.time = msg->time;
|
||||
|
||||
fixup_event (event);
|
||||
@ -3220,41 +3190,6 @@ is_modally_blocked (GdkWindow *window)
|
||||
return modal_current != NULL ? gdk_window_get_toplevel (window) != modal_current : FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
check_for_too_much_data (GdkEvent *event)
|
||||
{
|
||||
if (event->client.data.l[1] ||
|
||||
event->client.data.l[2] ||
|
||||
event->client.data.l[3] ||
|
||||
event->client.data.l[4])
|
||||
{
|
||||
g_warning ("Only four bytes of data are passed in client messages on Win32\n");
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gdk_win32_display_send_client_message (GdkDisplay *display,
|
||||
GdkEvent *event,
|
||||
GdkNativeWindow winid)
|
||||
{
|
||||
check_for_too_much_data (event);
|
||||
|
||||
return PostMessageW ((HWND) winid, client_message,
|
||||
(WPARAM) event->client.message_type,
|
||||
event->client.data.l[0]);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_win32_screen_broadcast_client_message (GdkScreen *screen,
|
||||
GdkEvent *event)
|
||||
{
|
||||
check_for_too_much_data (event);
|
||||
|
||||
PostMessageW (HWND_BROADCAST, client_message,
|
||||
(WPARAM) event->client.message_type,
|
||||
event->client.data.l[0]);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_win32_display_sync (GdkDisplay * display)
|
||||
{
|
||||
|
@ -164,6 +164,9 @@ void _gdk_win32_window_move_region (GdkWindow *window,
|
||||
void _gdk_win32_selection_init (void);
|
||||
void _gdk_win32_dnd_exit (void);
|
||||
|
||||
GdkDragProtocol _gdk_win32_window_get_drag_protocol (GdkWindow *window,
|
||||
GdkWindow **target);
|
||||
|
||||
void gdk_win32_handle_table_insert (HANDLE *handle,
|
||||
gpointer data);
|
||||
void gdk_win32_handle_table_remove (HANDLE handle);
|
||||
@ -364,11 +367,6 @@ HICON _gdk_win32_pixbuf_to_hcursor (GdkPixbuf *pixbuf,
|
||||
gboolean _gdk_win32_pixbuf_to_hicon_supports_alpha (void);
|
||||
|
||||
/* GdkDisplay member functions */
|
||||
GdkNativeWindow _gdk_win32_display_get_drag_protocol (GdkDisplay *display,
|
||||
GdkNativeWindow xid,
|
||||
GdkDragProtocol *protocol,
|
||||
guint *version);
|
||||
|
||||
GdkCursor *_gdk_win32_display_get_cursor_for_type (GdkDisplay *display,
|
||||
GdkCursorType cursor_type);
|
||||
GdkCursor *_gdk_win32_display_get_cursor_for_name (GdkDisplay *display,
|
||||
@ -388,13 +386,6 @@ gboolean _gdk_win32_display_supports_cursor_color (GdkDisplay *display);
|
||||
|
||||
GList *_gdk_win32_display_list_devices (GdkDisplay *dpy);
|
||||
|
||||
gboolean _gdk_win32_display_send_client_message (GdkDisplay *display,
|
||||
GdkEvent *event,
|
||||
GdkNativeWindow winid);
|
||||
void _gdk_win32_display_add_client_message_filter (GdkDisplay *display,
|
||||
GdkAtom message_type,
|
||||
GdkFilterFunc func,
|
||||
gpointer data);
|
||||
void _gdk_win32_display_sync (GdkDisplay * display);
|
||||
gboolean _gdk_win32_display_has_pending (GdkDisplay *display);
|
||||
void _gdk_win32_display_queue_events (GdkDisplay *display);
|
||||
@ -412,7 +403,7 @@ gboolean _gdk_win32_display_set_selection_owner (GdkDisplay *display,
|
||||
guint32 time,
|
||||
gboolean send_event);
|
||||
void _gdk_win32_display_send_selection_notify (GdkDisplay *display,
|
||||
GdkNativeWindow requestor,
|
||||
HWND requestor,
|
||||
GdkAtom selection,
|
||||
GdkAtom target,
|
||||
GdkAtom property,
|
||||
@ -482,7 +473,6 @@ void _gdk_win32_window_delete_property (GdkWindow *window, GdkAtom property);
|
||||
|
||||
/* Stray GdkWin32Screen members */
|
||||
GdkVisual *_gdk_win32_screen_get_system_visual (GdkScreen *screen);
|
||||
void _gdk_win32_screen_broadcast_client_message (GdkScreen *screen, GdkEvent *event);
|
||||
gboolean _gdk_win32_screen_get_setting (GdkScreen *screen, const gchar *name, GValue *value);
|
||||
gint _gdk_win32_screen_visual_get_best_depth (GdkScreen *screen);
|
||||
GdkVisualType _gdk_win32_screen_visual_get_best_type (GdkScreen *screen);
|
||||
|
@ -228,7 +228,6 @@ gdk_win32_screen_class_init (GdkWin32ScreenClass *klass)
|
||||
screen_class->make_display_name = gdk_win32_screen_make_display_name;
|
||||
screen_class->get_active_window = gdk_win32_screen_get_active_window;
|
||||
screen_class->get_window_stack = gdk_win32_screen_get_window_stack;
|
||||
screen_class->broadcast_client_message = _gdk_win32_screen_broadcast_client_message;
|
||||
screen_class->get_setting = _gdk_win32_screen_get_setting;
|
||||
screen_class->visual_get_best_depth = _gdk_win32_screen_visual_get_best_depth;
|
||||
screen_class->visual_get_best_type = _gdk_win32_screen_visual_get_best_type;
|
||||
|
@ -324,7 +324,7 @@ _gdk_win32_display_set_selection_owner (GdkDisplay *display,
|
||||
tmp_event.selection.selection = selection;
|
||||
tmp_event.selection.target = _utf8_string;
|
||||
tmp_event.selection.property = _gdk_selection;
|
||||
tmp_event.selection.requestor = hwnd;
|
||||
tmp_event.selection.requestor = gdk_win32_handle_table_lookup (hwnd);
|
||||
tmp_event.selection.time = time;
|
||||
|
||||
gdk_event_put (&tmp_event);
|
||||
@ -349,11 +349,11 @@ _gdk_win32_display_get_selection_owner (GdkDisplay *display,
|
||||
if (owner == NULL)
|
||||
return NULL;
|
||||
|
||||
return gdk_win32_handle_table_lookup ((GdkNativeWindow) owner);
|
||||
return gdk_win32_handle_table_lookup (owner);
|
||||
}
|
||||
|
||||
window = gdk_win32_window_lookup_for_display (display,
|
||||
(GdkNativeWindow) g_hash_table_lookup (sel_owner_table, selection));
|
||||
g_hash_table_lookup (sel_owner_table, selection));
|
||||
|
||||
GDK_NOTE (DND, {
|
||||
gchar *sel_name = gdk_atom_name (selection);
|
||||
@ -873,8 +873,8 @@ _gdk_selection_property_delete (GdkWindow *window)
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_win32_display_send_selection_notify (GdkDisplay *display,
|
||||
GdkNativeWindow requestor,
|
||||
_gdk_win32_display_send_selection_notify (GdkDisplay *display,
|
||||
HWND requestor,
|
||||
GdkAtom selection,
|
||||
GdkAtom target,
|
||||
GdkAtom property,
|
||||
|
@ -82,7 +82,7 @@ G_BEGIN_DECLS
|
||||
gboolean gdk_win32_window_is_win32 (GdkWindow *window);
|
||||
|
||||
/* Return the Gdk* for a particular HANDLE */
|
||||
gpointer gdk_win32_handle_table_lookup (GdkNativeWindow handle);
|
||||
gpointer gdk_win32_handle_table_lookup (HWND handle);
|
||||
/* Translate from window to Windows handle */
|
||||
HGDIOBJ gdk_win32_window_get_handle (GdkWindow *window);
|
||||
|
||||
@ -97,9 +97,9 @@ HICON gdk_win32_pixbuf_to_hicon_libgtk_only (GdkPixbuf *pixbuf);
|
||||
void gdk_win32_set_modal_dialog_libgtk_only (HWND window);
|
||||
|
||||
GdkWindow * gdk_win32_window_foreign_new_for_display (GdkDisplay *display,
|
||||
GdkNativeWindow anid);
|
||||
HWND anid);
|
||||
GdkWindow * gdk_win32_window_lookup_for_display (GdkDisplay *display,
|
||||
GdkNativeWindow anid);
|
||||
HWND anid);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -72,7 +72,7 @@ gdk_win32_handle_table_remove (HANDLE handle)
|
||||
}
|
||||
|
||||
gpointer
|
||||
gdk_win32_handle_table_lookup (GdkNativeWindow handle)
|
||||
gdk_win32_handle_table_lookup (HWND handle)
|
||||
{
|
||||
gpointer data = NULL;
|
||||
|
||||
|
@ -649,7 +649,7 @@ _gdk_win32_display_create_window_impl (GdkDisplay *display,
|
||||
|
||||
GdkWindow *
|
||||
gdk_win32_window_foreign_new_for_display (GdkDisplay *display,
|
||||
GdkNativeWindow anid)
|
||||
HWND anid)
|
||||
{
|
||||
GdkWindow *window;
|
||||
GdkWindowImplWin32 *impl;
|
||||
@ -660,14 +660,17 @@ gdk_win32_window_foreign_new_for_display (GdkDisplay *display,
|
||||
|
||||
g_return_val_if_fail (display == _gdk_display, NULL);
|
||||
|
||||
if ((window = gdk_win32_window_lookup_for_display (display, anid)) != NULL)
|
||||
return g_object_ref (window);
|
||||
|
||||
window = _gdk_display_create_window (display);
|
||||
window->visual = gdk_screen_get_system_visual (_gdk_screen);
|
||||
window->impl = g_object_new (GDK_TYPE_WINDOW_IMPL_WIN32, NULL);
|
||||
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
||||
impl->wrapper = window;
|
||||
parent = GetParent ((HWND)anid);
|
||||
parent = GetParent (anid);
|
||||
|
||||
window->parent = gdk_win32_handle_table_lookup ((GdkNativeWindow) parent);
|
||||
window->parent = gdk_win32_handle_table_lookup (parent);
|
||||
if (!window->parent || GDK_WINDOW_TYPE (window->parent) == GDK_WINDOW_FOREIGN)
|
||||
window->parent = _gdk_root;
|
||||
|
||||
@ -3063,8 +3066,8 @@ gdk_win32_window_shape_combine_region (GdkWindow *window,
|
||||
}
|
||||
|
||||
GdkWindow *
|
||||
gdk_win32_window_lookup_for_display (GdkDisplay *display,
|
||||
GdkNativeWindow anid)
|
||||
gdk_win32_window_lookup_for_display (GdkDisplay *display,
|
||||
HWND anid)
|
||||
{
|
||||
g_return_val_if_fail (display == _gdk_display, NULL);
|
||||
|
||||
@ -3390,6 +3393,7 @@ gdk_window_impl_win32_class_init (GdkWindowImplWin32Class *klass)
|
||||
impl_class->set_opacity = gdk_win32_window_set_opacity;
|
||||
//impl_class->set_composited = gdk_win32_window_set_composited;
|
||||
impl_class->destroy_notify = gdk_win32_window_destroy_notify;
|
||||
impl_class->get_drag_protocol = _gdk_win32_window_get_drag_protocol;
|
||||
impl_class->register_dnd = _gdk_win32_window_register_dnd;
|
||||
impl_class->drag_begin = _gdk_win32_window_drag_begin;
|
||||
impl_class->process_updates_recurse = gdk_win32_window_process_updates_recurse;
|
||||
|
Loading…
Reference in New Issue
Block a user