Commit Graph

6283 Commits

Author SHA1 Message Date
Evangelos Foutras
374bedc0e2 x11: Relax requirements for setting ParentRelative
XSetWindowBackgroundPixmap() will throw BadMatch only in the case of a
different parent window depth. Different visuals are fine and actually
expected in Gtk+ 3.16 (since we don't stick to the system default visual
but try to pick a better one).

https://bugzilla.gnome.org/show_bug.cgi?id=747524
2015-04-13 08:26:15 -04:00
Matthias Clasen
b2e19866ea wayland: Wait for output and seat information
When we open the connection, we get the wl_output object,
but we return before all the information such as monitor
geometry has arrived, which causes us to misinform early
users of this information. Do a roundtrip here that causes
us to wait until the information is complete. Do the same
for seats, just in case.
https://bugzilla.gnome.org/show_bug.cgi?id=747471
2015-04-09 00:14:20 -04:00
Matthias Clasen
da16947e21 wayland: Add more debug output 2015-04-09 00:13:37 -04:00
William Hua
61f3399f98 mir: Fix build failure due to changed API
mir_surface_set_event_handler() now takes three arguments.
2015-04-07 10:38:22 -04:00
Matthias Clasen
cb750f60f9 wayland: Don't mix free and g_strdup
While it works most of the time, this is technically
not correct.
2015-04-05 18:59:51 -04:00
Olivier Fourdan
49ec67c7eb x11/gl: Fix use after free
https://bugzilla.gnome.org/show_bug.cgi?id=747305

Signed-off-by: Olivier Fourdan <fourdan@xfce.org>
2015-04-05 07:41:03 -04:00
Jonas Ådahl
71256a0f94 wayland: Set a more correct xdg_surface application id
The "app_id" of a xdg_surface should be the ID that can potentially be
used to get the DBUS name or the .desktop file.

For GtkApplication programs this is often the ID passed when creating the
GtkApplication object, so when available lets use that.

As fallbacks, first try g_get_prgname as it often corresponds to the
basename part of the .dektop file for non-GtkApplication programs.
Otherwise use gdk_get_program_class, even though that string usually
doesn't conform to the expectations of xdg_surface.set_application_id.

https://bugzilla.gnome.org/show_bug.cgi?id=746435
2015-03-31 12:37:50 +08:00
Emmanuele Bassi
d79bc00345 x11/gl: Do not use GLX_EXT_texture_from_pixmap if not available
If the GLX_EXT_texture_from_pixmap extension is not available when we
did the extensions check, then there's no point in using the backend
specific code paths that rely on it.
2015-03-26 17:28:48 +00:00
Руслан Ижбулатов
3c80451b17 W32: Only override window miximized position for CSDed windows
This fixes an issue with non-CSDed windows being improperly positioned
when maximized, which was introduced by the previous commit.

https://bugzilla.gnome.org/show_bug.cgi?id=746821
2015-03-26 17:02:38 +00:00
Руслан Ижбулатов
af9f6fca5f W32: Correctly set maximized window position
Use screen workarea to *also* set the position of a maximized window,
not just its size. Without this the window position defaults to 0:0
(the topleft corner), which is wrong when taskbar is position along the
top or left edge of the screen.

https://bugzilla.gnome.org/show_bug.cgi?id=746821
2015-03-26 15:43:17 +00:00
Emmanuele Bassi
85141bc503 x11/gl: Do not try to call MakeCurrent with a NULL context
This should not happen, but better safe than sorry.

https://bugzilla.gnome.org/show_bug.cgi?id=746746
2015-03-25 15:18:44 +00:00
Emmanuele Bassi
b899a78387 x11/gl: Trap GL context creation
Avoid an X11 error in case the context creation fails, so we can avoid a
crash and pick it up in the upper layers, and display an error.

https://bugzilla.gnome.org/show_bug.cgi?id=746746
2015-03-25 14:34:42 +00:00
Niels Nesse
641e280311 x11/gl: Removing some more legacy GL calls
They are not required any more.

http://bugzilla.gnome.org/show_bug.cgi?id=746668
2015-03-23 22:16:34 +00:00
Emmanuele Bassi
6bd7526ee7 x11/gl: Do not call glEnable/glDisable with GL_TEXTURE_2D
These are fixed pipeline functions, and Mesa will warn (if debugging
messages are enabled). At best, they are poinless calls.
2015-03-23 22:03:00 +00:00
Matthias Clasen
fbbb3d1816 Fix some clang warnings
It complains about double const, and it is right.
2015-03-22 14:40:57 -04:00
Matthias Clasen
c16acff3ea Start 3.17 development
Bump the version to 3.17.0 and add version macros.
2015-03-22 02:10:23 -04:00
Rico Tzschichholz
db8e6aa497 mir: Fix version annotation, the mir-backend is available since 3.16 2015-03-20 20:23:01 +01:00
Carlos Garnacho
6c8c37abbb wayland: Silence warnings on clipboard data sending cancellation
During copy/paste, it may be common that we receive several property changes
around the selection atom, this results in warnings when cancelling the previous
write attempt. We already honor the last request properly, so we should just
cancel silently.
2015-03-19 16:05:04 +01:00
Carlos Garnacho
d5160bb950 wayland: Ensure we re-request the target if the fd changes
If we receive wl_data_source.target before .send, the target would already
be cached, but we'd take no action on the new fd.
2015-03-19 16:05:04 +01:00
Carlos Garnacho
a59fd4a9ad wayland: Don't accept the "TARGETS" target on the wl_data_offer
This is handled separately through the data already cached from the
wl_data_offer.offer handler, we can avoid this request entirely then.
2015-03-19 16:05:04 +01:00
Carlos Garnacho
dcfa55ac7e wayland: Fix thinko in wl_data_source.cancelled handler
The wl_data_source may be the clipboard's. Looking up the drag context in
order to get the display isn't going to fare well there. So, just use the
default display, and only look up the drag context when we know we need it.

https://bugzilla.gnome.org/show_bug.cgi?id=746386
2015-03-18 11:21:40 +01:00
Jonas Ådahl
4e930ada32 wayland: Move gtk-shell compatibility version define too
https://bugzilla.gnome.org/show_bug.cgi?id=745721
2015-03-16 13:58:14 -04:00
Jonas Ådahl
225c10bc5a wayland: Don't set the wl_surface user_data twice
wl_surface_add_listener already sets the user data pointer, so no need
to do it separately before.

https://bugzilla.gnome.org/show_bug.cgi?id=746141
2015-03-16 19:53:37 +08:00
Jonas Ådahl
7372ddd2a1 wayland: Ignore setting the same cursor theme as was already set
If the name and size of the theme is identical to the current
configuration, do nothing.

https://bugzilla.gnome.org/show_bug.cgi?id=746141
2015-03-16 19:53:37 +08:00
Jonas Ådahl
465647e964 wayland: Support scaling of theme based cursors
Support scaling of cursors created from themes. The default scale is
always 1, but if the pointer cursor surface enters an output with a
higher scale, load the larger version of the cursor theme and use the
image from that theme.

This assumes the theme size is set to one that fits with an output scale
= 1.

https://bugzilla.gnome.org/show_bug.cgi?id=746141
2015-03-16 19:53:37 +08:00
Jonas Ådahl
7b2cdabc2e wayland: Put interface version defines in a common place
So far only one, but put it somewhere all files can see it.

https://bugzilla.gnome.org/show_bug.cgi?id=746141
2015-03-16 19:53:37 +08:00
Jonas Ådahl
c7be8fd398 wayland: Don't set cursor surface scale when we don't have a surface
The setting of the the surface scale even when the surface is not
created from a surface was introduced due to a crash when getting the
buffers when dividing by the scale. The only reason I can see this is
that we get the buffer from a non-existing surface when the wl_cursor
has not yet been set.

Instead, use the name field to avoid trying to use the non-existing
surface, effectively avoiding the division-by-zero that way.

https://bugzilla.gnome.org/show_bug.cgi?id=746141
2015-03-16 19:53:37 +08:00
Jonas Ådahl
b4344861a0 wayland: Only bind to supported gtk-shell versions
The gtk-shell Wayland protocol extension is not meant to be backward
compatible right now, so avoid binding to any version that is not the
one supported.

https://bugzilla.gnome.org/show_bug.cgi?id=745721
2015-03-11 11:37:37 +08:00
Philip Withnall
586240d2f8 gdkwindow: Fix potential NULL pointer dereference
gdk_window_ensure_native() can end up with a NULL parent pointer, which
it passes to find_native_parent_above()…but that expects a non-NULL
parent.

Found with scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=712760
2015-03-09 13:41:37 +00:00
Eric Le Bihan
8ecc51ad8a Fix undefined reference to get_xkb()
When configuring Gtk+ with --disable-xkb, the build fails because of an
undefined reference to get_xkb().

This patch fixes this issue.

Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>

https://bugzilla.gnome.org/show_bug.cgi?id=739070
2015-03-07 18:42:27 -05:00
Niels Nesse
b87715973f gl: Warn the user if they request a GL context version less than 3.2
If the user requests a version less than 3.2 the version is forced to 3.2.
Previous checking code have an inconsistent behavior depending on which
minor version number was specified. This is avoided now by temporarily
converting the major/minor pair into a single integer.

https://bugzilla.gnome.org/show_bug.cgi?id=744288
2015-03-06 14:02:55 +01:00
Carlos Garnacho
4cae9bdd05 x11: Store last axes from device
And use these for the missing axes if the valuator mask is incomplete.
This used to work fine on tablets because the Wacom driver ensures all
valuators are sent, which is not true if using the evdev driver.

https://bugzilla.gnome.org/show_bug.cgi?id=703610
2015-03-02 18:57:04 +01:00
Carlos Garnacho
eaebc2cb4b wayland: Delay wl_subsurface interface creation until the window is shown
It isn't really necessary anytime before, so just make sure it's there only
when the window is visible.

https://bugzilla.gnome.org/show_bug.cgi?id=743427
2015-03-02 12:11:59 +01:00
Carlos Garnacho
c55fcd35fe wayland: Thaw the clock if we hide a GdkWindow mid-frame
When a window is hidden, its surface and all its roles are destroyed,
if this happens when we already issued a wl_surface_commit and are
awaiting for a frame callback, the clock will remain frozen for the
next time the window is shown.

To avoid this, keep track of the wl_surface_frame() calls issued,
and ensure the clock is thawed after hiding. If we happen to receive
the frame callback, it is just ignored.

https://bugzilla.gnome.org/show_bug.cgi?id=743427
2015-03-02 12:11:59 +01:00
Ryan Lortie
c91076f64c gdkglcontext-win32: fix variable names in GDK_NOTE
These probably weren't caught because GDK_NOTE was disabled when the
change was tested.

https://bugzilla.gnome.org/show_bug.cgi?id=745400
2015-03-01 21:38:19 -05:00
Ryan Lortie
4f0ab5656b gdkglcontext-win32: remove unused variables
https://bugzilla.gnome.org/show_bug.cgi?id=745400
2015-03-01 21:38:19 -05:00
Matthias Clasen
af86bc58b9 wayland: Add debug spew 2015-02-28 00:58:05 -05:00
Matthias Clasen
94c5d691df wayland: Formatting fixes 2015-02-28 00:02:30 -05:00
Matthias Clasen
a0eb0e2346 wayland: Apply maximized and fullscreen state
We were just throwing the request away if the app asks to
fullscreen or maximize a window before it has been mapped.
This is something the GdkWindow API explicitly supports,
so make it work by saving the state until the surface exists.

This fixes things under weston. There are bugs in mutter
that keep this from working correctly with gnome-shell.

https://bugzilla.gnome.org/show_bug.cgi?id=745303
2015-02-27 19:09:03 -05:00
Matthias Clasen
3d205a2037 wayland: Drop some pointless lines
No need for these parameter checks, really.
2015-02-27 19:09:03 -05:00
Matthias Clasen
6ccef21d49 Fix a typo
Follow-up fix for commit 7cee6c5cc6.
2015-02-27 17:00:08 -05:00
Olivier Fourdan
53028ff3bb wayland: Don't use g_error() on connection lost
When the Wayland compositor vanishes, all applications connected will
receive a SIGPIPE as soon as they try to use wl_display_dispatch().

Do not use g_error() to terminate the applications when this occurs,
g_error() means an error in the application while here it's not truly
the case.

Use g_warning() and exit() instead.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=745289
2015-02-27 16:26:39 -05:00
Emmanuele Bassi
7cee6c5cc6 gdk: Use a better error message
Having "Assertion failed: success" on the console is not going to help
anyone.
2015-02-27 21:02:16 +00:00
Jonas Ådahl
f13157f4bb wayland: Don't allocate a full size SHM buffer when drawing using OpenGL
Before this patch, we'd always allocate a full size SHM buffer via
the wl_shm_pool, even though it would never be used. Instead allocate a
logical 1x1 cairo image surface.

https://bugzilla.gnome.org/show_bug.cgi?id=745076
2015-02-24 20:22:03 -05:00
Jonas Ådahl
aa81262f11 wayland: Scale up wl_egl_window according to window scale
In order to support window scales for EGL windows, resize the
wl_egl_window to the window dimension multiplied with the window scale,
just as with SHM window buffers.

https://bugzilla.gnome.org/show_bug.cgi?id=745076
2015-02-24 20:22:03 -05:00
Jonas Ådahl
56c9eac16e wayland: Properly support changing of surface scale
When the preferred surface scale changes, for example when entering a
wl_output with a higher scale than any previous entered output, recreate
the shm surface and redraw the window content with the new window scale.

Before this patch, the internal scale would be changed, but the shm
surface would not be recreated given the new scale, i.e. we'd attach a
buffer for a different scale than wl_surface.set_scale specified.

https://bugzilla.gnome.org/show_bug.cgi?id=745076
2015-02-24 20:22:02 -05:00
Jonas Ådahl
a70b478a5c wayland: Don't ever try to set surface buffer scale when not supported
If the compositor is too old for handling surface buffer scales, never
tyr to set change it. This will effectively always leave it to its
initial state, i.e. 1.

https://bugzilla.gnome.org/show_bug.cgi?id=745076
2015-02-24 20:22:02 -05:00
Benjamin Otte
40f2af665d gdkcairo: Bail if surface is in error
Don't try to paint onto an error surface. This happens for example when
gdk_cairo_set_source_pixbuf() is called with a pixbuf that is too big
for Cairo to handle.

Spotted by Christian Boxdörfer
2015-02-25 01:55:28 +01:00
Thibault Saunier
fb581a1084 gdk/quartz: Fix mixup in attributes usage creating window implementation
First, attributes can be NULL (which is always the case when calling
gdk_window_ensure_native) so do not unconditionally dereference it.

Then the window_type should be taken directly from the GdkWindow as
in other backends (such as the X11 one for example).

https://bugzilla.gnome.org/show_bug.cgi?id=744942
2015-02-22 15:50:39 +01:00
Philip Withnall
09bb109f01 docs: Expand input handling documentation to cover event masks
Also try and clarify a few things about event propagation. Move
input-handling.xml into gtk-doc’s expand_content_files variable so it
automatically links to widget documentation. Add links from
gtk_widget_add_events() and friends to the new documentation.

https://bugzilla.gnome.org/show_bug.cgi?id=744054
2015-02-19 12:48:42 +00:00
Carlos Garnacho
e43ec48e83 wayland: Use display from GdkDragContext device
It will be useless to check the source window on the destination side,
it's at the moment always NULL. Fetch the display from the device instead,
which will be set for every GdkDragContext.
2015-02-17 19:50:05 +01:00
Paolo Borelli
f4510c93b7 Do not use "return" when chaining up to a void function 2015-02-17 14:54:51 +01:00
Jonas Ådahl
5889905d1d wayland: Update to xdg-shell unstable v5
Only trivial changes needed.

https://bugzilla.gnome.org/show_bug.cgi?id=744455
2015-02-14 20:54:47 -05:00
Pier Luigi Fiorini
6ae521bb32 wayland: Do not require latest wl_seat
Some compositors might not offer wl_seat 4 resulting in GTK+ clients not
working on that compositor.

wl_seat 4 introduces keyboard repeat information, but when that information
is missing it is retrieved from settings, hence there's no reason to
require wl_seat 4.

This patch was tested against QtCompositor (5.5, dev branch)
and Weston 1.6.1.

Reviewed-by: Daniel Stone <daniels@collabora.com>

https://bugzilla.gnome.org/show_bug.cgi?id=744172
2015-02-13 19:05:32 -05:00
Chun-wei Fan
933ee3af56 gdkglcontext-win32.c: Fix Build on C89 Compilers
Make sure variables are declared at the top of the block.
2015-02-13 18:36:34 +08:00
Emmanuele Bassi
d066e7541e Remove GdkGLProfile
The existence of OpenGL implementations that do not provide the full
core profile compatibility because of reasons beyond the technical, like
llvmpipe not implementing floating point buffers, makes the existence of
GdkGLProfile and documenting the fact that we use core profiles a bit
harder.

Since we do not have any existing profile except the default, we can
remove the GdkGLProfile and its related API from GDK and GTK+, and sweep
the whole thing under the carpet, while we wait for an extension that
lets us ask for the most compatible profile possible.

https://bugzilla.gnome.org/show_bug.cgi?id=744407
2015-02-12 17:51:31 +00:00
Emmanuele Bassi
390a42fa60 gl: Add gdk_gl_context_get_version()
Store the OpenGL version when we first do the extensions check; this
allows client code to check the available GL version without requiring a
call to gdk_gl_context_make_current() and epoxy_gl_version().
2015-02-12 14:29:44 +00:00
Emmanuele Bassi
f52a59d414 docs: Specify the minimum version of GL provided by the core profile
When using GDK_GL_PROFILE_3_2_CORE, we are not only specifying that the
GDK should create a core profile; we are also specifying that the
minimum required version of OpenGL is set to 3.2.

We should also specify that the GDK_GL_PROFILE_DEFAULT profile is an
alias for GDK_GL_PROFILE_3_2_CORE.
2015-02-12 13:32:02 +00:00
Emmanuele Bassi
022724aa69 gl: Drop profile for gdk_window_create_gl_context()
Now that we have a two-stages GL context creation sequence, we can move
the profile to a pre-realize option, like the debug and forward
compatibility bits, or the GL version to use.
2015-02-12 12:34:28 +00:00
Armin K
6886f479fe wayland: Implement minimize support
Use the existing xdg_surface API for minimization.

https://bugzilla.gnome.org/show_bug.cgi?id=695945
2015-02-11 22:01:38 -05:00
Marco Trevisan (Treviño)
c82ad2c129 mir, gl: Ensure we use the 3.2 core profile
Emit an error if the profile is different.
2015-02-12 03:34:05 +01:00
Marco Trevisan (Treviño)
ce31df3238 mir: Switch GDK_GL_PROFILE_DEFAULT to mean 3_2_CORE
Instead of LEGACY.
2015-02-12 03:32:11 +01:00
Marco Trevisan (Treviño)
f9503ac189 mir, GL: Split GL context creation in two phases
Move egl_context initialization in gdk_gl_context_realize

 • gdk_window_create_gl_context() creates a GdkGLContext
 • gdk_gl_context_realize() creates the underlying resources

https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-12 03:03:18 +01:00
Emmanuele Bassi
5666522ab3 gl: Fix the required version setter
We don't allow a version tuple to be lower than (3, 2), but we should
allow versions above that.

https://bugzilla.gnome.org/show_bug.cgi?id=744212
2015-02-10 10:16:53 +00:00
Chun-wei Fan
60195ab021 win32/gl: Ensure we use the 3.2 core profile
Emit an error if the profile is different.

This is a follow-up commit to commits cc45e82 (x11/gl: Ensure we use the
3.2 core profile) and 2d9081d (wayland/gl: Ensure we use the 3.2 core
profile), so that we do the same on GDK-Win32.  Update variable names and
comments so that the code is clearer to people, as we still need a
temporary legacy WGL context first before we can use
wglCreateContextAttribsARB() to create a WGL core (3.2+) context.

https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-10 16:21:29 +08:00
Emmanuele Bassi
03f5d5a5e4 gl: Put shaders in static storage
We are not changing the shader code.

The compiler will hopefully put them in the .rodata section.
2015-02-10 03:33:02 +00:00
Niels Nesse
50187ae86d gdkgl should use shader version 1.50
Using version 1.20 with a forward compatible 3.2 core context is incorrect
since OpenGL 3.2 deprecates shader version 1.20 (See section E.2). The latest
fglrx drivers will not compile these shaders.

https://bugzilla.gnome.org/show_bug.cgi?id=744203
2015-02-10 03:30:09 +00:00
Emmanuele Bassi
843475bd2e gl: Drop GdkGLContextClass.upload_texture()
It's unnecessary to allow per-backend overrides.
2015-02-09 19:10:31 +00:00
Emmanuele Bassi
2d35053d97 gl: Clean up the required version accessors
We can simplify the code, since we only have core GL profiles in GDK.

https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:30 +00:00
Emmanuele Bassi
4ad887f4bf docs: We do not support non-core GL profiles
No need to mention that some API only works on core GL profiles in the
GdkGLContext docs.

https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:30 +00:00
Emmanuele Bassi
601c49ef39 gl: Clean up pre-requisite checks for GdkGLContext setters
We don't support non-core profiles.

https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:30 +00:00
Emmanuele Bassi
2d9081d117 wayland/gl: Ensure we use the 3.2 core profile
Emit an error if the profile is different.

https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:30 +00:00
Emmanuele Bassi
cc45e828df x11/gl: Ensure we use the 3.2 core profile
Drop the dead code for the legacy profile, and return an error when
realizing if the profile is incorrect.

https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:30 +00:00
Emmanuele Bassi
1d3cc65e89 gl: Add more debugging notes
https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:30 +00:00
Emmanuele Bassi
395125bcfb gl: Do not use the extension API for core GL
Since we are using a Core GL profile, we need to drop the
extension-based API.

https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:30 +00:00
Emmanuele Bassi
4b8b3b431b gl: Drop OpenGL legacy profile
We simply don't want to care about legacy OpenGL.

All supported platforms also have support for OpenGL ≥ 3.2; it would
complicate the internal code; and would force us to use legacy GL
contexts internally if the first context created by the user is a legacy
GL context, and disable creation of core-3.2 contexts after that.

We will need to fix all our code examples to use the Core 3.2 profile.

https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:30 +00:00
Emmanuele Bassi
6aaa6c337b gl: Move getters for context options to the public API
They can be useful for third party code as well.

https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:30 +00:00
Emmanuele Bassi
f7497daee9 Switch GDK_GL_PROFILE_DEFAULT to mean 3_2_CORE
Instead of LEGACY.

https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:30 +00:00
Chun-wei Fan
4c091db6c2 win32/gl: Use the GdkGLContext options
https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:30 +00:00
Chun-wei Fan
ba56f11702 GDK-Win32: Split GL context creation in two phases
Like what is being done in the X11 and Wayland backends, create the
GdkWin32GLContext in 2 steps, where we only create the actual WGL context
in _gdk_win32_gl_context_realize().

https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:28 +00:00
Emmanuele Bassi
42a895e85e wayland/gl: Use the GdkGLContext options
https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:05 +00:00
Emmanuele Bassi
3425f7fe5a x11/gl: Use the GdkGLContext options
When creating an OpenGL context using the glXCreateContextAttribs()
function.

https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:05 +00:00
Emmanuele Bassi
fa90052299 gl: Add context options
Users of the GdkGLContext API should be allowed to set properties on the
shim GdkGLContext instance prior to realization, so that the
backend-specific implementation can use the value of those properties
when creating the windowing system specific resources.

The main three options are:

 • a major/minor version tuple, to request a specific GL version
 • a debug bit, to request a "debug context", which provides additional
   validation and run time checking
 • a forward compatibility bit, to request a context that does not
   have deprecated functionality

See also:
 - https://www.opengl.org/registry/specs/ARB/glx_create_context.txt

https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:05 +00:00
Emmanuele Bassi
22e6f37c9c GL: Split GL context creation in two phases
One of the major requests by OpenGL users has been the ability to
specify settings when creating a GL context, like the version to use
or whether the debug support should be enabled.

We have a couple of requirements in terms of API:

 • avoid, if at all possible, the "C arrays of integers with
   attribute, value pairs", which are hard to write and hard
   to bind in non-C languages.
 • allow failing in a recoverable way.
 • do not make the GL context creation API a mess of arguments.

Looking at prior art, it seems that a common pattern is to split the
construction phase in two:

 • a first phase that creates a GL context wrapper object and
   does preliminary checks on the environment.
 • a second phase that creates the backend-specific GL object.

We adopted a similar pattern:

 • gdk_window_create_gl_context() creates a GdkGLContext
 • gdk_gl_context_realize() creates the underlying resources

Calling gdk_gl_context_make_current() also realizes the context, so
simple GL users do not need to care. Advanced users will want to
call gdk_window_create_gl_context(), set up the optional requirements,
and then call gdk_gl_context_realize(). If either of these two steps
fails, it's possible to recover by changing the requirements, or simply
creating a new GdkGLContext instance.

https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:04 +00:00
Chun-wei Fan
0b06b1e3f7 gdkglcontext-win32.h: Clean Up a Bit
We don't have a Win32-specific ->upload_texture() anymore, so don't
indicate so.  Left out this part from my previous commit.
2015-02-06 13:00:59 +08:00
Chun-wei Fan
24e6bda264 GDK-Win32: Drop Win32-specific ->upload_texture()
The default ->upload_texture() works also for Windows since commit 27cf0fa,
as some of the problems described in 742953 also applied for GL core
contexts on Windows as well before 27cf0fa.  Clean up the GDK-Win32 code a
little bit as a result.
2015-02-06 12:41:38 +08:00
William Hua
0a64a4f3c0 mir: release surface before rendering parent
We should remove the mir and cairo surface before rendering the
transient_for, which will regenerate the cairo surface anyways.
Otherwise, we end up releasing both, when we only really want to get rid
of the mir surface.
2015-02-05 17:26:19 +01:00
William Hua
85c5f6058a mir: don't always request mir surfaces
Some child window behaviour is faked by painting in the parent, so we
don't bother creating the Mir surface in that case.
2015-02-05 17:26:19 +01:00
William Hua
bee39d2251 mir: reconstruct surface if window is moved 2015-02-05 17:26:19 +01:00
William Hua
16b250f9bb mir: stop using deprecated surface api 2015-02-05 17:26:19 +01:00
William Hua
5eacc92ba7 mir: fix issues with mouse over parent menu
Mouse over a parent menu[bar] didn't work while the menu was open.
The fix was to correct the behaviour of pointer crossing events so that
the pointer appears to be only inside one window at a time.

See: http://tronche.com/gui/x/xlib/events/window-entry-exit/normal.html
2015-02-05 17:26:19 +01:00
William Hua
6a3904cf0c mir: add back window hierarchy functions 2015-02-05 17:26:19 +01:00
William Hua
c2afa674e2 mir: stop forwarding motion events to subwindows 2015-02-05 17:26:19 +01:00
William Hua
901bc2957d mir: generate leave events for transient children 2015-02-05 17:26:19 +01:00
Marco Trevisan (Treviño)
737e598a17 mir: use monitor plug names more similar to the ones used in Xmir 2015-02-05 17:26:18 +01:00
Marco Trevisan (Treviño)
9a84c3e0f5 mir: only paint background if window has one 2015-02-05 17:26:18 +01:00
Marco Trevisan (Treviño)
38d46aacae mir: use old scrolling system if we get simple integer values 2015-02-05 17:26:18 +01:00
William Hua
584cfff90a mir: end the current grab on ungrab 2015-02-05 17:26:18 +01:00
William Hua
e843d94405 mir: only render non-top-level transients. 2015-02-05 17:26:18 +01:00
Marco Trevisan (Treviño)
9abf990656 mir: handle new MirCloseSurfaceEvent 2015-02-05 17:26:18 +01:00