gtk/gdk/x11
Alexander Larsson 038aac6275 gdk: Add support for OpenGL
This adds the new type GdkGLContext that wraps an OpenGL context for a
particular native window. It also adds support for the gdk paint
machinery to use OpenGL to draw everything. As soon as anyone creates
a GL context for a native window we create a "paint context" for that
GdkWindow and switch to using GL for painting it.

This commit contains only an implementation for X11 (using GLX).

The way painting works is that all client gl contexts draw into
offscreen buffers rather than directly to the back buffer, and the
way something gets onto the window is by using gdk_cairo_draw_from_gl()
to draw part of that buffer onto the draw cairo context.

As a fallback (if we're doing redirected drawing or some effect like a
cairo_push_group()) we read back the gl buffer into memory and composite
using cairo. This means that GL rendering works in all cases, including
rendering to a PDF. However, this is not particularly fast.

In the *typical* case, where we're drawing directly to the window in
the regular paint loop we hit the fast path. The fast path uses opengl
to draw the buffer to the window back buffer, either by blitting or
texturing. Then we track the region that was drawn, and when the draw
ends we paint the normal cairo surface to the window (using
texture-from-pixmap in the X11 case, or texture from cairo image
otherwise) in the regions where there is no gl painted.

There are some complexities wrt layering of gl and cairo areas though:
* We track via gdk_window_mark_paint_from_clip() whenever gtk is
  painting over a region we previously rendered with opengl
  (flushed_region). This area (needs_blend_region) is blended
  rather than copied at the end of the frame.
* If we're drawing a gl texture with alpha we first copy the current
  cairo_surface inside the target region to the back buffer before
  we blend over it.

These two operations allow us full stacking of transparent gl and cairo
regions.
2014-10-13 10:43:31 -04:00
..
gdkapplaunchcontext-x11.c docs: use apostrophes in *n't 2014-02-07 13:32:47 -05:00
gdkasync.c all: Name more idles and timeouts 2014-03-26 20:09:30 -04:00
gdkasync.h Change FSF Address 2012-02-27 17:06:11 +00:00
gdkcursor-x11.c docs: use Returns: consistently 2014-02-19 18:56:05 -05:00
gdkdevice-core-x11.c Fix a thinko in creating event masks 2014-08-14 00:10:23 -04:00
gdkdevice-xi2.c x11: Unset GdkX11DeviceXI2 scroll valuators on device change 2013-11-22 12:49:32 +01:00
gdkdevicemanager-core-x11.c x11: Handle XINotifyPassiveGrab/Ungrab in focus events 2013-12-04 21:22:23 -05:00
gdkdevicemanager-x11.c docs: use apostrophes in *n't 2014-02-07 13:32:47 -05:00
gdkdevicemanager-xi2.c gdkdevicemanager-xi2: Add debug output for key events 2014-06-29 19:10:42 -04:00
gdkdevicemanagerprivate-core.h x11: Avoid spurious focus events on grabs 2012-03-07 15:35:21 +01:00
gdkdisplay-x11.c gdk: Add support for OpenGL 2014-10-13 10:43:31 -04:00
gdkdisplay-x11.h gdk: Add support for OpenGL 2014-10-13 10:43:31 -04:00
gdkdisplaymanager-x11.c displaymanager: Remove GInitable implementation 2013-05-02 16:17:30 +02:00
gdkdnd-x11.c x11: Fix possible leak of GdkEvents 2014-08-22 13:24:48 +02:00
gdkeventsource.c Handle recursion from motion event handlers 2013-11-11 23:17:14 -05:00
gdkeventsource.h Change FSF Address 2012-02-27 17:06:11 +00:00
gdkeventtranslator.c Change FSF Address 2012-02-27 17:06:11 +00:00
gdkeventtranslator.h Change FSF Address 2012-02-27 17:06:11 +00:00
gdkgeometry-x11.c gdkwindow: Don't bother with a return parameter for queue_antiexpose 2014-06-21 18:45:39 -04:00
gdkglcontext-x11.c gdk: Add support for OpenGL 2014-10-13 10:43:31 -04:00
gdkglcontext-x11.h gdk: Add support for OpenGL 2014-10-13 10:43:31 -04:00
gdkkeys-x11.c docs: use apostrophe in *'ll 2014-02-07 13:35:54 -05:00
gdkmain-x11.c Revert "docs: Fix broken gtk-doc formatting" 2014-08-18 08:18:02 -04:00
gdkprivate-x11.h gdkwindow: Don't bother with a return parameter for queue_antiexpose 2014-06-21 18:45:39 -04:00
gdkproperty-x11.c Drop GDK_MULTIHEAD_SAFE 2014-06-11 21:55:15 -04:00
gdkscreen-x11.c x11: Neuter workarea in fullscreen scenarios 2014-09-24 20:31:11 -04:00
gdkscreen-x11.h x11: keep track of the screen pixel size by calculating the bounding box of monitors 2013-11-25 17:19:46 +01:00
gdkselection-x11.c docs: use Returns: consistently 2014-02-19 18:56:05 -05:00
gdksettings.c Implement titlebar action settings for X11 2014-09-25 14:54:49 -04:00
gdktestutils-x11.c Change FSF Address 2012-02-27 17:06:11 +00:00
gdkvisual-x11.c docs: use Returns: consistently 2014-02-19 18:56:05 -05:00
gdkwindow-x11.c gdk: Add support for OpenGL 2014-10-13 10:43:31 -04:00
gdkwindow-x11.h Some struct repacking 2014-01-12 22:25:19 -05:00
gdkx11applaunchcontext.h Add GDK_AVAILABLE_IN_ALL annotations in gdk 2013-05-05 15:38:46 -04:00
gdkx11cursor.h docs: don't use <type> tags 2014-01-28 00:21:26 -05:00
gdkx11device-core.h Add GDK_AVAILABLE_IN_ALL annotations in gdk 2013-05-05 15:38:46 -04:00
gdkx11device-xi2.h Add GDK_AVAILABLE_IN_ALL annotations in gdk 2013-05-05 15:38:46 -04:00
gdkx11device.h Move single-include guards inside include guards 2012-12-28 09:57:56 -05:00
gdkx11devicemanager-core.h Add GDK_AVAILABLE_IN_ALL annotations in gdk 2013-05-05 15:38:46 -04:00
gdkx11devicemanager-xi2.h Add GDK_AVAILABLE_IN_ALL annotations in gdk 2013-05-05 15:38:46 -04:00
gdkx11devicemanager-xi.h Add GDK_AVAILABLE_IN_ALL annotations in gdk 2013-05-05 15:38:46 -04:00
gdkx11devicemanager.h Move single-include guards inside include guards 2012-12-28 09:57:56 -05:00
gdkx11display.h x11: Add gdk_x11_display_set_window_scale 2013-08-20 11:15:08 +02:00
gdkx11displaymanager.h Add GDK_AVAILABLE_IN_ALL annotations in gdk 2013-05-05 15:38:46 -04:00
gdkx11dnd.h Add GDK_AVAILABLE_IN_ALL annotations in gdk 2013-05-05 15:38:46 -04:00
gdkx11glcontext.h gdk: Add support for OpenGL 2014-10-13 10:43:31 -04:00
gdkx11keys.h Add GDK_AVAILABLE_IN_ALL annotations in gdk 2013-05-05 15:38:46 -04:00
gdkx11property.h Drop GDK_MULTIHEAD_SAFE 2014-06-11 21:55:15 -04:00
gdkx11screen.h Drop GDK_MULTIHEAD_SAFE 2014-06-11 21:55:15 -04:00
gdkx11selection.h Add GDK_AVAILABLE_IN_ALL annotations in gdk 2013-05-05 15:38:46 -04:00
gdkx11utils.h Drop GDK_MULTIHEAD_SAFE 2014-06-11 21:55:15 -04:00
gdkx11visual.h Add GDK_AVAILABLE_IN_ALL annotations in gdk 2013-05-05 15:38:46 -04:00
gdkx11window.h docs: don't use <type> tags 2014-01-28 00:21:26 -05:00
gdkx.h gdk: Add support for OpenGL 2014-10-13 10:43:31 -04:00
gdkxftdefaults.c Change FSF Address 2012-02-27 17:06:11 +00:00
gdkxid.c docs: use Returns: consistently 2014-02-19 18:56:05 -05:00
Makefile.am gdk: Add support for OpenGL 2014-10-13 10:43:31 -04:00
MwmUtil.h Change FSF Address 2012-02-27 17:06:11 +00:00
xsettings-client.c Handle resolution changes in the GDK backend code 2014-07-13 15:35:23 -04:00
xsettings-client.h Fix font size when gdk_x11_display_set_window_scale() is used 2014-03-06 23:20:00 -05:00