Commit Graph

7412 Commits

Author SHA1 Message Date
Daniel Boles
3986326bbf RGBA: tiny grammar improvements in to_string doc 2018-12-17 20:16:42 +00:00
Daniel Boles
be60ddbec9 RGBA: Consistently use “” around inline arg names
instead of being inconsistent and not using them later, which leaves a
bunch of single letters floating among real words, not the prettiest.
2018-12-17 20:16:42 +00:00
Daniel Boles
33a966952a RGBA: Fix example to_string output for reality/CSS
* We don't output spaces anywhere in the code, unlike the doc suggested.
* CSS explicitly forbids whitespace between function names and lparens:
  https://stackoverflow.com/questions/13877198
2018-12-17 20:16:42 +00:00
Chun-wei Fan
013b9cbc1f gdkevents-win32.c: Fix GDK_SETTING event notification on IME change
We need to call g_strdup() on the name that we pass in for notifying the
GDK_SETTING event so that when we do gdk_event_free() later we will not
get a crash (stack corruption) that results from attempting to g_free()
something that is not dynamically allocated.
2018-12-17 12:43:24 +08:00
John Ralls
aeec73f53f Refine GdkQuartzNSWindow convertPointToScreen:
and convertPointFromScreen:, making them handle all MacOS versions
so that all of the if-deffing happens in the function definitions.
This happens to fix issue 1518 because it turns out that contrary
to the annotation in the 10.14 nNSWindow.h, convertPointToScreen and
convertPointFromScreen originate in 10.14, not 10.12.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1518
2018-12-15 16:28:44 -08:00
John Ralls
baa283b73b Don't make initializing return_val conditional.
Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1517
2018-12-15 16:28:44 -08:00
Daniel Boles
e3a1593a09 x11: Fix deprecation macro use
G_GNUC_END_IGNORE_DEPRECATIONS terminates the if statement and does not
consider the following block to be part of the if. So that block was
always taken irregardless of the pattern.

Fixes #1280
2018-12-13 17:22:22 +01:00
Benjamin Otte
6a47e9a8b9 x11: Be a lot more careful about setting ParentRelative
We don't want to set ParentRelative when:

- the parent window is NULL
  In that case we are unsure about the depth, so better err on the side
  of caution and avoid a BadMatch by accepting ugly output.
- the cairo pattern is in an error status
  This should never happen - unless you start up in OOM - but better
  be safe than sorry.

Might help with the spurious crashes in #1280.
2018-12-13 05:28:54 +01:00
Szunti
4c8fcd6a6f Add gdk_x11_display_get_parent_relative_pattern().
Fixes #1280, tray icons not drawing background. This is a magic pattern only
usable for gdk_window_set_background_pattern() that sets the underlying
X window's background to ParentRelative.
2018-12-12 02:56:35 +01:00
Chun-wei Fan
15935bb248 Merge branch 'win10-use-system-font' into 'gtk-3-24'
GDK W32: Always set gtk-font-name to the active UI font. Fixes #1484

See merge request GNOME/gtk!436
2018-12-10 06:20:34 +00:00
John Ralls
833ddc6e8d Silence enum type warning in 10.9. 2018-12-07 16:59:46 -08:00
John Ralls
9e212cd981 Prevent crash if display->touch_implicit_grabs is NULL. 2018-12-07 16:59:45 -08:00
John Ralls
5294c4f6f3 Fix crash if there are no grabs in place. 2018-12-07 16:59:45 -08:00
John Ralls
e786da9ca9 Complete GdkQuartzDisplay Implementation.
Changing FIXME on unneeded functions to X11-only where appropriate.
2018-12-07 16:59:45 -08:00
John Ralls
89c8c55fda Remove 2 unused functions. 2018-12-07 16:59:45 -08:00
John Ralls
eb2799cd7a Make _gdk_quartz_window_flush a no-op for MacOS 10.14 and later.
According to Apple's docs it's no longer necessary as Cocoa will notice
any changes and call drawRect as needed.
2018-12-07 16:59:45 -08:00
John Ralls
1165ab9d27 Replace deprecated gestalt for 10.10 and later.
It was deprecated in 10.8 but no replacement until 10.10.
2018-12-07 16:59:44 -08:00
John Ralls
ca6db9a79d Add compile-time check for NSGraphicsContext graphicsPort/CGContext.
Runtime check alone doesn't silence warning.
2018-12-07 16:59:44 -08:00
John Ralls
f30ed5ddc7 Fix Cocoa style and event constants for MacOS X 10.12 and later. 2018-12-07 16:59:44 -08:00
John Ralls
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
John Ralls
9773b1951c Clean up some unused variables. 2018-12-07 16:39:13 -08:00
John Ralls
85f52dceaa Replace NSInputManager for MacOS 10.6 and later. 2018-12-07 16:39:13 -08:00
John Ralls
08b871fa51 Replace the deprecated GdkDisplayManager with GdkSeat. 2018-12-07 16:39:13 -08:00
John Ralls
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
John Ralls
4d0cae4468 Replace convertBaseToScreen & convertScreenToBase.
With convertPointToScreen & convertPointFromScreen when
MacOS version is > =10.7, when the earlier functions were
deprecated and replaced.
2018-12-07 16:39:12 -08:00
John Ralls
74aecac6fe Remove commented-out code copied from X11 implementation. 2018-12-07 16:24:58 -08:00
John Ralls
2b1c3fba96 Reorder virtual method assignments and fill in missing ones.
Makes auditing easier.
2018-12-07 16:24:58 -08:00
Christoph Reiter
9e7cc89f4a GDK W32: Always set gtk-font-name to the active UI font. Fixes #1484
This makes apps use "Segoe UI 9" by default instead of whatever matches "Sans 10".
It also cleans up the code and uses some new pango API while at it.

This was previously disabled in 9e686d1fb5 because it led to a poor glyph coverage
on certain versions of Windows which don't default to "Segoe UI 9" (Chinese, Korean, ..)
because the font fallback list was missing in pango.

This is about to get fixed in https://gitlab.gnome.org/GNOME/pango/merge_requests/34
so enable it again when we detect a new enough pango version.
2018-12-07 09:32:14 +01:00
Christoph Reiter
5a23c0f038 GDK W32: set default settings for fontconfig
Enables hinting, antialiasing and set the subpixel orientation according to the
active clear type setting. This ensures that font rendering with the fontconfig backend
looks similar to the win32 backend, at least with the default system font.
2018-12-01 10:43:53 +01:00
Christoph Reiter
83204dd882 win32: Don't multiply the scroll event deltas by the Windows scroll lines setting. See #1408
GTK widgets expect the scroll deltas to be 1 or -1 and calculate a scroll value from that.
Multiplying the delta by the Windows scroll line setting (which defaults to 3) results
in a much larger delta and vastly different behaviour for running a GTK app on Windows
vs on Linux. For example text view and tree view scroll by 9 lines per scroll wheel tick
per default this way while on Linux it is around 3.

Remove the multiplication for now.
2018-11-24 10:24:27 +01:00
Timm Bäder
0040b256fe Merge branch 'gdk-cursor-new-deprecated-for' into 'gtk-3-24'
gdk: Add deprecated for macro for gdk_cursor_new

See merge request GNOME/gtk!416
2018-11-19 08:04:48 +00:00
Christoph Reiter
31b810abca g-i: Add some nullable annotations
Based on grepping arg docs for NULL.
See https://gitlab.gnome.org/GNOME/pygobject/issues/261
2018-11-18 13:40:24 +01:00
Robert Ancell
dea9525f68 gdk: Add deprecated for macro for gdk_cursor_new 2018-11-17 21:23:40 +13:00
John Ralls
bb376222c1 Reset the Quartz resolution to 72.0 dpi.
Further feedback on https://bugzilla.gnome.org/show_bug.cgi?id=787867
indicates that 96.0 dpi scales fonts 4/3 larger than native applications.
2018-11-14 09:02:45 +09:00
Matthias Clasen
d21832719b wayland: Adapt to settings portal api change
ReadAll now accepts an array of patterns.
2018-11-12 14:10:13 -05:00
Timm Bäder
f972ab8818 Merge branch 'plug_race' into 'gtk-3-24'
Fix race in GtkPlug window creation

See merge request GNOME/gtk!387
2018-11-08 04:49:25 +00:00
Matthias Clasen
8ef21cb32f wayland: Fix a thinko in settings portal support
When we decide to fall back because the settings portal
is not present, adhere to that decision elsewhere.
2018-11-05 18:34:57 -05:00
Matthias Clasen
41562ab2c6 wayland: Support the settings portal
Under Wayland, we are currently directly using GSettings
for desktop settings. But in a sandbox, we may not have
access to dconf, so this may fail. Use the new settings
portal instead.
2018-11-04 15:50:16 -05:00
Matthias Clasen
4073d0217b Add a gdk_should_use_portal helper
We are going to use this in the following commits.
2018-11-04 08:20:52 -05:00
Matthias Clasen
fb709e96f1 Use a simpler sandbox check
No need to use the runtime dir and allocate a string.
We can just check in /.
2018-11-04 08:20:11 -05:00
LRN
d45537a743 Merge branch 'win32-honest-clipboard' into 'gtk-3-24'
GDK W32: be more honest about clipboard format support

See merge request GNOME/gtk!382
2018-10-31 05:13:18 +00:00
John Ralls
9c6cf4acab Fix indentation. 2018-10-29 14:25:31 -07:00
John Ralls
7e4cda6c1c GdkQuartz: Handle NULL from [NSGraphicsContext currentContext].
By returning a default surface. The situation where there's no
currentContext arises when GtkCSS is trying to determine the
layout sizes so no actual display is necessary.

Closes: #1411
2018-10-20 12:31:25 -07:00
John Ralls
35d798dd31 Use [NSGraphicsContext CGContext] instead of graphicsPort after Yosemite. 2018-10-19 16:49:00 -07:00
John Ralls
0e831b774c Update GDK_OSX versions to current MacOS release. 2018-10-19 16:48:59 -07:00
LRN
05b11e9a5b Merge branch 'lrn/zorder-324' into 'gtk-3-24'
Don't let the OS maintain relative Z-order for windows

See merge request GNOME/gtk!196
2018-10-15 22:36:30 +00:00
Uli Schlachter
9ca38c4647 Fix race in GtkPlug window creation
According to the XEmbed specification, a window should be created
"elsewhere" and then reparented into the target parent window. Instead,
GTK+ creates the window directly in desired target parent window. This
allows some races to occur.

Another program that does not follow XEmbed is tabbed. XEmbed requires
an _XEMBED_INFO property on the to-be-embedded window, but tabbed does
not check for this property. Thus, as soon as GTK+ creates its window,
tabbed starts managing this window and now GTK+ setting up the window
races with tabbed starting to manage the window.

If tabbed is fast enough to map the window, GTK+ never sees a MapNotify
event, because it did not yet select StructureNotifyMask on its window.
This results in a black window inside of tabbed.

Note that this cannot really be fixed in tabbed, since XEmbed says that
the _XEMBED_INFO property must be already present when the window
appears. Thus, patching tabbed to wait for _XEMBED_INFO to appear is not
something that the spec requires/allows.

Instead, this commit changes GTK+ so that it directly sets the right
event mask when the window is created. This means that there is no more
race between tabbed mapping the window and GTK+ selecting
StructureNotifyMask.

Note that the proper fix would be to do as XEmbed requires: Create the
window elsewhere and then reparent it into the target window. However,
that would require a more invasive patch, so this commit only takes the
"easy approach" of fixing this one race. Hopefully, all the other races
that can occur during window setup are harmless, because the
embedder/socket will hopefully watch for PropertyNotify events as
needed.

Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/757
See-also: https://github.com/awesomeWM/awesome/issues/2385
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-10-14 14:01:25 +02:00
Ignacio Casal Quinteiro
2a392c220d quartz: do not cache the screen in the gdkmonitor
Instead we just cache the monitor number and get
out of it the nsscreen when it is needed. This is
a requirement since it nsscreen it is not supposed
to be cached.

Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/1312
2018-10-10 12:44:29 +02:00
Руслан Ижбулатов
f0959c9c8d GDK W32: Be honest about supported clipboard formats
Do not lie to W32 about the formats that we provide or accept.

Originally the logic behind such lies was that GdkPixbuf allows
us to convert any supported image to BMP or PNG, and therefore
we should announce that we always provide/accept BMP and PNG along
with other formats.

But that's not how it works. The conversion between formats happens
at GTK level in GtkClipboard or, if GtkClipboard is not used, with
gtk_target_list_add_image_targets() to announce all supported image
formats, and with gtk_selection_data_set_pixbuf() to convert from
any GdkPixbuf formats to the format requested by the selection, and
with gtk_selection_data_get_pixbuf() to convert from the selection
format to GdkPixbuf, if supported.

GDK simply does not play any role in this. Therefore W32 GDK backend
should only offer formats that it can actually do conversion for
by itself (such as image/bmp <-> CF_DIB,
or text/uri-list <-> CFSTR_SHELLIDLIST).
2018-10-07 12:15:41 +00:00
Руслан Ижбулатов
d26c11f099 GDK W32: Support switching input modules at runtime
This leverages the normal input module switching mechanism in GTK
by making it think that the gtk-im-module setting changed.
The backend returns gtk-im-module value as "ime" if W32
IME API says that an IME is in use. Otherwise it returns
and empty string - this still triggers an input module
loading code, which, not being able to load the desired module
(which is and empty string), falls back to looking at current
keyboard layout.

Paired with the code that signals gtk-im-module change on keyboard layout
switches, this is sufficient to make GTK capable of loading appropriate
input modules at runtime. At least, the kinds of modules that specify
languages for which they are loaded automatically by default, and the
IME module.

Loading other kinds of input modules might still work via specifying
the gtk-im-module setting in gtk ini file, but doing so will likely
make GTK incapable of loading the IME input module that is used
for Korean, Chinese and Japanese (and some other languages).

Until someone figures out a way to actually change gtk-im-module
setting on Windows at runtime with meaningful values, the behaviour
introduced by this commit seems like a sufficient workaround.
2018-10-06 12:44:24 +00:00