Commit Graph

49396 Commits

Author SHA1 Message Date
Timm Bäder
1aa1676d9d menu: Replace button-press-handler with gesture 2016-12-07 18:06:37 +01:00
Timm Bäder
be9adea58e toolbar: Replace button-press-event handler with gesture 2016-12-07 18:06:32 +01:00
Timm Bäder
55b1f231fb linkbutton: Replace button-press-event handler with gesture 2016-12-07 18:06:28 +01:00
Timm Bäder
c4a6c37767 separatortoolitem: Remove button-event/motion-event handlers
These only exist for the window dragging which does not exist anymore
currently. It will be reintroduced later in a form that does not require
these handlers.
2016-12-07 18:06:23 +01:00
Timm Bäder
4c12c4ba02 snapshot: Add annotations to parameters/return values 2016-12-07 18:06:17 +01:00
Timm Bäder
ea22bd9d40 widget: Use gtk_widget_measure to measure widget sizes 2016-12-07 08:19:22 +01:00
Timm Bäder
07a9b202ab widget: Remove _gtk_widget_supports_clip 2016-12-07 08:19:22 +01:00
Timm Bäder
3063d4a5e3 widget: Remove gtk_widget_invalidate_style_context 2016-12-07 08:19:22 +01: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
Piotr Drąg
82401032c5 Update POTFILES.in 2016-12-05 19:46:59 +01:00
William Hua
fdec3e8a3f build: add gir depends for GdkX11, GdkWin32, and Gsk on Gdk
https://bugzilla.gnome.org/show_bug.cgi?id=775651
2016-12-05 12:56:50 -05: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
582ea50faa inspector: Add support for displayin the render region
Now I just need a UI designer that makes this look nice...
2016-12-05 15:02:47 +01:00
Benjamin Otte
9597caef5e glrenderer: Always redraw the whole screen 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
60567db486 gskrenderer: Add gsk_renderer_begin_draw_frame()
This way, we can hijack the begin/end draw process and do out own
processing before passing it on to GDK.
2016-12-05 15:02:47 +01:00
Benjamin Otte
e950a5190d inspector: Pass the drawing context into the recorder
That way we can capture both the actual changes (clip region) and the
area that was redrawn (render region), which in OpenGL might not be
identical.

Nothing shows the render region yet though...
2016-12-05 15:02:47 +01:00
Benjamin Otte
358aca9e20 glrenderer: Always redraw the whole screen 2016-12-05 15:02:47 +01:00
Benjamin Otte
da8d886b17 gsk: Change GSK_USE_SOFTWARE env var to GSK_RENDERER
This way, we can use the variable as more than a boolean flag.

This will be useful for Vulkan or D3D renderers.
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
4b484557f5 gsk: Allow 0 for gsk_gl_driver_begin_frame()
Special-case this situation to unset the current framebuffer and render
to the backbuffer again.
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
Benjamin Otte
bddfd7bb41 gdk: Remove all code that only existed because of use_gl
Now that we don't use GL anymore, this code is unnecessary.
2016-12-05 15:02:47 +01:00
Benjamin Otte
77d336de17 gdk: Never draw with GL
This is a temporary switch-off of the GL dawing code that will make
things keep running. All GL related code (like the GSK renderer or
GtkGLArea will now fall back to software.
2016-12-05 15:02:47 +01:00
Benjamin Otte
e42e27304a gskrenderer: Store the GL context
And use it to create the drawing context with it.

Note that this doesn't yet have any effect and is all infrastructure
preparation work.
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
9c041f6bcc window: Change behavior of gdk_window_begin_draw_frame()
(1) Require a native window
(2) Create the drawing context before calling begin_paint().
2016-12-05 15:02:47 +01:00
Benjamin Otte
a860bbbe46 drawingcontext: Store the GL paint context 2016-12-05 15:02:47 +01:00
Benjamin Otte
633631a47b cssgadget: Compute relative to own allocation, not widget allocation
This would lead to clipped gadgets when the gadget allocation differed
from the widget allocation, like in GtkListBox.
2016-12-05 15:02:46 +01:00
Olivier Fourdan
f6b4477393 wayland: destroy subsurfaces along with parents
Wayland subsurfaces can have other native window parents, but those need
to be destroyed along with the rest of the window hierarchy otherwise
an assert() is reached.

https://bugzilla.gnome.org/show_bug.cgi?id=774915
2016-12-05 10:56:41 +01:00
Timm Bäder
ac20c3eb22 frame: Use gtk_widget_measure to measure child sizes 2016-12-04 12:00:46 +01:00
Timm Bäder
7096d6dd28 viewport: Use gtk_widget_measure to measure child sizes
and rewrite the adjustment handling in a orientation-agnostic way.
2016-12-04 12:00:46 +01:00
Timm Bäder
5ee590fbc8 scrolledwindow: measure child widgets using gtk_widget_measure 2016-12-04 12:00:46 +01:00
Timm Bäder
1ab3d32808 revealer: Measure child widget size using gtk_widget_measure 2016-12-04 12:00:46 +01:00
Timm Bäder
7f8d0acfd3 headerbar: measure children using gtk_widget_measure 2016-12-04 12:00:46 +01:00
Timm Bäder
d45e5ef3dc widget-factory: Use GtkButton:icon-name to construct icon buttons 2016-12-04 12:00:45 +01:00
Timm Bäder
5b05c12780 toolpalette: call set_has_window 2016-12-04 12:00:45 +01:00
Timm Bäder
9f98138ffb printunixdialog: Remove GtkDrawingArea::draw handler
the source file has been updated to use gtk_drawing_area_set_draw_func,
but the draw_cb handler in the ui file is still left.
2016-12-04 12:00:38 +01:00
Benjamin Otte
0d68b22479 stylecontext: Remove a bunch of unneeded headers 2016-12-03 18:15:49 +01:00
Daniel Boles
8efc91c4e0 GtkProgressBar: trivial conditional optimisation
I'd hope the compiler would realise this for us, but let's be explicit.
2016-12-03 16:27:03 +00:00
Timm Bäder
3dac21f20b entry: Refactor get_icon_pixbuf
This way it will only return a pixbuf if the icon helper has a pixbuf.
2016-12-03 13:19:26 +01:00