Commit Graph

54214 Commits

Author SHA1 Message Date
Benjamin Otte
8dde331bbc build: Make GStreamer backend the default
Instead of compiling without media backend by default, we now use the
GStreamer backend.

This means that CI now requires gstreamer support.
2018-03-18 05:29:16 +01:00
Benjamin Otte
08bf8a60e8 THIS IS EVIL DEMO CODE, DO NOT LOOK AT IT.
Just register a video as paint source so we can play with it whenever
the images demo opens.

Probably needs a better demo.
2018-03-18 05:29:16 +01:00
Benjamin Otte
50373a91a2 css: Add initial support for Houdini-style paint() images
This adds gtk_style_context_add_paint_for_display() which allows to add
a GdkPaintable with a name to the CSS machinery and then allows using it
via "-gtk-paint(name)" inside the CSS as an image.

This essentially allows applications to register snapshot functions for
any part of the CSS machinery that is an image.
I have no idea if this is a good idea, because it further blurs the
lines between theme and application, but it *is* quite powerful.

The inspiration was
https://drafts.css-houdini.org/css-paint-api/
Though we do not support properties or a constructor, but so far require
the constructed image directly.
2018-03-18 05:29:16 +01:00
Benjamin Otte
3797b7e998 gtk-demo: Add a simple video player example
For now, it's impossible to unfullscreen. Somebody should figure out a
way to do this.
2018-03-18 05:29:16 +01:00
Benjamin Otte
01158f4438 gtk: Add a GStreamer implementation to GtkMediaFile 2018-03-18 05:29:14 +01:00
Benjamin Otte
22e729877f build: Add gstreamer dependency 2018-03-18 05:19:59 +01:00
Benjamin Otte
b9b84b3644 demos: Round up the paintable demos with a media stream 2018-03-18 05:19:59 +01:00
Benjamin Otte
433c71435a demos: Add an animated paintable demo
This builds on the paintable demo.
2018-03-18 05:19:59 +01:00
Benjamin Otte
4fc1ea9d12 gtk-demo: Add paintable demo 2018-03-18 05:19:59 +01:00
Benjamin Otte
074c829736 demos: Add a video benchmark to widgetbowl demo 2018-03-18 05:19:59 +01:00
Benjamin Otte
2a8d7f8d6a gtk-demo: Add a video example (with controls) to the images demo 2018-03-18 05:19:59 +01:00
Benjamin Otte
7e22264918 gtk: Add GtkVideo
GtkVideo is a simple video player widget. It probably needs some more
configurability, but it does its job.
2018-03-18 05:19:59 +01:00
Benjamin Otte
98bfd8eca0 gtk: Add GtkMediaControls
This is a basic first implementation of controls for a GtkMediaStream,
modeled after Totem's UI.
2018-03-18 05:19:59 +01:00
Benjamin Otte
ffe4b66699 gtk: Add ffmpeg implementation of GtkMediaFile
This adds a module using ffmpeg to implement the GtkMediaFile interface.
2018-03-18 05:19:59 +01:00
Benjamin Otte
a09667d4b9 build: Add ffmpeg requirement
This adds an ffmpeg build option for a potential media stream
implementation.
2018-03-18 05:19:59 +01:00
Matthias Clasen
bd25c4110c mediafile: Turn into an extension point
This way, we can support external libraries providing implementations of
GtkMediaFile.

We also add a media backend called 'nomedia' that can be enabled to not
compile any support for GtkMediaFile. This is useful when people want to
statically compile GTK into an application that does not use media.
For now, this option is the default.

We also support a new environment variable GTK_MEDIA that allows
selecting the implementation to use.
GTK_MEDIA=help can be used to get info about the available
implementations.
2018-03-18 05:19:59 +01:00
Benjamin Otte
427bce6c54 gtk: Add GtkMediaFile
GtkMediaFile is an implementation of GtkMediaStream to play back files.

Except it isn't an implementation yet, but only an interface.
2018-03-18 05:19:58 +01:00
Benjamin Otte
939e466eb4 gtk: Add GtkMediaStream
GtkMediaStream is the new base class for playback of audio and video
streams.

It implements GdkPaintable for rendering.
2018-03-18 05:19:58 +01:00
Benjamin Otte
10e1520162 texture: Expose subclasses as subclasses
This is necessary so that bidnings work properly and don't make
gdk_gl_texture_release() a function on GdkTexture.
It also allows code to identify what type of texture they are dealing
with.

Finally, we can now decide to add getters later without screwing
anything up, if we want to allow people to access GL textures directly.
2018-03-18 05:19:58 +01:00
Benjamin Otte
4bef77abd5 gdk: Add GDK_MEMORY_DEFAULT
This is the default memory format.

I added it because it is way better than including a private header and
using GDK_MEMORY_CAIRO_FORMAT_ARGB32.
2018-03-18 05:19:58 +01:00
Benjamin Otte
e30ba1dced gdk: Remove gdk_texture_new_from_data()
Use gdk_memory_texture_new() instead.
2018-03-18 05:19:58 +01:00
Daniel Boles
146082d464 Notebook: Don’t show raw underline/markup in popup
If @menu_label == NULL, we create a default page->menu_label. This took
@tab_label.get_label() and passed that to page->menu_label.set_text().
This is wrong because we set the plain text of the menu_label from the
rich text of @tab_label. So, if @tab_label used mnemonics or markup, our
menu_label got the raw underline or markup tags shown in it as raw text.

As we call set_text() on the menu Label, the fix is to be symmetric: use
@tab_label’s get_text() as source, as that strips underlines and markup.

It’s not worth making the default Label ‘inherit’ :use-underline/markup;
that’s a slippery slope, and users wanting such things can just create a
fully fledged GtkLabel to pass as @menu_label to suppress the default.

https://bugzilla.gnome.org/show_bug.cgi?id=705509
2018-03-16 22:34:05 +00:00
Benjamin Otte
b64a403100 selection: Remove surface APIs 2018-03-16 06:04:45 +01:00
Benjamin Otte
12409ee075 cellrendererpixbuf: Store the texture in the iconhelper paintable
That's kinda weird but allows us to delete the texture case from
GtkIconHelper and GTK_IMAGE_TEXTURE from the GtkImageType enum.

And it doesn't cause any other problems because the cell renderer
can't deal with paintables - otherwise it would mirror GtkImage and have
a "paintable" property instead.
2018-03-16 06:04:45 +01:00
Benjamin Otte
cbe40f5f46 image: Remove gtk_image_set_texture()
gtk_image_get_paintable() is a perfect replacement, so use that one.
2018-03-16 06:04:45 +01:00
Benjamin Otte
2935ef8128 image: Add gtk_image_set_can_shrink()
Images with that value set will request a 0x0 minimum size and scale
down their contents.
2018-03-16 06:04:45 +01:00
Benjamin Otte
c6541853ab image: Add gtk_image_set_keep_aspect_ratio()
If set, the image will draw its contents while keeping their aspect
ratio. That means empty areas show up on the top/bottom or left/right.

Also move the special-case snapshotting code for icons to
GtkIconHelper. That's where it belongs.
2018-03-16 06:04:45 +01:00
Benjamin Otte
0a08c03885 iconhelper: Implement GdkPaintable
This only implements the vfuncs, but does not actually emit signals
yet.

It's also not useed for anything other than snapshot() so far, this
will come in later commits.
2018-03-16 06:04:45 +01:00
Benjamin Otte
af18796312 icontheme: Remove surface support
It's not used anymore.
2018-03-16 06:04:45 +01:00
Benjamin Otte
9e54c22c49 image: Don't handle surfaces anymore
Lots of special cases that are no longer needed because no code uses
surfaces.

Also remove the GdkCellRendererPixbuf:surface property.
2018-03-16 06:04:45 +01:00
Benjamin Otte
01f996447e tests: Port from surface to texture 2018-03-16 06:04:45 +01:00
Benjamin Otte
a8608618a9 dragsource: Replace gtk_drag_source_set_icon_surface()
... with gtk_drag_source_set_icon_paintable().
2018-03-16 06:04:45 +01:00
Benjamin Otte
1f4839d4c8 inspector: Use Textures for images in the property view 2018-03-16 06:04:44 +01:00
Benjamin Otte
3c7ee010f5 cellrendererpixbuf: Put pixbufs into textures
... instead of going via surfaces.

A side effect is that the pixbuf property is no longer readable because
we have no good way to get the pixbuf back out of the texture, but I
don't think this matters a lot.

If people want to read the pixbuf property, we need to add some code to
make that work.
2018-03-16 06:04:44 +01:00
Benjamin Otte
7844320f10 image: Load resources and files into textures
Instead of loading them into surfaces (which we want to get rid of), we
load into textures.
In fact, we introduce a new paintable subclass called a GtkScaler that
takes care of tracking scaling.

This also ideally gets rid of an extra conversion once renderers learn
to render textures directly.
2018-03-16 06:04:44 +01:00
Benjamin Otte
c9557c207f iconhelper: Handle texture scale again
We will need that in the next commits.
2018-03-16 06:04:44 +01:00
Benjamin Otte
2016f56176 iconhelper: Turn into a GObject 2018-03-16 06:04:44 +01:00
Benjamin Otte
3427639b08 iconhelper: Rework to allow resizing of paintables
GtkImage will now allow paintables to be rendered to the full image and
the image will be sized according to CSS rules for image sizing.
2018-03-16 06:04:44 +01:00
Benjamin Otte
3e50092869 iconhelper: Rename function
There are no more icon sizes, this is now the default size we render at.

This naming change is kinda relevant because of CSS terminology.
2018-03-16 06:04:44 +01:00
Benjamin Otte
536714a147 paintable: Add gdk_paintable_compute_concrete_size()
Do the CSS size computation routine. This will be used elsewhere soon.
2018-03-16 06:04:44 +01:00
Benjamin Otte
bcf1aa7cb2 tooltips: Make icon a paintable 2018-03-16 06:04:44 +01:00
Benjamin Otte
d1be2b29cf entry: Make icons a paintable 2018-03-16 06:04:44 +01:00
Benjamin Otte
89ee42db54 dnd: Make dnd icon API take a paintable
... instead of a texture.
2018-03-16 06:04:44 +01:00
Benjamin Otte
ccb6b8585c aboutdialog: Make logo a paintable
No reason to limit this to textures anymore.
2018-03-16 06:04:44 +01:00
Benjamin Otte
2b35332fd6 cssimage: Implement dynamicity for cross-fades 2018-03-16 06:04:44 +01:00
Benjamin Otte
7e39b12858 css: Implement dynamic values for array values
This makes animated background-images work.
2018-03-16 06:04:44 +01:00
Benjamin Otte
3faa7e04db cssimage: Add GtkCssImagePaintable
This type can hold any GdkPaintable.

Use it to replace GtkCssImageSurface, which used to hold a GdkTexture.
2018-03-16 06:04:44 +01:00
Benjamin Otte
4beeb6173b cssimage: Add gtk_css_image_is_invalid()
Use that instead of hacks to guess when an image is considered invalid
according to https://drafts.csswg.org/css-images-4/#invalid-image

Also add a GtkCssImageInvalid that implements the behavior of invalid
images according to the CSS spec so thjat image implementations can
refer to that image.
2018-03-16 06:04:44 +01:00
Benjamin Otte
5970dac167 build: Switch order of subdirectories
This makes demos be compiled/linked before tests. And that means that
while hacking, I can already run widget-factory when the tests are
still linking.
2018-03-16 06:04:44 +01:00
Benjamin Otte
9fa1e68151 image: Implement support for paintables
This includes adding support to GtkImageDefintion and GtkIconHelper.

Only GtkImage handles support for signals from the paintable.
2018-03-16 06:04:44 +01:00