Commit Graph

7500 Commits

Author SHA1 Message Date
Timm Bäder
abe80bb7c4 meson: Use -Bsymbolic 2017-05-03 15:10:51 +01:00
Timm Bäder
5116b2b612 meson: Require gtkmarshal_h before we build gtk 2017-05-03 15:10:51 +01:00
Timm Bäder
2144b776b2 meson: Generate demos.h for gtk3-demo 2017-05-03 15:10:51 +01:00
Timm Bäder
294ebd70b3 build: Generate wayland protocol files 2017-05-03 15:10:51 +01:00
Timm Bäder
41d019851c wayland: Include generated sources from builddir, not srcdir 2017-05-03 15:10:51 +01:00
Timm Bäder
3f62b935e5 meson: Use xrandr 2017-05-03 15:10:51 +01:00
Timm Bäder
df965304d4 meson: make gtk buildable
x11 only
2017-05-03 15:10:51 +01:00
Timm Bäder
082cf3553d meson: Build gtk marshallers
And fix libgtk_dep/libgdk_dep to link_with the shared lib
2017-05-03 15:10:50 +01:00
Timm Bäder
7fff2901aa meson: Add options for x/wayland/broadway backends 2017-05-03 15:10:50 +01:00
Timm Bäder
5475768d32 Meson build v2 2017-05-03 15:10:50 +01:00
Emmanuele Bassi
7a90e06a3c Add Meson build files
Original work by: Jussi Pakkanen <jpakkane@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=769881
2017-05-03 15:10:50 +01:00
Emmanuele Bassi
71ad17cae1 Remove gdkkeysyms-compat.h
The compatibility header was needed after GTK+ 3.0 renamed the key
symbols from `GDK_*` to `GDK_KEY_*` to avoid collisions.
2017-05-03 14:54:37 +01:00
Timm Bäder
5c79d65717 fallback-c89: Include config.h
It holds all the HAVE_<func> definitions.
2017-05-03 14:47:14 +01:00
Emmanuele Bassi
98b1075764 gdk: Remove GdkX11DisplayManager from the build
We don't instantiate it, and we don't use it any more.
2017-05-03 14:15:57 +01:00
Matthias Clasen
caacab13e9 Remove the gdk backend API too
The GTK+ level API for this is already gone.
2017-05-02 16:17:33 -04:00
Emmanuele Bassi
2a4f07ed9f wayland: Annotate the log_handler function
The log_handler() internal function is a candidate for the GCC format
attribute for printf-like functions.
2017-04-28 23:12:26 +01:00
Emmanuele Bassi
739588cc3c wayland: Add declaration of private get_type() function 2017-04-28 23:03:14 +01:00
Emmanuele Bassi
278e54b88d gdk: Make more private functions static
These symbols are not exported and are local to their compilation unit.
2017-04-28 23:03:10 +01:00
Emmanuele Bassi
7619c9c739 wayland: Mark private function as static 2017-04-28 22:47:29 +01:00
Emmanuele Bassi
82800fae52 wayland: Mark private function as static
The selection_lookup_offer_by_atom() function is private to the file and
not used elsewhere.
2017-04-28 22:21:19 +01:00
Emmanuele Bassi
4724a89022 build: Don't include the marshallers header file
We used to inject the inclusion of the generated header file into the
generated body of the marshallers source code in order to avoid compiler
warnings about missing prototypes. The glib-genmarshal utility has been
fixed in GLib to include the prototype in the generated source, so now
we're going to trip -Werror=redundant-decls.
2017-04-28 21:50:41 +01:00
Olivier Fourdan
502e0a3a9e wayland: make key event log more explicit
With Wayland, GDK_DEBUG=events would log key events but not explicitly
state whether the event is a key press or release, or if it's
originating from a key repeat.

Add some more verbosity to make sure these informations are logged on
key delivery when GDK_DEBUG is set.

https://bugzilla.gnome.org/show_bug.cgi?id=781767
2017-04-28 13:09:39 +02:00
Florian Müllner
5527732763 gdk: Relicense translate_wm_button_layout_to_gtk()
It is generally a good idea to license individual files under the
same terms as the project license (in particular when the mismatch
boils down to having copied the wrong license header), so relicense
the code under the LGPL.

https://bugzilla.gnome.org/show_bug.cgi?id=781422
2017-04-27 21:05:12 +02:00
Timm Bäder
5852da22bf gdk: Add 3.92 version macros 2017-04-25 20:29:02 +02:00
Matthias Clasen
2e7db0d662 Fix a typo 2017-04-21 18:28:56 -04:00
John Ralls
139b669196 Replace NSScreen:userSpaceScaleFactor, deprecated since MacOS X 10.7.
userSpaceScaleFactor is not compatible with high-resolution (aka HiDPI)
displays.
2017-04-11 16:10:51 -07:00
William Hua
8b271e7b8c mir: clean up an ugly function 2017-04-03 13:29:06 -04:00
Tom Schoonjans
98d9a05a0c quartz: code cleanup
removed unused static functions, unused class variables and a large
comment section that was copied over from gdkdisplay-x11.h

https://bugzilla.gnome.org/show_bug.cgi?id=779184
2017-04-01 16:45:37 -04:00
Tom Schoonjans
758d26738a quartz: add support for Gtk+4
The addition of GdkMonitor broke the quartz backend. This patch restores
that support by adding a new class GdkQuartzMonitor, and by modifying
the existing classes GdkQuartzDisplay and GdkQuartzScreen where
necessary.

It should be noted that this patch is essentially a refactor as no new
functionality that will impact the user has been added or removed.

https://bugzilla.gnome.org/show_bug.cgi?id=779184
2017-04-01 16:45:37 -04:00
William Hua
94db94a78b mir: set application name when creating connection 2017-04-01 11:05:27 -04:00
William Hua
8985643966 mir: remove keymap and input device state warnings 2017-03-31 17:36:47 -04:00
William Hua
c638fb952c mir: re-write settings implementation 2017-03-31 15:27:53 -04:00
Olivier Fourdan
19ce6a8bc5 gdkwindow: subsurface in gdk_window_get_parent()
When the GtkWidget hierarchy does not match the GdkWindow hierarchy, the
GtkWidget code may find a common ancestor that cannot be found while
traversing the GdkWindow tree using gdk_window_get_parent().

This happens with for example on Wayland, a GtkPopover has another
GtkPopover as parent, in this case, the GdkWindow parent is the root
window, whereas the GtkWidget parent is the other GtkPopover.

That confuses the gtk_widget_translate_coordinates() logic which will
bail out in this case and won't return the translated coordinates.

Make gdk_window_get_effective_parent() aware of subsurfaces and use the
transient_for which represents the actual parent (whereas the parent
might be pointing to the root window).

Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=774148
2017-03-30 15:46:25 +02:00
Matthias Clasen
2761fae728 Work around a wayland crash
For some reason, we are seeing damage being NULL here.
While that should never be the case, crashing on it is
unkind and makes the Wayland experience unusable.
2017-03-30 09:15:29 -04:00
Matthias Clasen
6963d9e2ee Avoid unused variable warnings 2017-03-23 16:15:00 +00:00
William Hua
e69b4dc3da mir: always emit a resize when creating windows 2017-03-22 02:21:43 -04:00
Timm Bäder
ec2062498f glcontext: Fix buffer age comparison
The old code had a dead >=3 branch, causing flickering.
2017-03-21 19:04:58 +01:00
Timm Bäder
12b7d30a2d GdkWaylandWindow: Force window titles to valid utf8
Use the new g_utf8_make_valid in case the given title is not valid utf8.
Also bump the glib requirement to 2.51.5.
2017-03-20 20:04:26 +01:00
Timm Bäder
60ed515be9 GdkX11DeviceManager: Fix debugging output
The 2 values added in 3.22 were missing from the source_names array.
2017-03-19 15:44:15 +01:00
Timm Bäder
c78451e140 GdkMonitor: Use 1 as scale fallback value
The same value we use in gtk_widget_get_scale_factor.
2017-03-19 15:44:15 +01:00
Timm Bäder
56e809be9c GdkDrawingContext: Add missing break in switch statement 2017-03-18 07:07:06 +01:00
Murray Cumming
158015be6c
docs: Remove mentions of gtk_init_with_args().
Because it has been removed: See commit 7e8eb3ddcd
2017-03-17 21:12:12 +01:00
Christoph Reiter
b843efcb79 quartz: fix build for <10.12
The style mask type was changed from NSUInteger to NSWindowStyleMask.
Use NSUInteger so it also works on older macOS.

https://bugzilla.gnome.org/show_bug.cgi?id=780019
2017-03-15 07:18:48 -04:00
William Hua
05ca583515 mir: start handling resize events again 2017-03-13 10:52:42 -04:00
William Hua
3eb8694cbd mir: remove unused generate_configure_event () 2017-03-13 04:07:54 -04:00
William Hua
64753532ba mir: set placement for menu-type windows 2017-03-13 03:36:30 -04:00
William Hua
3914bcd678 mir: synthesize resize events 2017-03-13 02:52:15 -04:00
William Hua
24dc2d8986 mir: ignore resize events 2017-03-13 00:06:30 -04:00
William Hua
0c1cbcfe60 mir: try mir before x11 2017-03-12 22:40:04 -04:00
Matthias Clasen
e02924a77d quartz: Fix another typo 2017-03-10 07:26:05 -05:00
Matthias Clasen
0cb0542673 quartz: Fix the build
A ; was left out inadvertently.
2017-03-10 07:12:12 -05:00
William Hua
0b72eee311 mir: log additional event types 2017-03-09 23:42:41 -05:00
William Hua
dbb3f84796 mir: don't create GDK_INPUT_ONLY windows 2017-03-06 10:36:45 -05:00
Matthias Clasen
8531ee4c88 Quartz: Implement gdk_window_set_functions
This is useful, and easy to implement.
2017-03-05 22:52:03 -05:00
Timm Bäder
e1592c599e gdkwindow: Plug memory leak
gdk_drawing_context_get_clip returns a newly allocated cairo_region_t,
so we have to destroy it.
2017-03-02 15:16:08 +01:00
Matthias Clasen
015ff46633 Convince OS X to fully fullscreen windows
We typically want to have the full screen given to
the content, not the aspect-ratio preserving behavior
that newer OS X has.

https://bugzilla.gnome.org/show_bug.cgi?id=779383
2017-03-02 08:10:39 -05:00
Matthias Clasen
6278d003b4 Implement backdrop for Quartz
We need to send window state change events to make GTK+
pick up on focus changed for backdrop.

https://bugzilla.gnome.org/show_bug.cgi?id=779392
2017-03-01 11:47:18 -05:00
Matthias Clasen
169e2d8d92 quartz: Let CSD windows be fullscreen
I've found that I need this patch to make it possible for
windows with headerbar to be made fullscreen on OS X.

https://bugzilla.gnome.org/show_bug.cgi?id=779383
2017-03-01 11:46:31 -05:00
Olivier Fourdan
bbf7c6a715 wayland: make sure to clear up the number of keys
Make sure to clear up the number of keys being pressed on enter/leave so
that we don't end up with leftovers if a new window is mapped by a
keyboard shortcut.

https://bugzilla.gnome.org/show_bug.cgi?id=779374
2017-03-01 16:10:44 +01:00
William Hua
54791b65bd mir: deprecate gdk_mir_window_get_mir_surface () 2017-03-01 02:15:56 -05:00
William Hua
f98e3dd09a mir: delete commented debug output 2017-03-01 02:15:56 -05:00
William Hua
bdf559c623 mir: migrate away from deprecated mir api 2017-03-01 02:15:56 -05:00
William Hua
e07dea5d97 mir: move #include to correct file 2017-03-01 02:15:56 -05:00
Olivier Fourdan
4c533e17f5 wayland: do not cancel key repeat on key press
The key repeat is stopped as soon as a key is pressed, so if the user
quickly presses a key while another is already pressed and being
repeated, key repeat gets cancelled:

 - key1 press
 - key1 repeat
 - key2 press -> key1 repeat stopped
 - key1 release
 - key 2 is not repeated even though it's kept depressed

This is a different behavior from X11, which confuses migrating users.

To mimic the X11 behavior, keep track of the number of keys pressed
simultaneously and cancel key repeat only when none is pressed.

This way, if a user pressed a key while another one is being repeated,
the new key press can possibly be repeated as well.

Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=778019
2017-02-27 11:53:03 +01:00
Olivier Fourdan
83b54bab57 wayland: Fix a race condition with xdg_popup resize
When resizing an xdg_popup immediately after the initial mapping, there
is a race condition between the client and the compositor which is
processing the initial size given by the xdg_positioner, leading to the
xdg_popup to be eventually of the wrong size.

Only way to make sure the size is correct in that case is to hide and
show the window again. Considering this occurs before the initial
configure is processed, it should not be noticeable.

https://bugzilla.gnome.org/show_bug.cgi?id=772505
2017-02-24 10:07:17 +01:00
Carlos Garnacho
9029bc0f6a gdk: Ensure GdkDragContext instantly updates drag window position
Otherwise we wait for the next gdk_drag_motion() call, which will
happen on the next motion event, making the drag window briefly visible
on the 0,0 root coordinates.

https://bugzilla.gnome.org/show_bug.cgi?id=778203
2017-02-17 19:35:42 +01:00
Olivier Fourdan
afa78fcffe wayland: do not clamp anchor values
Clamping the anchor values as introduced in commit 9a5ffcd to fix bug
777176 breaks menu positioning.

By keeping the anchors rectangle size greater than zero, we end up
deducting some positive value from the original position, so there is no
need to clamp() actually, keeping the values positive is enough and
avoids the issue with menu positioning on the menubar.

An additional benefit is to make the code a lot simpler.

https://bugzilla.gnome.org/show_bug.cgi?id=778009
2017-02-06 09:29:38 +01:00
Timm Bäder
a728a2e061 Never return NULL from gdk_get_program_class
gdk_init is not calling g_set_prgname anymore, so just return a dummy
string from gdk_get_program_class if it has not been set before.
2017-02-05 15:03:35 +01:00
William Hua
2088cc3395 mir: handle surface placement events
This allows the Mir backend to properly emit "moved-to-rect."
2017-01-30 03:06:59 -05:00
William Hua
b09b69472b mir: use mir_surface_spec_set_placement for menus
This API was added to Mir for GTK menus, combo boxes, etc.
2017-01-30 03:06:01 -05:00
Carlos Garnacho
4ebf98f440 wayland: Ensure to set gtk_surface dbus properties after hide()
Currently hiding destroys the wl_surface and all related interfaces,
(including the gtk_surface1) so the next time the GdkWindow is mapped,
we don't bother to set the DBus properties. Toggle the check off so
it's actually issued again after the GdkWindow gets a gtk_surface1.

https://bugzilla.gnome.org/show_bug.cgi?id=773686
2017-01-25 18:12:51 +01:00
Carlos Garnacho
f686dfb575 Revert "wayland: Push NULL buffer when hiding a GdkWindow"
This reverts commit 6beb0b91c9.
2017-01-20 14:04:37 +01:00
Matthias Clasen
4d7fa52fe9 Drop gdk init api
Supporting separately initialized gdk is just not worth it.
2017-01-19 13:21:12 -05:00
Emmanuele Bassi
b39e537e1c gdk: Skip GdkVulkanContext methods when building introspection data
We cannot use Vulkan types through introspection anyway.
2017-01-19 18:18:07 +00:00
Carlos Garnacho
6beb0b91c9 wayland: Push NULL buffer when hiding a GdkWindow
This is how windows are meant to be hidden as per the wayland
protocol, there's no need to destroy the xdg_surface and other
interfaces.

Also, rename gdk_wayland_window_hide_surface() to clear_surface(),
as that's what it does.

https://bugzilla.gnome.org/show_bug.cgi?id=773686
2017-01-19 16:18:54 +01:00
Benjamin Otte
2ae6f59e7a docs: Remove mention of GdkColor 2017-01-18 04:13:56 +01:00
Rui Matos
7a1b30f16e gdk/wayland: Always get the seat's key modifiers from the GdkKeymap
Elsewhere we already go through the keymap to get modifiers so we
should do the same here. In fact, this was relying on xkb modifier
mask values being bitwise compatible with GdkModifierType which isn't
necessarily true.

https://bugzilla.gnome.org/show_bug.cgi?id=770112
2017-01-17 18:24:28 +01:00
Rui Matos
515b71f14c gdk/wayland: Don't add GDK_META_MASK to gdk mod masks if MOD1 is set
Gtk+ treats MOD1 as a synonym for Alt, and does not expect it to be
mapped around, so we should avoid adding GDK_META_MASK if MOD1 is
already included to avoid confusing gtk+ and applications that rely on
that behavior.

https://bugzilla.gnome.org/show_bug.cgi?id=770112
2017-01-17 18:24:28 +01:00
Jonas Ådahl
7ca6d7585f wayland: Handle subsurface as popup parent
When a subsurface is used as a parent of a popup, GDK needs to traverse
up to the transient-for as the next parent, to properly find the parent
used by the popup positioner. This is because the parent of a popup
must always either be an xdg_popup or an xdg_surface, but traversing
the "parent" (in GDK terms) upwards from a subsurface will end up on
the fake root window before we hit the actual parent (in Wayland terms).

https://bugzilla.gnome.org/show_bug.cgi?id=776225
2017-01-17 09:02:41 +01:00
Mohammed Sadiq
8ffecabd93 wayland: avoid an unnecessary g_list_length call
https://bugzilla.gnome.org/show_bug.cgi?id=777363
2017-01-16 21:42:05 -05:00
Olivier Fourdan
4259aba883 wayland: avoid 0 width/height anchor rectangle
Passing a rectangle with zero width or height to xdg_shell-v6
set_anchor_rect() will cause a protocol error and terminate the client,
as with gedit when pressing the Win key.

Reason for this is because the rectangle used to set the anchor comes
from gtk_text_layout_get_iter_location() which uses the pango layout
width/height, which can be empty if there is not character at the given
location.

Make sure we don't use 0 as width or height as an anchor rectangle to
avoid the protocol error, and compensate the logical position of the
given rectangle if the size is changed, so that the actual position
remains as expected by the client.

https://bugzilla.gnome.org/show_bug.cgi?id=777176
2017-01-16 13:55:51 +01:00
William Hua
670ae58cc9 mir: use modal window hint 2017-01-12 17:24:19 -05:00
Benjamin Otte
d54117024c x11: Add call to XInitThreads()
The Mesa Vulkan drivers need XInitThreads() being called, because their
implementation has to use threads.

And I don't want to make the call depend on if Vulkan is compiled in
because that makes GTK's X11 behavior depend on compile-time flags, so
it's always called.
2017-01-12 02:01:07 +01:00
Rui Matos
ae61220c9f gdk/wayland: Handle non-existant gsettings keys
Since we're a library, crashing on gsettings keys, whose presence is out
of our control, isn't appropriate.

https://bugzilla.gnome.org/show_bug.cgi?id=775846
2017-01-10 15:17:32 +01:00
Rui Matos
b46da27d34 gdk/wayland: Add support for the gtk-enable-primary-paste gsetting
The gsetting was recently added so that we can have this configurable
on the wayland backend too.

https://bugzilla.gnome.org/show_bug.cgi?id=775846
2017-01-10 15:17:27 +01:00
William Hua
57a11ca28d mir: fix compile-time warnings 2017-01-09 17:55:31 -05:00
William Hua
a50a98f38b mir: properly handle empty clipboard
https://bugzilla.gnome.org/show_bug.cgi?id=775732
2017-01-09 12:04:48 -05:00
Chun-wei Fan
ea58ebe76d Visual Studio builds: Move project files to win32/
It was suggested that the project files to be moved to win32/, so that we can
have one less layer of directories we need to go down into to reach the project files.
2017-01-09 15:38:48 +08:00
Benjamin Otte
7ade6e3f46 gdk: Remove testing functions
They were unused and unimplemented.
2017-01-08 03:46:30 +01:00
Benjamin Otte
4749eedc08 docs: Remove a line that's not true anymore 2017-01-08 00:48:13 +01:00
Benjamin Otte
bc797f38f5 gdk: Remove unused debug category 2017-01-08 00:48:12 +01:00
Georges Basile Stavracas Neto
fc1cfd569a vulkancontext: Improve debug output 2017-01-06 02:02:08 -02:00
Georges Basile Stavracas Neto
ea952a6ec3 vulkancontext: Never abort on validation layer debug
Validation layers should never interfere on application
execution.
2017-01-06 02:01:58 -02:00
William Hua
384fe52e96 mir: paste clipboard data from content-hub
https://bugzilla.gnome.org/show_bug.cgi?id=775732
2017-01-05 17:57:36 -05:00
William Hua
516c0a2aab mir: copy clipboard data to content-hub
https://bugzilla.gnome.org/show_bug.cgi?id=775732
2017-01-05 17:57:36 -05:00
William Hua
dcda372c15 mir: connect to content-hub
https://bugzilla.gnome.org/show_bug.cgi?id=775732
2017-01-05 17:57:36 -05:00
William Hua
440e80c832 mir: track focused window
https://bugzilla.gnome.org/show_bug.cgi?id=775732
2017-01-05 17:57:36 -05:00
William Hua
ed0bd0bba2 mir: implement window properties
https://bugzilla.gnome.org/show_bug.cgi?id=775732
2017-01-05 17:57:36 -05:00
Georges Basile Stavracas Neto
a001ddf7bf vulkan: Use LGPL v2 2017-01-04 16:02:44 -02:00
Georges Basile Stavracas Neto
c6ec982ac6 vulkan: Turn headers to LGPL 2017-01-04 18:40:20 +01:00
Benjamin Otte
f74490739f vulkan: Create required number of swapchain images
Wayland has minImageCount == 4, so us just creating 2 images is not very
nice. So we don't do that anymore.
2017-01-04 18:38:40 +01:00
Benjamin Otte
efc5f8dc47 gdkvulkan: Track if we reffed the display's vulkan data
When reffing the display fails in init, we were still trying to unref
it. Which obviously failed and spewed warnings to stderr.
2017-01-04 18:26:14 +01:00
Georges Basile Stavracas Neto
3887548d55 wayland: Add support for Vulkan renderer
Mirror what's done with the X11 Vulkan renderer implementation,
with the addition of the extra Wayland window synchronization on
end_paint() override.
2017-01-04 13:24:08 +01:00
Georges Basile Stavracas Neto
38d6e45b32 vulkancontext: Assume the window geometry when extents are bogus
When the current extent is -1, we should assume whatever size
the GdkWindow has.
2017-01-04 13:23:48 +01:00
Georges Basile Stavracas Neto
d62e18ac87 vulkancontext: Fix header 2017-01-04 13:23:35 +01:00
Chun-wei Fan
2fdd0cefa5 Visual Studio builds: Support Vulkan builds
This will assume that the Vulkan SDK can be found in the INCLUDE/LIB paths
that are used by the Visual Studio compiler.
2016-12-30 14:42:38 +08:00
Chun-wei Fan
ee2f577991 Visual Studio builds: Drop the Broadway projects
Since the status of the GDK broadway backend is more or less unsupported,
drop the projects that build gtk4-broadwayd and gdk-broadway, and update
the projects to not to refer to them.

However, keep the Broadway configs for now as we will later transform
them to become configs for Vulkan, so bascially besides "installation"
parts and output settings, they will do the same as their Release|Debug
counterparts with no support for Broadway.
2016-12-30 11:09:46 +08:00
Chun-wei Fan
9db5cc9a98 gdk/gdkvulkancontext.c: Avoid VLAs
During the drive to enable Vulkan context creation on Windows, some more
VLAs were found here.  Replace them with g_newa().

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2016-12-29 17:51:56 +08:00
Chun-wei Fan
c4244ea104 GDK/Win32: Support Vulkan context creation
This adds support to the GDK Win32 backend so that we can support Vulkan
context creation for use in the GSK Vulkan renderer, so that we can test
it on Windows platforms as well.

https://bugzilla.gnome.org/show_bug.cgi?id=776544
2016-12-29 17:48:39 +08:00
Benjamin Otte
293248c1d3 gdkvulkan: Track changes per swapchain image
... and use those in begin_frame() to ensure all of the invalid area
gets invalidated.
2016-12-26 22:24:22 +01:00
Benjamin Otte
b30225e67c vulkan: We use VK_FORMAT_B8G8R8A8_UNORM
... not SRGB. SRGB messes up alpha compositing, GdkRGBA and everything
else.
2016-12-25 06:23:12 +01:00
Benjamin Otte
d58799ff7a gdk: Export gdk_cairo_surface_paint_pixbuf() into private header 2016-12-23 08:11:01 +01:00
Benjamin Otte
071c9a8221 API: gdk: Add gdk_rgba_is_clear() and gdk_rgba_is_opaque()
I want to use these inside GSK, and I'm not a fan of putting GdkRGBA
APIs into it or duplicating it into GTK.

So public API it is.
2016-12-20 18:01:12 +01:00
Piotr Drąg
a2da4ddceb Use Unicode in translatable strings
See https://developer.gnome.org/hig/stable/typography.html

https://bugzilla.gnome.org/show_bug.cgi?id=772371
2016-12-19 15:08:10 -05:00
Chun-wei Fan
4a7e7c00c1 GDK/Win32: Fix Windows backend after GdkWindow simplification
Fix the build after the branch wip/alexl/simplify-gdkwindow was merged, as
there are some changes that broke things in the Windows backend, namely:

-gdk_win32_input_shape_combine_region() should not be removed at this
 point (though it is a stub--otherwise GDK/Win32 will crash)

-Some more code need to be removed due to the removal of items in the
 above-mentioned merged branch

Also, like the X11 backend, do not allow the creation of native child
windows, and stop checking for subsequent child windows
(GDK_WINDOW_CHILD), so that we can clean things up a bit.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2016-12-19 17:47:47 +08:00
Debarshi Ray
339f6e141a Mention that gdk_window_create_similar_image_surface inherits the scale
https://bugzilla.gnome.org/show_bug.cgi?id=776132
2016-12-17 22:50:18 +01:00
Alexander Larsson
330c7feaa2 gdk: Drop gdk_window_reparent
We're not currently using this, and dropping it allows us to loose
a bunch of code which leads us towards the goal of having GdkWindow
only for toplevels (and reparenting makes not sense for toplevels).
2016-12-16 12:35:03 +01:00
Alexander Larsson
5bf28a3869 gdk: Drop support for native (and thus foreign) subwindows
We can't really support these on e.g. wayland anyway, and we're trying
to get rid of subwindow at totally in the long term, so lets drop this.
It allows us to drop a lot of complexity.
2016-12-16 12:28:44 +01:00
Olivier Fourdan
5c3192c75a wayland: apply empty input shape on parent commit
For subsurfaces, the new state which includes the input shape is not
applied by the compositor if the subsurface is in effective synchronous
mode.

So we need to apply the input shape once parent surface is in effective
desynchronized mode, which is when it's committed, otherwise the input
shape may never be applied if the widget is not using being_paint() /
end_paint() to draw on its subsurface, like clutter does.

We do that only for empty input shape as those won't need update when
the subsurface is resized, for all other non-empty input shape, the
client still has to use begin_paint()/end_paint() for the input shape to
be applied.

https://bugzilla.gnome.org/show_bug.cgi?id=774534
2016-12-15 13:27:39 +01:00
Matthias Clasen
4ae50bf38e Trivial doc fixups 2016-12-09 14:59:46 -05:00
Benjamin Otte
2c0564a46e build: Make sure GTK compiles without Vulkan headers installed
Previously, code would work fine with --disable-vulkan if the Vulkan
headers were installed - code would happily just use them as they're
installed in /usr/include.
2016-12-09 20:23:06 +01:00
Matthias Clasen
98f5e794a6 Forgotten file 2016-12-09 14:22:14 -05:00
Matthias Clasen
3dd4f76703 Rename GDK_WINDOWING_VULKAN
The WINDOWING defines are only for GDK backends, really.
Define GDK_RENDERING_VULKAN instead.
2016-12-09 14:11:37 -05:00
Matthias Clasen
5b6a837b17 Only include vulkan.h if we have it 2016-12-09 14:05:26 -05:00
Benjamin Otte
747df7aa3c vulkan: Also wait on the draw semaphore when present()ing
That way we have a synchronization primitive at the start and at the
end.
2016-12-09 18:35:51 +01:00
Benjamin Otte
5e4f95d77f x11: Don't make random windows native
Instead, complain if somebody calls gdk_x11_window_get_xid() on a
non-native window.

We cannot make random windows native anymore because there's no GSK
renderer associated with them, so we cannot draw them.
2016-12-09 18:35:51 +01:00
Benjamin Otte
8ba2898e08 vulkan: acquire/present images when drawing
Another step towards the final goal of actually showing something.
2016-12-09 18:35:51 +01:00
Benjamin Otte
325efe7078 vulkan: Expose the swapchain images in public API 2016-12-09 18:35:51 +01:00
Benjamin Otte
0c8e7d0ac0 vulkan: Register debug handler
We now hook Vulkan error reporting into glib's error reporting.

I'm not sure on the severity handling yet, but we can fix that as we go
along.
2016-12-09 18:35:51 +01:00
Benjamin Otte
b6227aa998 gdk: Add GDK_VULKAN env variable
Also add 2 flags:

GDK_VULKAN="disable" will disable Vulkan usage.

GDK_VULKAN="validate" will enable VK_LAYER_LUNARG_standard_validation.
2016-12-09 18:35:51 +01:00
Benjamin Otte
e11a6a0e68 x11: Call gdk_display_sync() when creating Vulkan surfaces
The Vulkan driver wants to operate on an X Window that it is sure does
exist.
2016-12-09 18:35:51 +01:00
Benjamin Otte
e22cb94e50 vulkan: More work on GdkVulkanContext
Code has now arrived at creation of swapchains.
2016-12-09 18:35:51 +01:00
Benjamin Otte
4ef8bf821e vulkan: Turn GdkVulkanContext into a GdkDrawContext 2016-12-09 18:35:51 +01:00
Benjamin Otte
6d1d6e6792 vulkan: Add more infrastructure
gdk_window_create_vulkan_context() now exists and will return a Vulkan
context for the given window. It even initializes the surface. But it
doesn't do anything useful yet.
2016-12-09 18:35:51 +01:00
Benjamin Otte
cca547e5bc vulkan: Initial support
Adds the gdk_display_ref_vulkan() and gdk_display_unref_vulkan()
functions which setup/tear down VUlkan support for the display.

Nothing is using those functions yet.
2016-12-09 18:35:51 +01:00
William Hua
9a7b0847b9 mir: swap buffers on paint 2016-12-08 15:28:31 -05:00
Benjamin Otte
cd2b898353 wayland: Sync attributes also when drawing with GL
Probably syncing attributes shouldn't happen when drawing in the first
place, but what do I know about Wayland. ¯\_(ツ)_/¯
2016-12-06 18:02:11 +01:00
Benjamin Otte
a85a97c1a1 wayland: Uncomment erroneously commented out code
I read the code as if (use_gl) instead of if (!use_gl) and commented it
out in bddfd7bb41. That broke drawing on
Wayland without OpenGL completely.

Whoops.

Now it's back.
2016-12-06 17:51:35 +01:00
Chun-wei Fan
060365a9bb GDK/Win32: Fix build after GDKGL refactoring
There were some parts that need some updates after the refactoring in
GDKGL, so that the code will continue to build and run.

For gdkwindow-win32.c, comment out the parts where we check for use_gl
(which was removed), since we are going to move all drawing to OpenGL,
but don't remove/disable the whole portion as that transition is not
complete at this point.

There a is new GDKGL function that checks for the damaged area of the back
buffer, but since the notion of "damage" is for *NIX (GLX/EGL for
Wayland/mir), meaning that there is no such extension for Windows in this
regard, so we can't support this on Windows as-is, at least for now.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2016-12-06 16:47:47 +08:00
William Hua
3c2aefddd4 mir: fix type warning 2016-12-05 11:06:32 -05:00
William Hua
32b3928eda mir: fix build failures 2016-12-05 10:28:48 -05:00
William Hua
e27e8e6e1c mir: implement display monitor vfuncs 2016-12-05 09:17:44 -05:00
Benjamin Otte
8915be00d1 gdkgl: Add gdk_gl_context_get_damage()
This is a way to query the damaged area of the backbuffer.

The GL renderer uses this to compute the extents of that damage region
(computed via buffer age) and use them to minimize the area to redraw.

This changes the semantics of GL rendering to "When calling
gdk_window_begin_frame() with a GL context, the area by
gdk_gl_context_get_damage() needs to be redrawn and every other pixel of
the backbuffer is guaranteed to be correct.
After gdk_window_end_frame() on a GL-drawn window, the whole backbuffer
must be correct.

We can always glXBufferSwap() now because of this.
2016-12-05 15:02:47 +01:00
Benjamin Otte
ca78f5d3cb gdk: Make gdk_window_begin_draw_frame() take a draw context
... instead of a gl context.

This requires some refactoring in the way we mark the shared context as
drawing: We now call begin_frame/end_frame() on it and ignore the call
on the main context.
Unfortunately we need to do this check in all vfuncs, which sucks. But I
haven't found a better way.
2016-12-05 15:02:47 +01:00
Benjamin Otte
725a7236c0 gdk: Turn GdkGLContext into a GdkDrawContext 2016-12-05 15:02:47 +01:00
Benjamin Otte
db8e3065bd gdk: Add GdkDrawContext
This will be the base class for GdkVulkanContext and GdkGLContext.
2016-12-05 15:02:47 +01:00
Benjamin Otte
e38bd27d58 gdk: Redo GL drawing
Reenable GL drawing, but do it without Cairo.

Now, the context passed to gdk_window_begin_draw_frame() decides how
drawing is going to happen. If it is NULL, Cairo is used like before.

If a context is passed, Cairo may not be used for drawing and
gdk_drawing_context_get_cairo_context() is going to return NULL.
Instead, the GL renderer must draw to the GL backbuffer and
end_draw_frame() is then swapping that to the front.

The GskGLRenderer has lost the texture it used to render to and adapted
to render directly to the backbuffer instead.

The only thing missing is for GtkGLArea to gain back a performant way to
render. But it didn't have one since the introduction of GSK, this
patchset doesn't change anything about it.

The new rendering avoids two indirections (the GSK renderer's texture
and the GDK double buffering surface).
It improves icon count in the fishbowl demo by 30%.
2016-12-05 15:02:47 +01:00
Benjamin Otte
e87b472143 glcontext: Make begin/end_draw() paired
This way, we can query the GL context's state via
gdk_gl_context_is_drawing().

Use this function to make GL contexts as attached and grant them access
to the front/backbuffer for rendering.

All of this is still unused because GL drawing is still disabled.
2016-12-05 15:02:47 +01:00
Benjamin Otte
182d18bcd1 gdk: Large GL refactoring
No visible changes as GL rendering is disabled at the moment.

What was done:

1. Move window->invalidate_for_new_frame to glcontext->begin_frame
This moves the code to where it is used (the GLContext) and prepares it
for being called where it is used when actually beginning to draw the
frame.

2. Get rid of buffer-age usage
We want to let the application render directly to the backbuffer.
Because of that, we cannot make any assumptions about the contents the
application renders outside the clip area.
In particular GskGLRenderer renders random stuff there but not actual
contents.

3. Pass the actual GL context
Previously, we passed the shared context to end_frame, now we pass the
actual GL context that the application uses for rendering. This is so
that the vfuncs could prepare the actual contexts for rendering (they
don't currently).

4. Simplify the code
The previous code set up the final drawing method in begin_frame.
Instead, we now just ensure the clip area is something we can render
and decide on the actual method in end_frame.
This is both more robust (we can change the clip area in between if we
want to) and less code.
2016-12-05 15:02:47 +01:00
Benjamin Otte
4967257f3a gdk: Don't recurse when processing updates
We don't need to send expose events for backwards compatibility anymore.
2016-12-05 15:02:47 +01:00