Commit Graph

855 Commits

Author SHA1 Message Date
John Ralls
69135bcfe3 Accommodate macOS 11.0 Big Sur in gdk_quartz_osx_version.
This may need to be changed next year, it depends on what Apple
decides to do with version numbers going forward.

Also updated GdkOSXVersion to include Catalina and Big Sur.
2020-08-11 17:08:53 -07:00
Biggio
4b953dee70 quartz: mimic source device axes
Input devices such as stylus pens have additional axes besides (x,y)
coordinates. In order for these devices to work properly, their additional
axes need to be mimicked from the physical device to the associated
virtual pointer when they become active.
2020-07-08 15:26:06 +02:00
John Ralls
04ed7fe7db [Quartz]Fix some deprecation and unused variable warnings. 2020-06-20 11:16:18 -07:00
John Ralls
3f5cf71039 [Quartz] Correct availability macro name. 2020-06-20 10:06:19 -07:00
John Ralls
c884308da3 [Quartz] Only normal toplevels should be in the Windows menu.
The Quartz Window Manager adds to the Windows menu all NSWindows with
titles. Since we assign a default title to all windows that produced a
rather cluttered Windows menu containing among other things dialogs.
Setting aside that dialogs don't belong in the Windows menu, if
a dialog was hidden for reuse instead of destroyed it would persist in
the Windows menu and if clicked there would show, but because it wasn't
running wouldn't respond to events and so couldn't be hidden again and
would remain on top of its parent window.

Ref: https://bugs.gnucash.org/show_bug.cgi?id=797807
2020-06-20 09:49:44 -07:00
Andreas Butti
ecbed15d47 Support for macOS Pen / Eraser input #1551
This fix is based on this patch: https://bugzilla.gnome.org/show_bug.cgi?id=695701
2020-05-19 16:10:07 +02:00
Thomas Holder
e278f38905 macOS: fix #2436 raise transient window on focus 2020-04-02 17:57:18 +02:00
LecrisUT
788fef5e80 Monitor_added signal after configure
Fixed order of monitor_added signal for Quartz display.
2020-03-26 13:06:45 +09:00
Torsten Maehne
245ea77da6 Fix spelling of AppKit framework in gdkquartz-gtk-only.h
gtk+-3.24.14 with quartz backend fails to compile on macOS when using
a case-sensitive file system. The cause for the compilation error is a
simple typo in line 26 of `gdk/quartz/gdkquartz-gtk-only.h`. The
AppKit framework is included there with `<Appkit/Appkit.h>` instead of
`<AppKit/AppKit.h>`, which is fixed with this commit.

References: https://trac.macports.org/ticket/60168
Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/2503
2020-03-10 19:21:23 +01:00
David Hogan
a1720b97a4 Prevent Quartz/CoreGraphics runtime assertion failures.
gdk_window_impl_quartz_release_context () can be called with a NULL CGContextRef. This causes CoreGraphics assertion failures when debugging a Gtk application in Xcode, as the code was blindly passing that NULL to CGContextRestoreGState () and CGContextSetAllowsAntialiasing (). Given that the matching pair of CGContextSaveGState () and CGContextSetAllowsAntialiasing () calls are already checking for a NULL CGContextRef, it seems reasonable to wrap these calls in a NULL check.
2020-02-17 10:02:50 +11:00
Thomas Holder
5e8d97ef0b gdk quartz: add missing include (-Werror=implicit)
Regression of GNOME/gtk!641 (ef72fe750a)
2020-02-02 11:16:40 +01:00
Thomas Holder
528f780871 gdk quartz: add missing include
Fixes startup crash with Inkscape.

Regression of GNOME/gtk!641 (ef72fe750a)
2020-02-01 23:56:56 +01:00
Alex Samorukov
4a1dc1abfa Merge branch 'gtk-3-24-issue-2102' into 'gtk-3-24'
gdk_quartz_keymap_translate_keyboard_state fills consumed_modifiers incorrectly (closes #2102)

See merge request GNOME/gtk!1225
2020-01-10 21:07:46 +00:00
Alex Samorukov
76e95a702f impl_class->set_functions listed twice in the object 2020-01-08 14:17:36 +00:00
Alex Samorukov
6fdef1055b move [NSApplication sharedApplication] after _gdk_quartz_events_init() to avoid initialization issues 2020-01-08 14:13:36 +00:00
Alex Samorukov
2406badb92 Fix was_fullscreen flag (again!) 2020-01-08 13:56:10 +00:00
Alex Samorukov
5cdca80c0c Fix typo which preventing fullscreen state from being updated correctly 2020-01-03 17:54:12 +00:00
John Ralls
235d28f02d Fix visibiity of gdkselection-quartz.c exported gtk-only functions.
Also ensure that gdkquartz-gtk-only.h is included in distribution
tarballs.

Failing to include gdkquartz-gtk-only.h in gdkselection-quartz.c
caused the compiler to not set the extern storage class on the
functions, in turn causing them to be not exported by libgdk-3.0.dylib.

Fixes https://gitlab.gnome.org/GNOME/gtk/issues/32 again.
2019-12-10 21:46:59 -08:00
Thomas Holder
af6487d70c gdk: quartz: fix #2102 consumed_modifiers 2019-12-01 15:14:20 +01:00
Matthias Clasen
f0002ad372 Merge branch 'no-objc' into 'gtk-3-24'
Hide Objective-C from outside GdkQuartz.

See merge request GNOME/gtk!641
2019-11-27 13:39:40 +00:00
Matthias Clasen
61d7700c17 Merge branch 'gtkq-events' into 'gtk-3-24'
gdk: quartz: prevent titlebar events from falling to the window below

See merge request GNOME/gtk!1140
2019-11-27 13:31:39 +00:00
Jiří Techet
817e99640d gdk: quartz: Avoid page up/down getting filtered by gtk_im_context_filter_keypress()
For page up/down events (Fn+up_arrow and Fn+down_arrow on macOS)
gtk_im_context_filter_keypress() currently returns TRUE when im-quartz is
used. This means these events get removed when this function is used
(happens e.g. with the Scintilla text editing library).

Adding scrollPageDown: and scrollPageUp: into GdkQuartzView seems to
resolve the issue as these seem to get called instead of the already
present pageUp: and pageDown:.
2019-10-24 21:48:30 +02:00
Jeremy Tan
f91b429839 gdk: quartz: prevent titlebar events from falling to the window below 2019-10-19 20:27:50 +08:00
John Ralls
a12931b9f8 Silence compiler type warnings about converting enums to gboolean. 2019-08-28 19:54:58 -07:00
James Westman
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
John Ralls
3994e75550 Redo the fullscreen MacOS version control to allow building on 10.6
Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1686
2019-06-22 14:43:50 -07:00
John Ralls
a26f6d9768 Prevent compile error for pressedMouseButtons when using SDK < 10.6.
Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1687
2019-06-22 14:30:59 -07:00
John Ralls
ef72fe750a Hide Objective-C from outside GdkQuartz.
Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1737

Don't export any functions taking or returning MacOS types in
gdkquartz.h, gdkprivate-quartz.h, or any header that either includes.

The GdkQuartz internal functions are moved to a new header
gdkinternal-quartz.h, the functions used by quartz-specific
Gtk files are moved to another new header gdkquartz-gtk-only.h, and
the key and event enums to a new header gdkkeys-quartz.h.
2019-06-22 13:37:46 -07:00
John Ralls
4d7d44c717 Replace obsolete GdkScreen-based method of finding the toplevel at point.
With the more current GdkDisplay function.
Also separate the if statements with blank lines.
2019-05-20 14:35:32 -07:00
John Ralls
9c33adf118 Don't call g_object_ref on NULL, it whines.
Fixes https://gitlab.gnome.org/GNOME/gtk/issues/1822
2019-05-20 14:35:32 -07:00
James Westman
b7ec3b163f quartz: Add missing g_object_ref
A g_object_ref() call was missing, sometimes causing crashes during
drag-and-drop operations. The matching g_object_unref() is at
gdk/gdkdnd.c:261.

The logic in this function is still wrong--it finds the wrong GdkWindow under
some circumstances--but this commit fixes the crash.

Part of #1840.
2019-04-22 19:59:14 -05:00
Christoph Reiter
d52dad2042 autotools: dist all meson related build files 2019-04-11 16:45:36 +02:00
Philippe Normand
89d5c543ac meson: Build fixes for macOS 2019-04-11 16:45:36 +02:00
Nirbheek Chauhan
a4fe15d9f0 meson: Sync build files with master and update to 3.24 2019-04-11 16:45:27 +02:00
Philip Chimento
f264e0dbf9 quartz: Update GL context on window resize
The previous version of this patch sent an update message to the
NSOpenGLContext in a GdkGLContext::update vfunc, but that vfunc does not
exist any more.

See: #517
2019-03-29 11:25:29 +01:00
Brion Vibber
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
John Ralls
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
John Ralls
5c039a1aa0 [GdkQuartz] Set the toplevel for the pointer if it's NULL.
Gdk sometimes misses crossing events on popups, so the cached toplevel
may be NULL. If it is, find the toplevel under the pointer and set it.

Fixes https://gitlab.gnome.org/GNOME/gtk/issues/623
2019-03-18 13:01:11 -07:00
John Ralls
3a959e984f Force a window resize if the content view frame changes.
Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1029

Should fix most if not all other cases where system-caused changes to
the NSWindow result in the Gdk coordinates not mapping correctly to the
AppKit coordinates.
2019-03-17 10:15:30 -07:00
John Ralls
0f5603e74f Use n_displays for all monitor counts. 2019-03-11 16:52:07 -07:00
John Ralls
0524362721 Reverse signs on gdk <-> ns x coordinate transforms.
Closes https://gitlab.gnome.org/GNOME/gtk/issues/1711
2019-03-11 16:28:23 -07:00
John Ralls
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
John Ralls
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
John Ralls
28848176e5 Don't scan the seat's slave list for keyboards.
There aren't any, just the master_keyboard which one accesses with
gdk_seat_get_keyboard().
2019-03-11 16:16:47 -07:00
John Ralls
9a0e40b6da Restore switching keyWindow when changing windows.
Inadvertently removed when converting from gdkdevicemanager to gdkseat.
2019-03-11 16:16:46 -07:00
John Ralls
db84dc8e58 Fix crash when closing a fullscreen window. 2019-03-11 16:16:46 -07:00
John Ralls
03c5b92da2 [quartz] Full-screen only "normal" windows and splashscreens.
So dialogs, pop-ups, etc. behave as expected when parent is in
full-screen.

Tiling is allowed for normal windows and splash screens and disallowed
for others.
Closes https://gitlab.gnome.org/GNOME/gtk/issues/1627
2019-03-03 20:05:13 -08:00
John Ralls
512da66761 Silence incompatible type warning. 2019-02-19 11:08:02 -08:00
John Ralls
f3b1704a99 Remove unnecessary casts and silence may-not-return-value warning.
NSPoint and NSRect are typedefs of CGPoint and CGRect so the casts
were unnecessary and confused llvm when compiling 32-bit.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1640
2019-02-19 11:08:02 -08:00
John Ralls
6afd174162 Merge branch 'suyuan/fix-macos-accented-char-input' into gtk-3-24. 2019-02-17 13:04:20 -08:00