macos: track various changes in GDK

This commit is contained in:
Christian Hergert 2020-10-09 20:02:18 -07:00
parent 59cdd7ae69
commit 58f9413464
9 changed files with 21 additions and 22 deletions

View File

@ -28,6 +28,7 @@
#import "GdkMacosWindow.h"
#include "gdkmacosdisplay-private.h"
#include "gdkmacosmonitor-private.h"
#include "gdkmacossurface-private.h"
#include "gdkmacospopupsurface-private.h"
#include "gdkmacostoplevelsurface-private.h"
@ -352,7 +353,7 @@
monitor = _gdk_macos_display_get_monitor_at_display_coords ([self gdkDisplay],
currentLocation.x,
currentLocation.y);
gdk_macos_monitor_get_geometry (monitor, &geometry);
gdk_monitor_get_geometry (monitor, &geometry);
gdk_macos_monitor_get_workarea (monitor, &workarea);
_edge_snapping_set_monitor (&self->snapping, &geometry, &workarea);

View File

@ -28,8 +28,9 @@
#include "gdkmacoscursor-private.h"
#include "gdkmacosdevice.h"
#include "gdkmacosdisplay-private.h"
#include "gdkmacosdevice-private.h"
#include "gdkmacosdisplay-private.h"
#include "gdkmacossurface-private.h"
struct _GdkMacosDevice
{

View File

@ -242,7 +242,6 @@ fill_button_event (GdkMacosDisplay *display,
GDK_SURFACE (surface),
gdk_seat_get_pointer (seat),
NULL,
NULL,
get_time_from_ns_event (nsevent),
state,
get_mouse_button_from_ns_event (nsevent),
@ -283,7 +282,6 @@ synthesize_crossing_event (GdkMacosDisplay *display,
return gdk_crossing_event_new (event_type,
GDK_SURFACE (surface),
gdk_seat_get_pointer (seat),
NULL,
get_time_from_ns_event (nsevent),
state,
x,
@ -410,7 +408,6 @@ fill_key_event (GdkMacosDisplay *display,
return gdk_key_event_new (type,
GDK_SURFACE (surface),
gdk_seat_get_keyboard (seat),
NULL,
get_time_from_ns_event (nsevent),
[nsevent keyCode],
state,
@ -526,7 +523,6 @@ fill_pinch_event (GdkMacosDisplay *display,
return gdk_touchpad_event_new_pinch (GDK_SURFACE (surface),
gdk_seat_get_pointer (seat),
NULL,
get_time_from_ns_event (nsevent),
get_keyboard_modifiers_from_ns_event (nsevent),
phase,
@ -570,7 +566,6 @@ fill_motion_event (GdkMacosDisplay *display,
return gdk_motion_event_new (GDK_SURFACE (surface),
gdk_seat_get_pointer (seat),
NULL,
NULL,
get_time_from_ns_event (nsevent),
state,
x,
@ -623,7 +618,6 @@ fill_scroll_event (GdkMacosDisplay *self,
ret = gdk_scroll_event_new (GDK_SURFACE (surface),
pointer,
NULL,
NULL,
get_time_from_ns_event (nsevent),
state,
-sx,
@ -661,7 +655,6 @@ fill_scroll_event (GdkMacosDisplay *self,
emulated = gdk_scroll_event_new_discrete (GDK_SURFACE (surface),
pointer,
NULL,
NULL,
get_time_from_ns_event (nsevent),
state,
direction,
@ -675,7 +668,6 @@ fill_scroll_event (GdkMacosDisplay *self,
ret = gdk_scroll_event_new (GDK_SURFACE (surface),
pointer,
NULL,
NULL,
get_time_from_ns_event (nsevent),
state,
dx,
@ -1188,7 +1180,6 @@ _gdk_macos_display_synthesize_motion (GdkMacosDisplay *self,
event = gdk_motion_event_new (GDK_SURFACE (surface),
gdk_seat_get_pointer (seat),
NULL,
NULL,
get_time_from_ns_event ([NSApp currentEvent]),
state,
x,

View File

@ -503,7 +503,7 @@ _gdk_macos_display_surface_became_key (GdkMacosDisplay *self,
seat = gdk_display_get_default_seat (GDK_DISPLAY (self));
keyboard = gdk_seat_get_keyboard (seat);
event = gdk_focus_event_new (GDK_SURFACE (surface), keyboard, NULL, TRUE);
event = gdk_focus_event_new (GDK_SURFACE (surface), keyboard, TRUE);
_gdk_event_queue_append (GDK_DISPLAY (self), event);
/* We just became the active window. Unlike X11, Mac OS X does
@ -529,7 +529,7 @@ _gdk_macos_display_surface_resigned_key (GdkMacosDisplay *self,
seat = gdk_display_get_default_seat (GDK_DISPLAY (self));
keyboard = gdk_seat_get_keyboard (seat);
event = gdk_focus_event_new (GDK_SURFACE (surface), keyboard, NULL, FALSE);
event = gdk_focus_event_new (GDK_SURFACE (surface), keyboard, FALSE);
_gdk_event_queue_append (GDK_DISPLAY (self), event);
}
@ -897,7 +897,6 @@ _gdk_macos_display_break_all_grabs (GdkMacosDisplay *self,
event = gdk_grab_broken_event_new (grab->surface,
device,
NULL,
grab->surface,
TRUE);
node = _gdk_event_queue_append (GDK_DISPLAY (self), event);

View File

@ -37,8 +37,11 @@ typedef struct _GdkMacosMonitorClass GdkMacosMonitorClass;
GDK_AVAILABLE_IN_ALL
GType gdk_macos_monitor_get_type (void);
void gdk_macos_monitor_get_workarea (GdkMonitor *monitor,
GDK_AVAILABLE_IN_ALL
void gdk_macos_monitor_get_geometry (GdkMonitor *self,
GdkRectangle *geometry);
GDK_AVAILABLE_IN_ALL
void gdk_macos_monitor_get_workarea (GdkMonitor *self,
GdkRectangle *geometry);
G_END_DECLS

View File

@ -25,6 +25,7 @@
#include "gdkpopupprivate.h"
#include "gdkmacosdisplay-private.h"
#include "gdkmacosmonitor.h"
#include "gdkmacospopupsurface-private.h"
#include "gdkmacosutils-private.h"
@ -60,7 +61,7 @@ gdk_macos_popup_surface_layout (GdkMacosPopupSurface *self,
self->layout = gdk_popup_layout_ref (layout);
}
monitor = gdk_surface_get_layout_monitor (surface, layout,
monitor = gdk_surface_get_layout_monitor (GDK_SURFACE (self), layout,
gdk_macos_monitor_get_workarea);
gdk_macos_monitor_get_workarea (monitor, &bounds);

View File

@ -84,7 +84,7 @@ _gdk_macos_surface_reposition_children (GdkMacosSurface *self)
_gdk_macos_popup_surface_reposition (GDK_MACOS_POPUP_SURFACE (child));
}
if (GDK_IS_POPUP (self) || self->did_initial_present)
if (GDK_IS_POPUP (self))
g_signal_emit_by_name (self, "popup-layout-changed");
}
@ -820,7 +820,6 @@ _gdk_macos_surface_synthesize_null_key (GdkMacosSurface *self)
event = gdk_key_event_new (GDK_KEY_PRESS,
GDK_SURFACE (self),
gdk_seat_get_keyboard (seat),
NULL,
GDK_CURRENT_TIME,
0,
0,

View File

@ -25,6 +25,7 @@
#include "gdktoplevelprivate.h"
#include "gdkmacosdisplay-private.h"
#include "gdkmacosmonitor-private.h"
#include "gdkmacostoplevelsurface-private.h"
#include "gdkmacosutils-private.h"
@ -95,6 +96,7 @@ static gboolean
_gdk_macos_toplevel_surface_present (GdkToplevel *toplevel,
GdkToplevelLayout *layout)
{
GdkSurface *surface = GDK_SURFACE (toplevel);
GdkMacosToplevelSurface *self = (GdkMacosToplevelSurface *)toplevel;
NSWindow *nswindow = _gdk_macos_surface_get_native (GDK_MACOS_SURFACE (self));
GdkDisplay *display = gdk_surface_get_display (surface);
@ -190,10 +192,11 @@ _gdk_macos_toplevel_surface_present (GdkToplevel *toplevel,
(GDK_MACOS_SURFACE (self)->shadow_left ||
GDK_MACOS_SURFACE (self)->shadow_top))
{
GdkMonitor *monitor = _gdk_macos_surface_get_best_monitor (GDK_MACOS_SURFACE (self));
int x = GDK_SURFACE (self)->x;
int y = GDK_SURFACE (self)->y;
monitor = _gdk_macos_surface_get_best_monitor (GDK_MACOS_SURFACE (self));
if (monitor != NULL)
{
GdkRectangle visible;

View File

@ -43,6 +43,7 @@ gdk_macos_frameworks = [
'Carbon',
'CoreVideo',
'CoreServices',
'Foundation',
'OpenGL',
'QuartzCore',
]