Commit Graph

47984 Commits

Author SHA1 Message Date
Emmanuele Bassi
c0f9ecbf4b gsk: Add fundamental type annotations for GskRenderNode
We need to annotate the GskRenderNode so that the introspection
machinery can find the functions for managing reference counting
and GValues.
2016-08-09 17:31:55 +01:00
Emmanuele Bassi
4484be9c7b gsk: Add 'blit' program
For the root node we do not need to use blending, as it does not have
any backdrop to blend into. We can use a simpler 'blit' program that
only takes the content of the source and fills the texture quad with
it.
2016-08-09 17:31:55 +01:00
Emmanuele Bassi
49661a7cf8 gsk: Consolidate program creation and storage
We should use ShaderBuilder to create and store programs for the GL
renderer. This allows us to simplify the creation of programs (by moving
the compilation phase into the ShaderBuilder::create_program() method),
and move towards the ability to create multiple programs and just keep a
reference to the program id.
2016-08-09 17:31:55 +01:00
Emmanuele Bassi
63d218e29c docs: Add more GSK documentation 2016-08-09 17:31:55 +01:00
Emmanuele Bassi
5ffcdc0dde gsk: Add more modes to the blend shader
Use the compositing CSS spec at:

  https://www.w3.org/TR/compositing-1/#blending

For the implementation.
2016-08-09 17:31:55 +01:00
Emmanuele Bassi
713a1c5d1d gsk: Don't store the uniform and attribute location twice
We should keep the ShaderBuilder around and use it to query the various
uniform and attribute locations when needed, instead of storing those
offsets into the Renderer instance, and copying them. This allows a bit
more flexibility, once we have more than one program built into the
renderer.
2016-08-09 17:31:55 +01:00
Emmanuele Bassi
10e197c9c2 gsk: Add getter for program id in ShaderBuilder
Since we store it into the ShaderBuilder instance we should also allow
getting the program id.
2016-08-09 17:31:55 +01:00
Emmanuele Bassi
fee200187a gsk: Add debugging notes to ShaderBuilder
Print out the generated shader and the list of available uniforms and
attributes.
2016-08-09 17:31:55 +01:00
Emmanuele Bassi
d417b1c73e gsk: Rework how GLSL shaders are built
The GL renderer should build the GLSL shaders using GskShaderBuilder.
This allows us to separate the common parts into separate files, and
assemble them as necessary, instead of shipping one big shader per type
of GL API (GL3, GL legacy, and GLES).
2016-08-09 17:31:55 +01:00
Emmanuele Bassi
b3d50a47a9 gsk: Add ShaderBuilder
GskShaderBuilder is an ancillary, private type that deals with the
internals of taking GLSL shaders from resources and building them,
with the additional feature of being able to compose shaders from a
common preamble, as well as adding conditional defines (useful for
enabling debugging code in the shaders themselves).
2016-08-09 17:31:55 +01:00
Emmanuele Bassi
4611ced84d gsk: Add rendering debug mode for shaders
It's going to be useful to inject debugging data into the shaders used
by GSK.
2016-08-09 17:31:55 +01:00
Emmanuele Bassi
fbe43c4e5d gdk: Add more GDK_GL_ERROR error ids
We're going to use them in other locations.
2016-08-09 17:31:55 +01:00
Emmanuele Bassi
1b85794ac3 build: Fix dependency on GDK for introspection scanner
Otherwise libtool may attempt to use the installed copy of GDK.
2016-08-09 17:31:55 +01:00
Emmanuele Bassi
1f2b98ccf2 gsk: Use the node's blend mode in the GL renderer 2016-08-09 17:31:55 +01:00
Emmanuele Bassi
f6fd57ea46 gsk: Store blend mode in the render node 2016-08-09 17:31:55 +01:00
Emmanuele Bassi
3c07c2543d gsk: Make GskBlendMode enumeration public 2016-08-09 17:31:55 +01:00
Emmanuele Bassi
71de0df96d gsk: Allow sampling between parent and child nodes 2016-08-09 17:31:55 +01:00
Emmanuele Bassi
2148720651 gsk: Group render state attributes 2016-08-09 17:31:55 +01:00
Emmanuele Bassi
9cce83cfc2 gsk: Turn GskRenderNode into a pure GTypeInstance
Using GObject as the base type for a transient tree may prove to be too
intensive, especially when creating a lot of node instances. Since we
don't need properties or signals, and we don't need complex destruction
semantics, we can use GTypeInstance directly as the base type for
GskRenderNode.
2016-08-09 17:31:55 +01:00
Emmanuele Bassi
657bb588b7 gtk: Use GskRenderNode to render widgets
We need a virtual function to retrieve the GskRenderNode for each
widget, which is supposed to attach its own children's GskRenderNodes.
Additionally, we want to maintain the existing GtkWidget::draw mechanism
for widgets that do not implement get_render_node() — as well as widgets
that have handlers connected to the ::draw signal.
2016-08-09 17:31:55 +01:00
Emmanuele Bassi
6686b664cd gtk: Add a GskRenderer to GtkWindow
Each top-level should have its own GskRenderer, to be used when drawing
the render node tree.
2016-08-09 17:31:55 +01:00
Emmanuele Bassi
1ebafff76b gsk: Rework GskRenderer and GskRenderNode semantics
This commit changes the way GskRenderer and GskRenderNode interact and
are meant to be used.

GskRenderNode should represent a transient tree of rendering nodes,
which are submitted to the GskRenderer at render time; this allows the
renderer to take ownership of the render tree. Once the toolkit and
application code have finished assembling it, the render tree ownership
is transferred to the renderer.
2016-08-09 17:31:55 +01:00
Emmanuele Bassi
b09441cf91 gsk: Flush the GL render items cache
Whenever the render tree changes we want to drop the RenderItem arrays,
as each item contains a pointer to the GskRenderNode which becomes
dangling once the root node changed.
2016-08-09 17:31:55 +01:00
Emmanuele Bassi
ca97923bbd gsk: Add GskRenderer::clear_tree
We need a way to clear eventual caches inside GskRenderer subclasses if
the root node has changed.
2016-08-09 17:31:55 +01:00
Emmanuele Bassi
bc05963b9c gsk: Port GskGLRenderer to GLES
Use the appropriate API and shaders if the GdkGLContext was created for
OpenGL ES instead of OpenGL.
2016-08-09 17:31:55 +01:00
Emmanuele Bassi
498f8852a1 gsk: Use surface-to-texture utility function
Now that we have it.
2016-08-09 17:31:55 +01:00
Emmanuele Bassi
f15cb77d1c gsk: Rename shaders for OpenGL 2016-08-09 17:31:55 +01:00
Emmanuele Bassi
979f059d62 gdk: Add utility for uploading Cairo surfaces to GL
The surface-to-GL upload logic has become more complicated with the
addition of the GLES code paths; it's more logical to have a public
utility function that can be called from GDK users, instead of copy
pasting the whole thing multiple times.
2016-08-09 17:31:55 +01:00
Emmanuele Bassi
c462f3ef2e build: Add GSK deps to GTK 2016-08-09 17:31:55 +01:00
Emmanuele Bassi
49a061ce20 Initial implementation of GSK rendering pipeline
GSK is conceptually split into two scene graphs:

 * a simple rendering tree of operations
 * a complex set of logical layers

The latter is built on the former, and adds convenience and high level
API for application developers.

The lower layer, though, is what gets transformed into the rendering
pipeline, as it's simple and thus can be transformed into appropriate
rendering commands with minimal state changes.

The lower layer is also suitable for reuse from more complex higher
layers, like the CSS machinery in GTK, without necessarily port those
layers to the GSK high level API.

This lower layer is based on GskRenderNode instances, which represent
the tree of rendering operations; and a GskRenderer instance, which
takes the render nodes and submits them (after potentially reordering
and transforming them to a more appropriate representation) to the
underlying graphic system.
2016-08-09 17:31:55 +01:00
Emmanuele Bassi
ebc6509421 gsk: Initial commit / build environment 2016-08-09 17:31:55 +01:00
Emmanuele Bassi
da2e612fa8 git.mk: Add config.rpath to the list of ignored files
This finally cleans up the `git status` output.
2016-08-09 17:21:04 +01:00
Emmanuele Bassi
2d2f8e3fa3 Remove config.rpath from EXTRA_DIST
The config.rpath script was added by running gettextize, but it's not
really needed, as config.rpath is generated by autotools and it's
included in the dist tarball automatically.

Upstream gettextize has been fixed so it does not happen any more:
http://savannah.gnu.org/bugs/index.php?48729
2016-08-09 17:19:48 +01:00
Marek Černocký
0be9adc5a3 Updated Czech translation 2016-08-09 12:19:03 +02:00
Dušan Kazik
1c9154b291 Updated Slovak translation 2016-08-08 07:38:30 +00:00
Matthias Clasen
a12ee84ec3 wayland: Link against librt
This is required for shm_open.

https://bugzilla.gnome.org/show_bug.cgi?id=769603
2016-08-07 16:11:55 -04:00
Matthias Clasen
5fefc7a714 headerbar: Fix size allocation
The GtkHeaderBar gadget implementation was subtly broken: it called
gtk_widget_set_allocation both in gtk_header_bar_size_allocate (with
the actual allocation) and in gtk_header_bar_allocate_contents (with
the content allocation of the main gadget). Dropping the second call
fixes the render node conversion for GtkHeaderBar.
2016-08-07 15:08:44 -04:00
Yosef Or Boczko
cb3fc956c5 Updated Hebrew translation 2016-08-07 16:05:42 +03:00
Yosef Or Boczko
6a2cba08c9 Updated Hebrew translation 2016-08-07 15:56:25 +03:00
Philip Withnall
7b40fdbc21 gdkwindow: Fix potential NULL pointer dereferences in event code
The event code could potentially dereference pointer_info if the
invariant that ENTER_NOTIFY and LEAVE_NOTIFY events are only emitted on
devices which have pointers is violated elsewhere.

Found with scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=712760
2016-08-07 08:17:50 +01:00
Philip Withnall
76721e736e gtkicontheme: Don’t emit warning about fallback theme when in unit tests
In order to eliminate g_test_expect_message() (which doesn’t work with
G_LOG_USE_STRUCTURED), make the warning about the fallback theme not
existing be conditional on the icon theme search path containing a
system path. Any application code which modifies the search path does so
through appends and prepends, so this should not affect whether the
warning is emitted in production.

https://bugzilla.gnome.org/show_bug.cgi?id=769485
2016-08-06 17:13:25 -04:00
Matthias Clasen
1306f780ab tests: Avoid g_test_expect_message
Instead of using g_test_expect_message, just ignore the warning.
2016-08-06 17:13:25 -04:00
Colomban Wendling
64521345b9 GtkMenuButton: use :toggled instead of :clicked
:toggled is triggered on :clicked, so using :toggled lead to the menu
to be popped up at the same time, while allowing to use the toggle state
and avoiding any need to a hack to prevent recursion, which somehow
wasn't enough for double emission of GtkMenuToolButton:show-popup.

https://bugzilla.gnome.org/show_bug.cgi?id=769287
2016-08-04 23:31:42 +02:00
Piotr Drąg
41be1e7e1f Updated Polish translation 2016-08-04 21:09:57 +02:00
Timm Bäder
2f9b22243a csslookup: Remove useless cast
The style passed to _gtk_css_lookup_resolve is already a
GtkCssStaticStyle.
2016-08-04 20:40:34 +02:00
Bernd Homuth
be2e0e0baf Updated German translation
(cherry picked from commit 070c4f7486)
2016-08-04 18:38:21 +00:00
Руслан Ижбулатов
5e6c1928b4 W32: Prefer the deadkey combinations that the OS uses
Pick the W32 API for possible deadkey+<something> combinations
and prefer these to other sources of deadkey combos.
Specifically, if W32 API supports at least one combo for a particular
deadkey, only use that data and do not attempt to do other, unsupported
combinations, even if they make sense otherwise.
This is needed to, for example, correctly support US-International
keyboard layout, which produces a combined character for <' + a>
combo, but not for <' + s>, for example.

This is achieved by stashing all the deadkeys that we find in
an array, then doing extra loop through all virtual key codes and
trying to combine them with each of these deadkeys. Any combinations
that produce a single character are cached for later use.

In GTK Simple IM context, call a new GDK W32 function to do a lookup
on that cached combination table early on, among the "special cases"
(which are now partially obsolete).

A limitation of this code is that combinations with more than
one deadkey are not supported, except for combinations that consist
entirely of 2 known deadkeys. The upshot is that lookups should
be relatively fast, as deadkey array stays small and the combination
tree stays shallow.

Note that the use of ToUnicodeEx() seems suboptimal, as it should
be possible to just load a keyboard library (KBD*.DLL) manually
and obtain and use its key table directly. However, that is much more
complicated and would result in a significant rewrite of gdkkeys-win32.
The code from this commit, though hacky, is a direct addition to
existing code and should cover vast majority of the use-cases.

https://bugzilla.gnome.org/show_bug.cgi?id=569581
2016-08-04 16:37:19 +00:00
Руслан Ижбулатов
52c7e07948 GDK W32: Cache multiple keyboard layouts simultaneously
This changes the group/level semantic.
Previously W32 backend used "group 0/1" to denote "AltGr OFF/ON"
and "level 0/1" to denote "Shift is OFF/ON".
Now "group" means "keyboard layout" and there can be up to 255 groups,
while AltGr and Shift are combined into a single level enum that
takes values between 0 and 4.
Unlike X, W32 doesn't do effective group overriding, meaning that
it will never tell the caller that a different group was actually
used (even for universal keys, such as Enter), because key symbol
table is completely fabricated and there's no point in trying to
save a few of kilobytes of RAM by not duplicating universal key
records for all groups.

Also contains many whitespace changes (tab elimination, fixed
indentation) and cleanup (axed a few global variables, these are
now accessed via the default keymap).

https://bugzilla.gnome.org/show_bug.cgi?id=768722
2016-08-04 16:37:18 +00:00
Timm Bäder
60f3c02080 shortcutlabel: Make parameter names match 2016-08-04 13:33:07 +02:00
Timm Bäder
50a0c5f242 widget: remove some unneeded function prototypes 2016-08-04 13:09:08 +02:00