Commit Graph

230 Commits

Author SHA1 Message Date
Benjamin Otte
ed1b6a9bed gdkwindow: Remove event_mask arguments from constructors 2017-11-13 23:41:38 +01:00
Matthias Clasen
606345cbaa Change the fullscreen-on-monitor api
Use GdkMonitor here, since that is our primary monitor
object now, and GdkScreen is going away.
2017-11-01 14:17:20 -04:00
Matthias Clasen
2d6bd1ae6d Drop gdk_window_get_screen
This includes removing the GdkScreen argument from the
create_window_impl display vfunc.
2017-10-31 17:25:01 -04:00
Alexander Larsson
d3fc937b4d GtkWindow/GdkWindow: Finish converting icons to surfaces
There were some parts left, for instance gdk_window_set_icon_list.
2017-10-23 13:45:25 +02:00
Timm Bäder
c468cdf8b6 gdk: Remove another gdk_window_new_input reference
The most obvious one.
2017-08-15 15:00:49 +02:00
Matthias Clasen
0eaf861420 Remove root window getters from public API
These are now just used internally in GDK.
2017-08-11 15:45:24 -04:00
Matthias Clasen
953e762843 Move GdkWindowWindowClass to private headers
This enum is no longer used in public api.
2017-07-19 23:11:12 -04:00
Matthias Clasen
394c21da98 Drop an unused typedef
GdkWindowRedirect is not used anywhere anymore.
2017-07-19 23:11:12 -04: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
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
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
332ed7be5b API: Require passing a GLContext to begin_draw_frame()
This is in preparation for requiring explicit passing of GL contexts
when drawing.
2016-12-05 15:02:47 +01:00
Benjamin Otte
4b6e70b9c8 gdk: Get rid of all mentions of process_all_updates() 2016-11-24 15:26:49 +01:00
Benjamin Otte
ef75ca2d53 API: gdk: Remove gdk_window_process_updates()
We have a frame clock now.
2016-11-23 19:02:58 +01:00
Benjamin Otte
9fe8b1e112 API: gdk: Remove gdk_window_new()
It's finally no longer public API.
2016-11-07 01:12:47 +01:00
Benjamin Otte
3b93773add API: gdk: Add gdk_window_new_temp()
Your one stop shop for all those nasty hidden input-only windows.
2016-11-07 01:03:17 +01:00
Benjamin Otte
24d0baec38 API: gdk: Add gdk_window_new_popup()
... and use it.
2016-11-06 23:47:56 +01:00
Benjamin Otte
87f07bac6b API: gdk: Add gdk_window_new_toplevel()
... and use it in GTK.
2016-11-06 17:40:59 +01:00
Benjamin Otte
7a6cab14eb gdkwindow: Remove GdkWindowAttr.type_hint
Instead, let the callers call gdk_window_set_type_hint(). Which is
surprsingly what every backend did.
2016-11-06 16:22:21 +01:00
Benjamin Otte
9707f4d3b3 API: gdk: Remove title from gdk_window_new()
Use gdk_window_set_title() afterwards instead.
2016-11-05 03:32:27 +01:00
Benjamin Otte
b9955cfff1 API: gdk: Remove override_redirect flag from GdkWindowAttr
When you want an override-redirect window, you create it that way by
creating a GDK_WINDOW_TEMP window.
2016-11-05 03:32:27 +01:00
Benjamin Otte
33e7a7898f API: gdk: Remove gdk_window_set_override_redirect()
When you want an override-redirect window, you create it that way.
Changing that behavior is not supported anywhere (but on X of course).
2016-11-05 03:32:27 +01:00
Benjamin Otte
f420dc7456 API: gdk: Remove gdk_window_get_visual()
With it, remove window->visual.
2016-10-28 05:22:49 +02:00
Benjamin Otte
dd105f3db8 gdk: Remove gdk_window_set_invalidate_handler()
It's not used anymore.
2016-10-27 05:03:06 +02:00
Matthias Clasen
5e4a05e5b7 Remove deprecated gdk_window_get_pointer 2016-10-25 19:45:48 -04:00
Alexander Larsson
70935f0952 Drop support for offscreen GdkWindows
These complicate a lot of GdkWindow internals to implement features
that not a lot of apps use, and will be better achieved using gsk.
So, we just drop it all.
2016-10-25 09:54:37 +02:00
Rico Tzschichholz
639898000e gdkwindow: Remove deprecated API 2016-10-24 12:22:32 +02:00
Benjamin Otte
d22e5e69d9 API: gdk: Add gdk_window_new_child() and gdk_window_new_input()
This is an attempt to get rid of gdk_window_new() for more specific use
cases. These 2 are for client-side windows - regular ones and input-only
ones resepectively.

So far all those functions just call into gdk_window_new().
2016-10-18 00:22:35 +02:00
Benjamin Otte
a65a4de38d gdk: Remove old code to create drawing context
You now have to use a GdkDrawingContext
2016-10-16 18:18:58 +02:00
Benjamin Otte
e76ba9a3c3 gdk: Remove gdk_window_set_debug_updates()
The update tracking code was ugly and using deprecated drawing APIs. It
was also in the wrong place.

So instead of trying to keep it working, I'll remove it. We need to find
a better way to put it and make it work there.
2016-10-16 18:18:58 +02:00
Benjamin Otte
eace2cf421 API: Remove gdk_window_set_background()
Backgrounds are always transparent black.
2016-10-16 18:17:21 +02:00
Benjamin Otte
662001b60a API: Remove ability to set visuals on windows
And with it, gtk_widget_get_visual() and gtk_widget_set_visual() are
gone.

We now always use the RGBA visual (if available) and otherwise fall back
to the system visual.
2016-10-16 18:17:21 +02:00
Benjamin Otte
fcbd480c76 API: Remove GDK_WA_CURSOR
The cursor was set using gdk_window_set_cursor() even in
gdk_window_new().

So instead of having yet another flag, just make the users of that flag
call gdk_window_set_cursor() directly after the window was created.
2016-10-16 18:17:21 +02:00
Benjamin Otte
2fd5048943 API: window: Remove suppport for changing wmclass_name/group
X11 was the only backend to support it and people can just override it
using XSetClassHint() directly.
The docs already advertised the function as "Do not use".

Keep the existing call to XSetClassHint() in place, so that we keep
setting the same values as in GTK3.
2016-10-16 18:17:21 +02:00
William Hua
b3a530cb72 gdkwindow: add gdk_window_move_to_rect ()
https://bugzilla.gnome.org/show_bug.cgi?id=756579
2016-07-19 09:38:54 -04:00
Emmanuele Bassi
c5d0522a23 Deprecate the gdk_window_begin/end_paint family of functions
They are replaced by the more appropriate gdk_window_begin_draw_frame()
and gdk_window_end_draw_frame() functions.

https://bugzilla.gnome.org/show_bug.cgi?id=766675
2016-06-09 17:45:40 +01:00
Emmanuele Bassi
a7ef37da2a Add GdkDrawingContext
Instead of giving out Cairo contexts, GdkWindow should provide a
"drawing context", which can then create Cairo contexts on demand; this
allows us to future proof the API for when we're going to use a
different rendering pipeline, like OpenGL.

https://bugzilla.gnome.org/show_bug.cgi?id=766675
2016-06-09 17:45:40 +01:00
Emmanuele Bassi
fc569f1ac6 Add frame drawing API to GdkWindow
Existing code drawing on a GDK window has to handle the direct drawing
and the buffered drawing by itself, by checking the window type and
whether or not the window is backed by a native windowing surface. After
that, the calling code has to create a Cairo context from the window and
keep an association between the context and the window itself.

This is completely unnecessary: GDK can determine whether or not it
should use a backing store to draw on a GdkWindow as well as create a
Cairo context, and keep track of it.

This allows to simplify the calling code, and enforce some of the
drawing behavior we want to guarantee to users.

https://bugzilla.gnome.org/show_bug.cgi?id=766675
2016-06-09 17:45:40 +01:00
William Hua
c6bd3ddb8a gdkwindow: move GdkWindowTypeHint to gdktypes.h 2015-12-15 10:13:03 -05:00
Jeremy Whiting
f9d903995d Added api to set a window to fullscreen on a given monitor.
https://bugzilla.gnome.org/show_bug.cgi?id=752677
2015-07-25 07:08:59 -06:00
Matthias Clasen
23ce2562bf Fix up doc comments 2015-06-23 17:27:42 -04:00
Alexander Larsson
4c3eece663 gdk: Add gdk_window_set_pass_through
An pass_through window is something you can draw in but does not
affect event handling. Normally if a window has with no event mask set
for a particular event then input events in it go to its parent window
(X11 semantics), whereas if pass_through is enabled the window below
the window will get the event. The later mode is useful when the
window is partially transparent. Note that an pass-through windows can
have child windows that are not pass-through so they can still get events
on some parts.

Semantically, this behaves the same as an regular window with
gdk_window_set_child_input_shapes() called on it (and re-called any
time a child is changed), but its far more efficient and easy to use.

This allows us to fix the testoverlay input stacking test.

https://bugzilla.gnome.org/show_bug.cgi?id=750568

https://bugs.freedesktop.org/show_bug.cgi?id=90917
2015-06-15 10:56:45 +02: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
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
Emmanuele Bassi
cdcd3ca359 Hide GdkWindow libgtk_only API in the private vtable
These are the last two global GDK symbols that have a libgtk_only
suffix.

https://bugzilla.gnome.org/show_bug.cgi?id=739781
2014-11-08 00:20:15 -05:00
Matthias Clasen
7de9995f7d Pedantic formatting fix 2014-10-13 10:43:32 -04:00
Matthias Clasen
7a80c3b004 Correct Since tags 2014-10-13 10:43:32 -04:00
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
Alexander Larsson
d0147a6f2c Add gdk_window_mark_paint_from_clip and call from widget drawing
This is a new function that gets called every time we're drawing
some area in the Gtk paint machinery. It is a no-op right now, but
it will be required later to keep track of what areas which
we previously rendered with GL was overwritten with cairo contents.
2014-10-13 10:43:31 -04:00