Commit Graph

82 Commits

Author SHA1 Message Date
acb183ef7c [quartz] Remove unused variable. 2023-05-09 13:58:22 -07:00
33fd9eb472 [quartz] Convert frame_link, windows_awaiting_frame to GSList.
We were't using GList's prev member; worse, we weren't setting it
and that broke g_list_remove_link so that the link wasn't removed
in _gdk_quartz_display_remove_frame_callback.

Closes #5593
2023-03-23 11:44:33 -07:00
8182c978db quartz: add CVDisplayLink based frame clock
This uses CVDisplayLink to drive the GdkFrameClock. A GdkWindow
can register a frame callback to thaw their frame clock as necessary
based on the next notification from CVDisplayLink.

CVDisplayLink notifies us on a high-priority thread. We use the same
NSEventas gdkeventloop-quartz.c to wakeup the main loop. This is done
so that we don’t pathologically wake up the select thread to then
continue notifying the main loop.

We use an embedded GList node in the GdkWindowImplQuartz so that we
can avoid allocating any lists or arrays for pending frame callbacks.
Compare this to the same design in GdkWindow for children.
2022-05-19 16:29:01 -07:00
71e2821578 gdkquartz: fix crash on uninitialized attribute
`gdk_quartz_display_get_monitor_at_window` crashes when it tries to access the NSWindow on
an offscreen window. The attribute `toplevel` of `impl` is uninitialized and
causes a segfault.

This partially fixes: https://gitlab.gnome.org/GNOME/gimp/-/issues/7608
2021-12-16 13:00:02 +00:00
e9d4b0dda0 Move includes of gdkinternal-quartz.h from headers to impl files.
gdkinternal-quartz.h isn't installed but the headers that included
it are, which which would cause the build to fail if an external
project included one of them.

Also changed the includes in gdkinteral-quartz.h to local for
faster loading.
2021-09-07 11:08:11 -07:00
788fef5e80 Monitor_added signal after configure
Fixed order of monitor_added signal for Quartz display.
2020-03-26 13:06:45 +09:00
6fdef1055b move [NSApplication sharedApplication] after _gdk_quartz_events_init() to avoid initialization issues 2020-01-08 14:13:36 +00:00
abaf682870 macOS: Fix GdkScreen::monitors-changed
This signal was not being emitted on macOS, a bug introduced in 941f3c38.
`emit_monitors_changed` was never set to TRUE, so the signal was never
emitted. `emit_monitors_changed` has now been removed, because its
functionality was moved to GdkDisplay.

In addition, kCGDisplayDesktopShapeChangedFlag was removed from the list of
flags that indicate a new/reconfigured monitor, because monitor removals also
include this flag, which caused removed monitors to not be removed from
GdkDisplay.

Fixes #2004.
2019-07-15 15:40:48 -05:00
f34709807f quartz: implement GdkGLContext for Quartz backend
Current problems:
* other widgets in a GL-painted window are low-resolution on Retina
  display
* something wrong with paint updates; gdkgears demo only updates every
  couple of seconds but reports ~30fps

See: #517
2019-03-29 11:25:29 +01:00
024cb267dd [GdkQuartz] Fix two build issues
1. NSRect and CGRect aren't toll-free bridged in 32 bit builds.
2. NSWindowCollectionBehavior(Dis)AllowTiling is defined beginning in 10.11.
2019-03-21 16:01:51 -07:00
0f5603e74f Use n_displays for all monitor counts. 2019-03-11 16:52:07 -07:00
261f1dc395 Switch quartz monitors collection from hash table to ptr array.
It's easier to find in a ptr array than to iterate over a hash table.
2019-03-11 16:28:19 -07:00
3bd9a3453f Change computation of coordinates.
Transform GdkQuartzMonitor geometry to Gdk coordinate system.
Move computation of Display geometry from GdkQuartzScreen to
GdkQuartzDisplay and use AppKit coordinates.

Closes https://gitlab.gnome.org/GNOME/gtk/issues/1593
2019-03-11 16:26:50 -07:00
70b7b89411 [Quartz]Check mode before setting the monitor scale factor.
CGDisplayModeGetWidth returns 0 if mode is NULL; that happens if the
CGDisplay is offline or mirroring another monitor and it leads to a
divide-by-zero crash.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1565
2019-01-05 20:06:50 -08:00
1a9377bab9 quartz/display: add back scaling factor
With the last patches one thing that got lost if the scaling
factor. This is very visible when i.e loading a svg image
in a Retina display.
2018-12-18 18:08:47 +01:00
e786da9ca9 Complete GdkQuartzDisplay Implementation.
Changing FIXME on unneeded functions to X11-only where appropriate.
2018-12-07 16:59:45 -08:00
941f3c3887 Move the CGDisplayReconfigurationCallback to gdkdisplay-quartz.c.
Handling more flags, handling them correctly, and emitting the requisite
signals.

Change screen layout to use CGGetActiveDisplayList instead of NSScreens,
eliminating the latency between updating screens and recomputing the
root window.
2018-12-07 16:39:13 -08:00
28b8bbda45 Implement the GdkMonitor/GdkDisplay API.
Moving the initialization of the GdkQuartzMonitors to GdkQuartzDisplay from
the now-obsolete GdkQuartzScreen. Use QuartzDisplayServices for
monitor enumeration and to populate the GdkMonitor properties. This is
better aligned with acting on the Quartz Services callbacks for monitor
changes and with Cairo which also uses CoreGraphics for drawing.
2018-12-07 16:39:13 -08:00
2b1c3fba96 Reorder virtual method assignments and fill in missing ones.
Makes auditing easier.
2018-12-07 16:24:58 -08:00
8074626fc6 Add missing file and correct some warnings from quartz: Add monitor support. 2017-04-02 17:55:55 -07:00
2ad14d393b quartz: Add monitor support
This is a backport of a patch by Tom Schoonjans,

https://bugzilla.gnome.org/show_bug.cgi?id=779184
2017-04-01 16:50:12 -04:00
4a6f8a065a gdk: remove the display->list_devices vfunc
gdk_display_list_devices is deprecated and all the backends
implement the same fallback by delegating to the device manager
and caching the list (caching it is needed since the method does
not transfer ownership of the container).
The compat code can be shared among all backends and we can
initialize the list lazily only in the case someone calls the
deprecated method.

https://bugzilla.gnome.org/show_bug.cgi?id=762891
2016-02-29 21:53:58 +01:00
38ad57948c gdk: remove the core_pointer field from GdkDisplay
It is not used anymore, so no need to set it

https://bugzilla.gnome.org/show_bug.cgi?id=762820
2016-02-29 14:15:04 +01:00
502744be85 quartz: get the core pointer from the device manager
https://bugzilla.gnome.org/show_bug.cgi?id=762820
2016-02-29 14:15:04 +01:00
dfbd0c2b98 Implement gdk_display_get_cursor_for_surface in quartz
Left out of b2113b7, breaking quartz build
2013-08-11 10:43:48 -07:00
205c16df32 quartz: Remove unused variable 2013-05-11 14:47:48 +02:00
b75aa67bbe Remove framework initialization code
This is left over from an old effort to bundle gtk and its dependencies
into a Mac OS X Framework. The effort was more or less successful but
proved difficult to maintain and impractical to use because gtk programs
don't use the special Framework include syntax.
2013-05-10 17:25:58 -07:00
f3a5ad32f3 quartz: Move initialization code to display_class_init
This follows the same reasoning as the X11 backend in commit
0122a9da8e
2013-05-02 15:43:35 +02:00
f345051d36 displaymanager: Emit display-opened directly
Instead of letting every backend do it manually.
2013-04-19 16:18:25 -04:00
edbace1045 quartz: Emit GdkDisplay::opened signal 2013-04-19 16:18:25 -04:00
7ef508ff4a displaymanager: Handle list of displays in base class
This moves the add/remove_display() functions from the subclasses to
GdkDisplay and GdkDisplayManager. It also gets rid of the list_displays
vfunc.
2013-04-15 15:43:26 +02:00
a6b29d73d7 gdkdisplay: Remove get_screen() and get_n_screens() vfuncs 2013-04-02 11:45:44 +02:00
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
24360a8076 gdk/*: Use g_list_free_full convenience function 2012-01-05 04:22:42 +01:00
cd3896e10e quartz: actually register gdk_quartz_display_dispose 2011-05-22 12:29:37 +02:00
dfff35423f quartz: fix a typo 2011-05-22 12:27:38 +02:00
cfaed624be Update quartz to reflect deletion of GdkNativeWindow and client_message functions. 2011-02-01 13:53:00 -08:00
deffbd9885 quartz: reorder gdkprivate-quartz.h and related clean up 2010-12-23 14:17:42 +01:00
1e2907fa02 quartz: _gdk_quartz_screen -> gdk_quartz_screen 2010-12-23 14:17:42 +01:00
0d8eeb924e quartz: _gdk_quartz_display -> gdk_quartz_display 2010-12-23 14:17:42 +01:00
f15934bd66 quartz: remove gdkmain-quartz.c 2010-12-23 14:17:41 +01:00
caa9794af8 quartz: Clean up header files, use same arrangement as X11 backend 2010-12-23 14:17:41 +01:00
083c556e00 quartz: rename GdkDeviceManagerCore -> GdkQuartzDeviceManagerCore 2010-12-22 17:47:05 +01:00
32731fcb07 quartz: register before/after process all updates 2010-12-22 17:47:04 +01:00
552e7be7e5 quartz: set window_type in display_class 2010-12-22 17:47:04 +01:00
b638515ae0 quartz: re-introduce _gdk_quartz_display_list_devices 2010-12-22 17:47:03 +01:00
c14078f388 quartz: adapt gdkdisplay-quartz.c to new function names 2010-12-22 17:47:03 +01:00
b2844cb48b quartz: Make GdkQuartzDisplay compile 2010-12-22 17:47:02 +01:00
bd1ff477ca Deal with property encoding functions for quartz 2010-12-22 17:47:01 +01:00
de41790470 Implement selection related vfuncs for quartz 2010-12-22 17:47:01 +01:00