summaryrefslogtreecommitdiff
path: root/gdk/gdkinternals.h
Commit message (Collapse)AuthorAgeFilesLines
* gdkinternals: Document our drawing and painting process betterJasper St. Pierre2014-11-221-5/+72
|
* gdkgl: Texture many quads at once for performance reasonsJasper St. Pierre2014-11-221-3/+4
| | | | | This isn't fully performant yet. To be fully performant, we'd need to do everything in one giant buffer.
* gdkgl: Use a GdkTexturedQuad struct to paint quadsJasper St. Pierre2014-11-221-4/+8
| | | | We'll soon have a new function that paints multiple quads.
* Add gdk_window_get_unscaled_sizeAlexander Larsson2014-11-201-1/+3
| | | | | | | | | This is required for the X backend GL integration. If the window has a height that is not a multiple of the window scale we can't properly do the y coordinate flipping that GL needs. Other backends can ignore this and use the default implementation. https://bugzilla.gnome.org/show_bug.cgi?id=739750
* gdk: Make debug-updates a per-display settingMatthias Clasen2014-11-101-0/+1
| | | | | Add private API to set this per-display, and make the existing gdk_window_set_debug_update function set a global default.
* Move GDK GL flags accessors to the private vtableEmmanuele Bassi2014-11-081-6/+0
| | | | | | This allows us to use the GDK_PRIVATE_CALL macro inside gtk. https://bugzilla.gnome.org/show_bug.cgi?id=739781
* Don't make the gl flags APIMatthias Clasen2014-11-071-0/+14
| | | | | | We need to export the symbols so they can be used in the inspector, but we don't really want to make this supported public API, so keep them out of installed headers.
* Export API to set GL flagsMatthias Clasen2014-11-061-9/+0
| | | | This will be used in the inspector.
* GdkGL: Fix up GL_ARB_texture_rectangle supportAlexander Larsson2014-11-061-0/+1
| | | | | This broke when gdk_gl_texture_quad moved to shaders. We need a specialized shader for the rectangle case.
* Add support for GDK_GL=texture-rectanglesAlexander Larsson2014-11-061-0/+1
| | | | This allows us to test our support for GL_ARB_texture_rectangle
* Add GDK_GL env var and GdkGLFlagsAlexander Larsson2014-11-061-2/+10
| | | | | | | | | | | | | | | | | | | | | This moves the GDK_ALWAYS_USE_GL env var to GDK_GL=always. It also changes GDK_DEBUG=nogl to GDK_GL=disable, as GDK_DEBUG is really only about debug loggin. It also adds some completely new flags: software-draw-gl: Always use software fallback for drawing gl content to a cairo_t. This disables the fastpaths that exist for drawing directly to a window and instead reads back the pixels into a cairo image surface. software-draw-surface: Always use software fallback for drawing cairo surfaces onto a gl-using window. This disables e.g. texture-from-pixmap on X11. software-draw: Enables both the above.
* gdk_gl_texture_quad: Use shaders to texture thingsAlexander Larsson2014-11-061-1/+2
| | | | | | This is the modern way OpenGL works, and using it will let us switch to a core context for the paint context, and work on OpenGL ES 2.0.
* Add gdk_gl_texture_quad() helperAlexander Larsson2014-11-061-0/+4
| | | | | Right now this just centralizes the glBegin/glEnd code, but this will be replaced with buffer objects later.
* gdk: Add GDK_DEBUG=noglBenjamin Otte2014-10-161-1/+2
| | | | | | | This is mostly useful for fallback testing. I suppose if people want finer grained GL ability testing, they can use Mesa environment variables to tune things.
* gdk: Add support for OpenGLAlexander Larsson2014-10-131-1/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Change the way the update area is tracked during paintAlexander Larsson2014-10-131-0/+6
| | | | | | | | | | | First of all we track the current update area during an update in window->active_update_area. This will be used later in end_paint to know the damaged area. Secondly we keep track of old update areas for the last 2 frames. This will later allow us to reuse old framebuffer contents in double or tripple buffer setups, only painting what has changed since then.
* Add internal gdk_cairo_region_from_clip helperAlexander Larsson2014-10-131-2/+4
| | | | | This extract the current cairo clip region if possible and returns it as a cairo_region_T. It will be needed by later code.
* gdk: Deprecate static gravitiesBenjamin Otte2014-10-061-1/+0
| | | | | ... and remove all implementations. The API allows to not work "if the server doesn't support it. So from now on, no server does!
* GdkWindow: Remove unused fieldsAlexander Larsson2014-09-051-6/+0
| | | | | clip_region_with_children and layered_region is not used any more, remove them.
* Handle resolution changes in the GDK backend codeOwen W. Taylor2014-07-131-0/+2
| | | | | | | | | | | | | | | gdk_x11_display_set_window_scale() affects the interpretation of the Xft/DPI XSETTING - it is substituted inside GDK with the value of Gdk/UnscaledDPI xsetting. However, this change is not propagated to GTK+ and from GTK+ back to gdk_screen_set_resolution() until the main loop is run. Fix this by handling the screen resolution directly in gdk/x11. This requires duplication of code between GDK and GTK+ since we still have to handle DPI in GTK+ in the case that GdkSettings:gtk-xft-dpi is set by the application. https://bugzilla.gnome.org/show_bug.cgi?id=733076
* gdkwindow: Make gdk_window_add_damage more privateJasper St. Pierre2014-06-231-3/+0
|
* gdkwindow: Remove the ability to call begin_paint_region more than onceJasper St. Pierre2014-06-201-1/+5
| | | | | | | | | | | | | | | Previously, each begin_paint_region added to a stack of current paints, and when end_paint was called, the paint was popped off of the stack and the surface was composited into the parent paint surface. However, the code was broken in the case of a backend like Wayland which didn't keep track of nested calls and simply wiped and returned the native impl backing surface every time. Since this feature is flat out unused by GTK+ and we don't want to really support tricksy things like these for other clients, just remove the feature. If somebody does call begin_paint_region more than once, warn and return without doing anything.
* gdkwindow: Remove the internal cairo_surface used for out-of-band paintingJasper St. Pierre2014-06-201-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Traditionally, the way painting was done in GTK+ was with the "expose-event" handler, where you'd use GDK methods to do drawing on your surface. In GTK+ 2.24, we added cairo support with gdk_cairo_create, so you could paint your graphics with cairo. Since then, we've added client-side windows, double buffering, the paint clock, and various other enhancements, and the modern way to do drawing is to connect to the "draw" signal on GtkWidget, which hands you a cairo_t. To do double-buffering, the cairo_t we hand you is actually on a secret surface, not the actual backing store of the window, and when the draw handler completes we blit it into the main backing store atomically. The code to do this is with the APIs gdk_window_begin_paint_region, which creates the temporary surface, and gdk_window_end_paint which blits it back into the backing store. GTK+'s implementation of the "draw" signal uses these APIs. We've always sort-of supported people calling gdk_cairo_create "outside" of a begin_paint / end_paint like old times, but then you're not getting the benefit of double-buffering, and it's harder for GDK to optimize. Additionally, newer backends like Mir and Wayland can't actually support this model, since they're based on double-buffering and swapping buffers at various points in time. If we hand you a random cairo_t, we have no idea when is a good time to swap. Remove support for this. This is technically a GDK API break: a warning is added in cases where gdk_cairo_create is called outside of a paint cycle, and the returned surface is a dummy that won't ever be composited back onto the main surface. Testing with complex applications like Ardour didn't produce any warnings.
* gdk: Add new _gdk_set_window_stateJasper St. Pierre2014-05-131-0/+3
| | | | | | | | Wayland's mechanism tells us all of our new states, rather than telling us which ones were added and removed. Add a new private interface so that we can simply specify the new states as a bitfield directly rather than having to compute which ones were added and removed.
* Remove gdk_synthesize_window_state from gdkinternals.hJasper St. Pierre2014-04-121-4/+0
| | | | It's already in gdkprivate.h
* Some struct repackingMatthias Clasen2014-01-121-9/+10
| | | | Save a few bytes here and there.
* Handle recursion from motion event handlersOwen W. Taylor2013-11-111-1/+8
| | | | | | | | | | | | If a motion event handler (or other handler running from the flush-events phase of the frame clock) recursed the main loop then flushing wouldn't complete until after the recursed main loop returned, and various aspects of the state would get out of sync. To fix this, change flushing of the event queue to simply mark events as ready to flush, and let normal event delivery handle the rest. https://bugzilla.gnome.org/show_bug.cgi?id=705176
* Add an event_compression setting to GdkWindowDaniel Sabo2013-11-091-0/+1
| | | | | | | | Setting event compression to false will allow inter-frame mouse motion events to be delivered, which are necessary for painting applications to produce smooth strokes. https://bugzilla.gnome.org/show_bug.cgi?id=702392
* gdk: Convert mouse position to doubles, add new gettersAlexander Larsson2013-07-031-3/+3
| | | | | | | | We've long had double precision mouse coordinates on wayland (e.g. when rotating a window) but with the new scaling we even have it on X (and, its also in Xinput2), so convert all the internal mouse/device position getters to use doubles and add new accessors for the public APIs that take doubles instead of ints.
* GdkWindow: Fix shape handling for native windowsAlexander Larsson2013-05-151-0/+1
| | | | | | | | | | | | | | | We don't track the full clip for each window anymore, as this is not useful when no windows are opaque. However, we still need the full clip for the shape, so its calculated manually. However, it was previously only recalculated when the clip changes which doesn't correctly handle the case of a sibling geometry changing. So, instead of doing this directly when geometry changes we just set a bit in the toplevel whenever some window geometry changes, and we then handle this in process_updates, updating the shape for all native windows. This should be ok performance-wise because we don't expect a lot of native children.
* GdkWindow: Track all native windows of native windowsAlexander Larsson2013-05-151-0/+1
| | | | | | We keep a list of all native children of a native window. This means we don't have to recurse over the entire hierarchy to find any native children.
* gdkwindow: Avoid some unnecessary typechecksAlexander Larsson2013-05-071-2/+2
| | | | | | This removes the typechecks in GDK_WINDOW_TYPE and GDK_WINDOW_DESTROYED. These are only used internally in gdkwindow.c and gdkdisplay.c anyway, and these functions check for typesafety of arguments on function entry.
* Add gdk_window_set_invalidate_handlerAlexander Larsson2013-05-071-0/+1
| | | | | | | | This lets you register callbacks for when child widgets invalidate areas of the window read it and/or change it. For instance, this lets you do rendering effects and keeping offscreen caches uptodate.
* gdkwindow: Make GdkPaintable normal GdkWindowImpl vfuncsAlexander Larsson2013-05-071-20/+0
| | | | | There is no need for this to be a separate interface, its just looking weird.
* gdkwindow: Remove implicit paintsAlexander Larsson2013-05-071-2/+1
| | | | | | | We now only do one expose event per native window, so there will only be one begin/end_paint() call. This means all the work with implicit paints to combine the paints on a single double buffer surface is unnecessary, so we can just delete it.
* gdkwindow: Remove outstanding_moves stuffAlexander Larsson2013-05-071-2/+0
| | | | | Since we now never move regions directly on the window we can remove all the stuff that track outstanding moves and flushes then.
* gdk: Remove unused functionBenjamin Otte2013-04-151-2/+0
|
* gdk: Add a debug category for settingsBenjamin Otte2013-02-191-1/+2
|
* GdkFrameTimings: strip down to a minimal public APIOwen W. Taylor2013-02-141-18/+0
| | | | | | | | | Since we're not exporting the ability to create your own frame clock for now, remove the setters for GdkFrameTimings fields. Also remove all setters and getters for fields that are more about implementation than about quantities that are meaningful to the applcation and just access the fields directly within GDK.
* Merge GdkFrameHistory into GdkFrameClockOwen W. Taylor2013-02-141-3/+0
| | | | | | Now that GdkFrameClock is a class, not interface, there's no real advantage to splitting the frame history into an aggregate object, so directly merge it into GdkFrameClock.
* Add GDK_DEBUG=framesOwen W. Taylor2013-02-141-1/+22
| | | | | | Add a debug option to print out detailed statistics about each frame drawn. https://bugzilla.gnome.org/show_bug.cgi?id=685460
* Compress motion synchronized with the paint cycleOwen W. Taylor2013-02-141-0/+3
| | | | | | | | | | | | | | | | | | | When we have pending motion events, instead of delivering them directly, request the new FLUSH_EVENTS phase of the frame clock. This allows us to compress repeated motion events sent to the same window. In the FLUSH_EVENTS phase, which occur at priority GDK_PRIORITY_EVENTS + 1, we deliver any pending motion events then turn off event delivery until the end of the next frame. Turning off event delivery means that we'll reliably paint the compressed motion events even if more have arrived. Add a motion-compression test case which demonstrates behavior when an application takes too long handle motion events. It is unusable without this patch but behaves fine with the patch. https://bugzilla.gnome.org/show_bug.cgi?id=685460
* Add GdkFrameClockOwen W. Taylor2013-02-141-0/+2
| | | | | | | | | | | | | Add an object GdkFrameClock that we associate with a GdkWindow. This tracks when the window needs to be repainted, and will also be used for other operations in the future like relayout and updating animations. Based on a patch from Havoc Pennington: https://mail.gnome.org/archives/gtk-devel-list/2010-October/msg00004.html https://bugzilla.gnome.org/show_bug.cgi?id=685460
* gdkwindow: Allow gdk_window_set_opacity on non-native childrenAlexander Larsson2013-02-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | We now store the current opacity for all windows. For native windows we just call into the native implementation whenever the opacity changes. However, for non-native windows we implement opacity by pushing a second implicit paint that "stacks" on the existing one, acting as an opacity group while rendering the window and its children. This works well in general, although any native child windows will of course not be opaque. However, there is no way to implement implicit paint flushing (i.e. draw the currently drawn double buffer to the window in order to allow direct drawing to the window). We can't flush in the stacked implicit paint case because there is no way to get the right drawing behaviour when drawing directly to the window. We *must* draw to the opacity group to get the right behaviour. We currently flush if: * A widget disables double buffering * You call move/resize/scroll a window and it has non-native children during the expose handler In case this happens we warn and flush the outermost group, so there may be drawing errors. https://bugzilla.gnome.org/show_bug.cgi?id=687842
* gdkwindow: Store the implicit paint in a listAlexander Larsson2013-02-071-1/+1
| | | | | | | This changes nothing, but lets us later have multiple implicit paints https://bugzilla.gnome.org/show_bug.cgi?id=687842
* gdk: add gdk_window_set_fullscreen_mode()Olivier Fourdan2013-01-251-0/+1
| | | | | | | | | | | | | and gdk_window_get_fullscreen_mode() API to allow applications to specify if a fullscreen window should span across all monitors in a multi-monitor setup or remain on the current monitor where the window is placed. Fullscreen mode can be either GDK_FULLSCREEN_ON_ALL_MONITORS or GDK_FULLSCREEN_ON_CURRENT_MONITOR. https://bugzilla.gnome.org/show_bug.cgi?id=691856
* win32: Remove some unused input stuff to make win32 build againAlexander Larsson2012-03-061-1/+0
| | | | Input events doesn't quite seem to work though, so it needs some fixing.
* gdk: Add internal API to set "pointer emulated" flag on eventsCarlos Garnacho2012-03-011-1/+11
| | | | | This flag will be used for non-pointer events that are emulated from eg. touch events, or pointer events being emulated.
* Change FSF AddressJavier Jardón2012-02-271-3/+1
|
* gdk: Remove unused _gdk_window_calculate_full_clip_regionAlexander Larsson2011-12-051-5/+0
|