Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f2e45bbc87 | |||
| 9965cfbc3b |
@@ -1,2 +1 @@
|
|||||||
/subprojects/*/
|
/subprojects/*/
|
||||||
.flatpak-builder/
|
|
||||||
|
|||||||
+1
-21
@@ -24,7 +24,7 @@ stages:
|
|||||||
variables:
|
variables:
|
||||||
COMMON_MESON_FLAGS: "-Dwerror=true -Dcairo:werror=false -Dgi-docgen:werror=false -Dgraphene:werror=false -Dlibepoxy:werror=false -Dlibsass:werror=false -Dpango:werror=false -Dsassc:werror=false -Dgdk-pixbuf:werror=false -Dglib:werror=false -Dlibcloudproviders:werror=false -Dlibpng:werror=false -Dlibtiff:werror=false -Dsysprof:werror=false -Dwayland-protocols:werror=false -Dharfbuzz:werror=false -Dfreetype2:werror=false -Dfontconfig:werror=false -Dfribidi:werror=false -Dlibffi:werror=false -Dlibjpeg-turbo:werror=false -Dmutest:werror=false -Dpixman:werror=false -Dproxy-libintl:werror=false"
|
COMMON_MESON_FLAGS: "-Dwerror=true -Dcairo:werror=false -Dgi-docgen:werror=false -Dgraphene:werror=false -Dlibepoxy:werror=false -Dlibsass:werror=false -Dpango:werror=false -Dsassc:werror=false -Dgdk-pixbuf:werror=false -Dglib:werror=false -Dlibcloudproviders:werror=false -Dlibpng:werror=false -Dlibtiff:werror=false -Dsysprof:werror=false -Dwayland-protocols:werror=false -Dharfbuzz:werror=false -Dfreetype2:werror=false -Dfontconfig:werror=false -Dfribidi:werror=false -Dlibffi:werror=false -Dlibjpeg-turbo:werror=false -Dmutest:werror=false -Dpixman:werror=false -Dproxy-libintl:werror=false"
|
||||||
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true"
|
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true"
|
||||||
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled -Dbuild-testsuite=true -Dintrospection=enabled"
|
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled -Dbuild-demos=false -Dbuild-examples=false -Dbuild-tests=false -Dbuild-testsuite=true"
|
||||||
MESON_TEST_TIMEOUT_MULTIPLIER: 3
|
MESON_TEST_TIMEOUT_MULTIPLIER: 3
|
||||||
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v46"
|
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v46"
|
||||||
|
|
||||||
@@ -123,26 +123,6 @@ release-build:
|
|||||||
- LD_LIBRARY_PATH=${CI_PROJECT_DIR}/_install/lib64 meson compile -C _build_hello
|
- LD_LIBRARY_PATH=${CI_PROJECT_DIR}/_install/lib64 meson compile -C _build_hello
|
||||||
- .gitlab-ci/run-tests.sh _build x11
|
- .gitlab-ci/run-tests.sh _build x11
|
||||||
|
|
||||||
fedora-clang:
|
|
||||||
extends: .build-fedora-default
|
|
||||||
stage: build
|
|
||||||
needs: []
|
|
||||||
variables:
|
|
||||||
EXTRA_MESON_FLAGS: "--buildtype=release"
|
|
||||||
script:
|
|
||||||
- .gitlab-ci/show-info-linux.sh
|
|
||||||
- export PATH="$HOME/.local/bin:$PATH"
|
|
||||||
- export CC=clang
|
|
||||||
- meson subprojects download
|
|
||||||
- meson subprojects update --reset
|
|
||||||
- meson setup
|
|
||||||
${COMMON_MESON_FLAGS}
|
|
||||||
${EXTRA_MESON_FLAGS}
|
|
||||||
${BACKEND_FLAGS}
|
|
||||||
${FEATURE_FLAGS}
|
|
||||||
_build
|
|
||||||
- meson compile -C _build
|
|
||||||
|
|
||||||
fedora-mingw64:
|
fedora-mingw64:
|
||||||
extends: .build-fedora-default
|
extends: .build-fedora-default
|
||||||
stage: build
|
stage: build
|
||||||
|
|||||||
@@ -1,56 +1,6 @@
|
|||||||
Overview of Changes in 4.11.3, xx-xx-xxxx
|
Overview of Changes in 4.11.3, xx-xx-xxxx
|
||||||
=========================================
|
=========================================
|
||||||
|
|
||||||
* GtkGridView:
|
|
||||||
- Respect css border-spacing
|
|
||||||
- Don't leak the factories
|
|
||||||
|
|
||||||
* GtkListView:
|
|
||||||
- Don't leak the factories
|
|
||||||
|
|
||||||
* GtkNotebook:
|
|
||||||
- Make the pages model implement GtkSelectionModel
|
|
||||||
|
|
||||||
* GtkScrolledWindow:
|
|
||||||
- Propagate child measure size whenever possible
|
|
||||||
|
|
||||||
* GtkPopoverMenu:
|
|
||||||
- Avoid unnecessary left padding
|
|
||||||
|
|
||||||
* Css:
|
|
||||||
- Add new binding-friendly css provider apis
|
|
||||||
|
|
||||||
* Theme:
|
|
||||||
- Show focus in the shortcuts window
|
|
||||||
|
|
||||||
* Tests:
|
|
||||||
- Improve test coverage
|
|
||||||
|
|
||||||
* Wayland:
|
|
||||||
- Make exporting surface handles more flexible
|
|
||||||
|
|
||||||
* Build:
|
|
||||||
- Some build options have been renamed:
|
|
||||||
demos -> build-demos
|
|
||||||
profile -> demo-profile
|
|
||||||
The old names still work
|
|
||||||
|
|
||||||
* Deprecations:
|
|
||||||
- gtk_css_provider_load_from_data
|
|
||||||
- gdk_wayland_toplevel_unexport_handle
|
|
||||||
- gdk_pixbuf_get_from_surface
|
|
||||||
- gdk_pixbuf_get_from_texture
|
|
||||||
- gtk_image_new_from_pixbuf
|
|
||||||
- gtk_image_set_from_pixbuf
|
|
||||||
- gtk_picture_new_for_pixbuf
|
|
||||||
- gtk_picture_set_pixbuf
|
|
||||||
|
|
||||||
* Translation updates:
|
|
||||||
Basque
|
|
||||||
Catalan
|
|
||||||
Russian
|
|
||||||
|
|
||||||
|
|
||||||
Overview of Changes in 4.11.2, 09-05-2023
|
Overview of Changes in 4.11.2, 09-05-2023
|
||||||
=========================================
|
=========================================
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ update_image (void)
|
|||||||
cairo_t *cr;
|
cairo_t *cr;
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
GdkPixbuf *pixbuf2;
|
GdkPixbuf *pixbuf2;
|
||||||
GdkTexture *texture;
|
|
||||||
cairo_font_options_t *fopt;
|
cairo_font_options_t *fopt;
|
||||||
cairo_hint_style_t hintstyle;
|
cairo_hint_style_t hintstyle;
|
||||||
cairo_hint_metrics_t hintmetrics;
|
cairo_hint_metrics_t hintmetrics;
|
||||||
@@ -121,17 +120,8 @@ update_image (void)
|
|||||||
cairo_destroy (cr);
|
cairo_destroy (cr);
|
||||||
g_object_unref (layout);
|
g_object_unref (layout);
|
||||||
|
|
||||||
pixbuf = gdk_pixbuf_new_from_data (cairo_image_surface_get_data (surface),
|
pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, cairo_image_surface_get_width (surface), cairo_image_surface_get_height (surface));
|
||||||
GDK_COLORSPACE_RGB, TRUE, 8,
|
pixbuf2 = gdk_pixbuf_scale_simple (pixbuf, gdk_pixbuf_get_width (pixbuf) * scale, gdk_pixbuf_get_height (pixbuf) * scale, GDK_INTERP_NEAREST);
|
||||||
cairo_image_surface_get_width (surface),
|
|
||||||
cairo_image_surface_get_height (surface),
|
|
||||||
cairo_image_surface_get_stride (surface),
|
|
||||||
NULL, NULL);
|
|
||||||
|
|
||||||
pixbuf2 = gdk_pixbuf_scale_simple (pixbuf,
|
|
||||||
gdk_pixbuf_get_width (pixbuf) * scale,
|
|
||||||
gdk_pixbuf_get_height (pixbuf) * scale,
|
|
||||||
GDK_INTERP_NEAREST);
|
|
||||||
|
|
||||||
g_object_unref (pixbuf);
|
g_object_unref (pixbuf);
|
||||||
cairo_surface_destroy (surface);
|
cairo_surface_destroy (surface);
|
||||||
@@ -288,24 +278,14 @@ retry:
|
|||||||
pango_layout_iter_free (iter);
|
pango_layout_iter_free (iter);
|
||||||
g_object_unref (layout);
|
g_object_unref (layout);
|
||||||
|
|
||||||
pixbuf = gdk_pixbuf_new_from_data (cairo_image_surface_get_data (surface),
|
pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, cairo_image_surface_get_width (surface), cairo_image_surface_get_height (surface));
|
||||||
GDK_COLORSPACE_RGB, TRUE, 8,
|
pixbuf2 = gdk_pixbuf_scale_simple (pixbuf, gdk_pixbuf_get_width (pixbuf) * scale, gdk_pixbuf_get_height (pixbuf) * scale, GDK_INTERP_NEAREST);
|
||||||
cairo_image_surface_get_width (surface),
|
|
||||||
cairo_image_surface_get_height (surface),
|
|
||||||
cairo_image_surface_get_stride (surface),
|
|
||||||
NULL, NULL);
|
|
||||||
|
|
||||||
pixbuf2 = gdk_pixbuf_scale_simple (pixbuf,
|
|
||||||
gdk_pixbuf_get_width (pixbuf) * scale,
|
|
||||||
gdk_pixbuf_get_height (pixbuf) * scale,
|
|
||||||
GDK_INTERP_NEAREST);
|
|
||||||
g_object_unref (pixbuf);
|
g_object_unref (pixbuf);
|
||||||
cairo_surface_destroy (surface);
|
cairo_surface_destroy (surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
texture = gdk_texture_new_for_pixbuf (pixbuf2);
|
gtk_picture_set_pixbuf (GTK_PICTURE (image), pixbuf2);
|
||||||
gtk_picture_set_paintable (GTK_PICTURE (image), GDK_PAINTABLE (texture));
|
|
||||||
g_object_unref (pixbuf2);
|
|
||||||
g_object_unref (pixbuf2);
|
g_object_unref (pixbuf2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+11
-10
@@ -30,7 +30,6 @@ progressive_prepared_callback (GdkPixbufLoader *loader,
|
|||||||
{
|
{
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
GtkWidget *picture;
|
GtkWidget *picture;
|
||||||
GdkTexture *texture;
|
|
||||||
|
|
||||||
picture = GTK_WIDGET (data);
|
picture = GTK_WIDGET (data);
|
||||||
|
|
||||||
@@ -41,9 +40,7 @@ progressive_prepared_callback (GdkPixbufLoader *loader,
|
|||||||
*/
|
*/
|
||||||
gdk_pixbuf_fill (pixbuf, 0xaaaaaaff);
|
gdk_pixbuf_fill (pixbuf, 0xaaaaaaff);
|
||||||
|
|
||||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
gtk_picture_set_pixbuf (GTK_PICTURE (picture), pixbuf);
|
||||||
gtk_picture_set_paintable (GTK_PICTURE (picture), GDK_PAINTABLE (texture));
|
|
||||||
g_object_unref (texture);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -54,18 +51,22 @@ progressive_updated_callback (GdkPixbufLoader *loader,
|
|||||||
int height,
|
int height,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GtkWidget *picture = GTK_WIDGET (data);
|
GtkWidget *picture;
|
||||||
GdkTexture *texture;
|
GdkPixbuf *pixbuf;
|
||||||
|
|
||||||
texture = gdk_texture_new_for_pixbuf (gdk_pixbuf_loader_get_pixbuf (loader));
|
picture = GTK_WIDGET (data);
|
||||||
gtk_picture_set_paintable (GTK_PICTURE (picture), GDK_PAINTABLE (texture));
|
|
||||||
g_object_unref (texture);
|
pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
|
||||||
|
gtk_picture_set_pixbuf (GTK_PICTURE (picture), NULL);
|
||||||
|
gtk_picture_set_pixbuf (GTK_PICTURE (picture), pixbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
progressive_timeout (gpointer data)
|
progressive_timeout (gpointer data)
|
||||||
{
|
{
|
||||||
GtkWidget *picture = GTK_WIDGET (data);
|
GtkWidget *picture;
|
||||||
|
|
||||||
|
picture = GTK_WIDGET (data);
|
||||||
|
|
||||||
/* This shows off fully-paranoid error handling, so looks scary.
|
/* This shows off fully-paranoid error handling, so looks scary.
|
||||||
* You could factor out the error handling code into a nice separate
|
* You could factor out the error handling code into a nice separate
|
||||||
|
|||||||
@@ -1701,13 +1701,6 @@ node_editor_window_init (NodeEditorWindow *self)
|
|||||||
" }\n"
|
" }\n"
|
||||||
" transform: translate(0, 140);\n"
|
" transform: translate(0, 140);\n"
|
||||||
"}", -1);
|
"}", -1);
|
||||||
|
|
||||||
if (g_getenv ("GSK_RENDERER"))
|
|
||||||
{
|
|
||||||
char *new_title = g_strdup_printf ("GTK Node Editor - %s", g_getenv ("GSK_RENDERER"));
|
|
||||||
gtk_window_set_title (GTK_WINDOW (self), new_title);
|
|
||||||
g_free (new_title);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeEditorWindow *
|
NodeEditorWindow *
|
||||||
|
|||||||
@@ -1210,12 +1210,12 @@ typedef struct {
|
|||||||
static void
|
static void
|
||||||
add_background (GtkWidget *flowbox,
|
add_background (GtkWidget *flowbox,
|
||||||
const char *filename,
|
const char *filename,
|
||||||
GdkTexture *texture,
|
GdkPixbuf *pixbuf,
|
||||||
gboolean is_resource)
|
gboolean is_resource)
|
||||||
{
|
{
|
||||||
GtkWidget *child;
|
GtkWidget *child;
|
||||||
|
|
||||||
child = gtk_picture_new_for_paintable (GDK_PAINTABLE (texture));
|
child = gtk_picture_new_for_pixbuf (pixbuf);
|
||||||
gtk_widget_set_size_request (child, 110, 70);
|
gtk_widget_set_size_request (child, 110, 70);
|
||||||
gtk_flow_box_insert (GTK_FLOW_BOX (flowbox), child, -1);
|
gtk_flow_box_insert (GTK_FLOW_BOX (flowbox), child, -1);
|
||||||
child = gtk_widget_get_parent (child);
|
child = gtk_widget_get_parent (child);
|
||||||
@@ -1231,7 +1231,6 @@ background_loaded_cb (GObject *source,
|
|||||||
{
|
{
|
||||||
BackgroundData *bd = data;
|
BackgroundData *bd = data;
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
GdkTexture *texture;
|
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
pixbuf = gdk_pixbuf_new_from_stream_finish (res, &error);
|
pixbuf = gdk_pixbuf_new_from_stream_finish (res, &error);
|
||||||
@@ -1242,11 +1241,8 @@ background_loaded_cb (GObject *source,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
add_background (bd->flowbox, bd->filename, pixbuf, FALSE);
|
||||||
add_background (bd->flowbox, bd->filename, texture, FALSE);
|
|
||||||
|
|
||||||
g_object_unref (texture);
|
|
||||||
g_object_unref (pixbuf);
|
|
||||||
g_free (bd->filename);
|
g_free (bd->filename);
|
||||||
g_free (bd);
|
g_free (bd);
|
||||||
}
|
}
|
||||||
@@ -1263,10 +1259,7 @@ populate_flowbox (GtkWidget *flowbox)
|
|||||||
GInputStream *stream;
|
GInputStream *stream;
|
||||||
BackgroundData *bd;
|
BackgroundData *bd;
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
GdkTexture *texture;
|
|
||||||
GtkWidget *child;
|
GtkWidget *child;
|
||||||
guchar *data;
|
|
||||||
GBytes *bytes;
|
|
||||||
int i;
|
int i;
|
||||||
const char *resources[] = {
|
const char *resources[] = {
|
||||||
"sunset.jpg", "portland-rose.jpg", "beach.jpg", "nyc.jpg"
|
"sunset.jpg", "portland-rose.jpg", "beach.jpg", "nyc.jpg"
|
||||||
@@ -1277,14 +1270,9 @@ populate_flowbox (GtkWidget *flowbox)
|
|||||||
|
|
||||||
g_object_set_data (G_OBJECT (flowbox), "populated", GUINT_TO_POINTER (1));
|
g_object_set_data (G_OBJECT (flowbox), "populated", GUINT_TO_POINTER (1));
|
||||||
|
|
||||||
data = g_malloc (4 * 110 * 70);
|
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, 110, 70);
|
||||||
memset (data, 0xff, 4 * 110 * 70);
|
gdk_pixbuf_fill (pixbuf, 0xffffffff);
|
||||||
bytes = g_bytes_new_take (data, 4 * 110 * 70);
|
child = gtk_picture_new_for_pixbuf (pixbuf);
|
||||||
texture = gdk_memory_texture_new (110, 70, GDK_MEMORY_DEFAULT, bytes, 4 * 110);
|
|
||||||
child = gtk_picture_new_for_paintable (GDK_PAINTABLE (texture));
|
|
||||||
g_object_unref (texture);
|
|
||||||
g_bytes_unref (bytes);
|
|
||||||
|
|
||||||
gtk_widget_add_css_class (child, "frame");
|
gtk_widget_add_css_class (child, "frame");
|
||||||
gtk_flow_box_insert (GTK_FLOW_BOX (flowbox), child, -1);
|
gtk_flow_box_insert (GTK_FLOW_BOX (flowbox), child, -1);
|
||||||
|
|
||||||
@@ -1292,10 +1280,7 @@ populate_flowbox (GtkWidget *flowbox)
|
|||||||
{
|
{
|
||||||
filename = g_strconcat ("/org/gtk/WidgetFactory4/", resources[i], NULL);
|
filename = g_strconcat ("/org/gtk/WidgetFactory4/", resources[i], NULL);
|
||||||
pixbuf = gdk_pixbuf_new_from_resource_at_scale (filename, 110, 110, TRUE, NULL);
|
pixbuf = gdk_pixbuf_new_from_resource_at_scale (filename, 110, 110, TRUE, NULL);
|
||||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
add_background (flowbox, filename, pixbuf, TRUE);
|
||||||
add_background (flowbox, filename, texture, TRUE);
|
|
||||||
g_object_unref (texture);
|
|
||||||
g_object_unref (pixbuf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
location = "/usr/share/backgrounds/gnome";
|
location = "/usr/share/backgrounds/gnome";
|
||||||
|
|||||||
@@ -2244,24 +2244,20 @@ microphone-sensitivity-medium-symbolic</property>
|
|||||||
<child>
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkBox">
|
||||||
<property name="spacing">6</property>
|
<property name="spacing">6</property>
|
||||||
<property name="valign">center</property>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox" id="lockbox">
|
<object class="GtkBox" id="lockbox">
|
||||||
<property name="hexpand">1</property>
|
<property name="hexpand">1</property>
|
||||||
<property name="spacing">6</property>
|
<property name="spacing">6</property>
|
||||||
<property name="valign">center</property>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkMenuButton" id="open_menubutton">
|
<object class="GtkMenuButton" id="open_menubutton">
|
||||||
<property name="halign">3</property>
|
<property name="halign">3</property>
|
||||||
<property name="popover">open_popover</property>
|
<property name="popover">open_popover</property>
|
||||||
<property name="label">Open</property>
|
<property name="label">Open</property>
|
||||||
<property name="valign">center</property>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkToggleButton" id="record_button">
|
<object class="GtkToggleButton" id="record_button">
|
||||||
<property name="halign">3</property>
|
<property name="halign">3</property>
|
||||||
<property name="valign">center</property>
|
|
||||||
<signal name="toggled" handler="on_record_button_toggled"/>
|
<signal name="toggled" handler="on_record_button_toggled"/>
|
||||||
<style>
|
<style>
|
||||||
<class name="text-button"/>
|
<class name="text-button"/>
|
||||||
@@ -2271,19 +2267,16 @@ microphone-sensitivity-medium-symbolic</property>
|
|||||||
<child>
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkBox">
|
||||||
<property name="spacing">6</property>
|
<property name="spacing">6</property>
|
||||||
<property name="valign">center</property>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkImage">
|
<object class="GtkImage">
|
||||||
<property name="valign">4</property>
|
<property name="valign">4</property>
|
||||||
<property name="icon-name">media-record-symbolic</property>
|
<property name="icon-name">media-record-symbolic</property>
|
||||||
<property name="valign">center</property>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel">
|
<object class="GtkLabel">
|
||||||
<property name="valign">4</property>
|
<property name="valign">4</property>
|
||||||
<property name="label">Record</property>
|
<property name="label">Record</property>
|
||||||
<property name="valign">center</property>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
@@ -2292,7 +2285,6 @@ microphone-sensitivity-medium-symbolic</property>
|
|||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkBox">
|
||||||
<property name="valign">center</property>
|
|
||||||
<style>
|
<style>
|
||||||
<class name="linked"/>
|
<class name="linked"/>
|
||||||
</style>
|
</style>
|
||||||
@@ -2300,14 +2292,12 @@ microphone-sensitivity-medium-symbolic</property>
|
|||||||
<object class="GtkToggleButton" id="grid_button">
|
<object class="GtkToggleButton" id="grid_button">
|
||||||
<property name="active">1</property>
|
<property name="active">1</property>
|
||||||
<property name="icon-name">view-grid-symbolic</property>
|
<property name="icon-name">view-grid-symbolic</property>
|
||||||
<property name="valign">center</property>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkToggleButton" id="list_button">
|
<object class="GtkToggleButton" id="list_button">
|
||||||
<property name="group">grid_button</property>
|
<property name="group">grid_button</property>
|
||||||
<property name="icon-name">view-list-symbolic</property>
|
<property name="icon-name">view-list-symbolic</property>
|
||||||
<property name="valign">center</property>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
@@ -2315,7 +2305,6 @@ microphone-sensitivity-medium-symbolic</property>
|
|||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="circular_button">
|
<object class="GtkButton" id="circular_button">
|
||||||
<property name="icon-name">emblem-system-symbolic</property>
|
<property name="icon-name">emblem-system-symbolic</property>
|
||||||
<property name="valign">center</property>
|
|
||||||
<style>
|
<style>
|
||||||
<class name="circular"/>
|
<class name="circular"/>
|
||||||
</style>
|
</style>
|
||||||
@@ -2324,15 +2313,12 @@ microphone-sensitivity-medium-symbolic</property>
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLockButton" id="lockbutton">
|
<object class="GtkLockButton" id="lockbutton"/>
|
||||||
<property name="valign">center</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkMenuButton">
|
<object class="GtkMenuButton">
|
||||||
<property name="icon-name">view-more-symbolic</property>
|
<property name="icon-name">view-more-symbolic</property>
|
||||||
<property name="menu-model">new_style_menu_model</property>
|
<property name="menu-model">new_style_menu_model</property>
|
||||||
<property name="valign">center</property>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
|||||||
@@ -220,6 +220,6 @@ clipboard.cut, clipboard.copy, clipboard.paste
|
|||||||
selection.delete, selection.select-all
|
selection.delete, selection.select-all
|
||||||
: Selection operations on entries, text view and labels
|
: Selection operations on entries, text view and labels
|
||||||
|
|
||||||
color.select, color.customize
|
color.select, color.customize:
|
||||||
: Operate on colors in a `GtkColorChooserWidget`. These actions are
|
: Operate on colors in a `GtkColorChooserWidget`. These actions are
|
||||||
unusual in that they have the non-trivial parameter type (dddd).
|
unusual in that they have the non-trivial parameter type (dddd):
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ in a selector, widget names must be prefixed with a # character.
|
|||||||
| E:focus-within | [CSS Selector Level 4](https://drafts.csswg.org/selectors/#focus-within-pseudo) | Set on all ancestors of the focus widget, unlike CSS |
|
| E:focus-within | [CSS Selector Level 4](https://drafts.csswg.org/selectors/#focus-within-pseudo) | Set on all ancestors of the focus widget, unlike CSS |
|
||||||
| E:focus-visible | [CSS Selector Level 4](https://drafts.csswg.org/selectors/#focus-within-pseudo) | Set on focus widget and all ancestors, unlike CSS |
|
| E:focus-visible | [CSS Selector Level 4](https://drafts.csswg.org/selectors/#focus-within-pseudo) | Set on focus widget and all ancestors, unlike CSS |
|
||||||
| E:disabled | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#UIstates) | Corresponds to GTK_STATE_FLAG_INSENSITIVE |
|
| E:disabled | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#UIstates) | Corresponds to GTK_STATE_FLAG_INSENSITIVE |
|
||||||
| E:checked | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#UIstates) | Corresponds to GTK_STATE_FLAG_CHECKED |
|
| E:disabled | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#UIstates) | Corresponds to GTK_STATE_FLAG_CHECKED |
|
||||||
| E:indeterminate | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#indeterminate) | Corresponds to GTK_STATE_FLAG_INCONSISTENT |
|
| E:indeterminate | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#indeterminate) | Corresponds to GTK_STATE_FLAG_INCONSISTENT |
|
||||||
| E:backdrop, E:selected | | Corresponds to GTK_STATE_FLAG_BACKDROP, GTK_STATE_FLAG_SELECTED |
|
| E:backdrop, E:selected | | Corresponds to GTK_STATE_FLAG_BACKDROP, GTK_STATE_FLAG_SELECTED |
|
||||||
| E:not(selector) | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#negation) | |
|
| E:not(selector) | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#negation) | |
|
||||||
|
|||||||
@@ -103,15 +103,14 @@ fields, but e.g. buttons can take the focus too.
|
|||||||
|
|
||||||
Input widgets can be given the focus by clicking on them, but focus
|
Input widgets can be given the focus by clicking on them, but focus
|
||||||
can also be moved around with certain key events (this is known as
|
can also be moved around with certain key events (this is known as
|
||||||
“keyboard navigation”).
|
“keyboard navigation”). GTK reserves the <kbd>Tab</kbd> key to move the focus
|
||||||
GTK reserves the <kbd>Tab</kbd> key to move the focus to the next location,
|
to the next location, and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move it back to the previous
|
||||||
and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move it back to the previous one.
|
one. In addition many containers allow “directional navigation” with
|
||||||
In addition many containers allow “directional navigation” with the arrow keys.
|
the arrow keys.
|
||||||
|
|
||||||
Many widgets can be “activated” to trigger and action.
|
Many widgets can be “activated” to trigger and action. E.g., you can
|
||||||
E.g., you can activate a button or switch by clicking on them,
|
activate a button or switch by clicking on them, but you can also
|
||||||
but you can also activate them with the keyboard,
|
activate them with the keyboard, by using the <kbd>Enter</kbd> or <kbd>␣</kbd> keys.
|
||||||
by using the <kbd>Enter</kbd> or <kbd>Space</kbd> keys.
|
|
||||||
|
|
||||||
Apart from keyboard navigation, activation and directly typing into
|
Apart from keyboard navigation, activation and directly typing into
|
||||||
entries or text views, GTK widgets can use key events for activating
|
entries or text views, GTK widgets can use key events for activating
|
||||||
@@ -122,17 +121,15 @@ GTK has traditionally supported different kinds of shortcuts:
|
|||||||
|
|
||||||
- Accelerators are any other shortcuts that can be activated regardless
|
- Accelerators are any other shortcuts that can be activated regardless
|
||||||
of where the focus is, and typically trigger global actions, such as
|
of where the focus is, and typically trigger global actions, such as
|
||||||
<kbd>Ctrl</kbd>+<kbd>Q</kbd> to quit an application.
|
Ctrl-Q to quit an application.
|
||||||
- Mnemonics are usually triggered using <kbd>Alt</kbd>
|
- Mnemonics are usually triggered using Alt as a modifier for a letter.
|
||||||
as a modifier for a letter.
|
|
||||||
They are used in places where a label is associated with a control,
|
They are used in places where a label is associated with a control,
|
||||||
and are indicated by underlining the letter in the label. As a special
|
and are indicated by underlining the letter in the label. As a special
|
||||||
case, inside menus (i.e. inside `GtkPopoverMenu`), mnemonics can be
|
case, inside menus (i.e. inside `GtkPopoverMenu`), mnemonics can be
|
||||||
triggered without the modifier.
|
triggered without the modifier.
|
||||||
- Key bindings are specific to individual widgets,
|
- Key bindings are specific to individual widgets, such as Ctrl-C or
|
||||||
such as <kbd>Ctrl</kbd>+<kbd>C</kbd> or <kbd>Ctrl</kbd>+<kbd>V</kbd>
|
Ctrl-V in an entry copy to or paste from the clipboard. They are only
|
||||||
in an entry copy to or paste from the clipboard.
|
triggered when the widget has focus.
|
||||||
They are only triggered when the widget has focus.
|
|
||||||
|
|
||||||
GTK handles accelerators and mnemonics in a global scope, during the
|
GTK handles accelerators and mnemonics in a global scope, during the
|
||||||
capture phase, and key bindings locally, during the target phase.
|
capture phase, and key bindings locally, during the target phase.
|
||||||
@@ -211,4 +208,4 @@ sequence, so setting the state on one does transfer the state to
|
|||||||
the others. They also are mutually exclusive, within a widget
|
the others. They also are mutually exclusive, within a widget
|
||||||
where may be only one gesture group claiming a given sequence.
|
where may be only one gesture group claiming a given sequence.
|
||||||
If another gesture group claims later that same sequence, the
|
If another gesture group claims later that same sequence, the
|
||||||
first group will deny the sequence.
|
first group will deny the sequence:
|
||||||
|
|||||||
@@ -133,9 +133,3 @@ The function gtk_widget_get_allocation() is also going away. It does not have a
|
|||||||
replacement, but the previously mentioned alternatives can be used for it too.
|
replacement, but the previously mentioned alternatives can be used for it too.
|
||||||
|
|
||||||
The function gtk_widget_get_allocated_baseline() has been renamed to [method@Gtk.Widget.get_baseline].
|
The function gtk_widget_get_allocated_baseline() has been renamed to [method@Gtk.Widget.get_baseline].
|
||||||
|
|
||||||
## Stop using GdkPixbuf
|
|
||||||
|
|
||||||
GTK is moving away from GdkPixbuf as the primary API for transporting image data, in favor
|
|
||||||
of GdkTexture. APIs that are accepting or returning GdkPixbufs are being replaced by equivalent
|
|
||||||
APIs using GdkTexture or GdkPaintable objects.
|
|
||||||
|
|||||||
@@ -196,15 +196,6 @@ The _data table_ style of list is a high density table, similar in style to a
|
|||||||
traditional treeview. Individual cells can be selectable and editable. Use
|
traditional treeview. Individual cells can be selectable and editable. Use
|
||||||
the `.data-table` style class.
|
the `.data-table` style class.
|
||||||
|
|
||||||
## Sections
|
|
||||||
|
|
||||||
List models can optionally group their items into **_sections_**, by implementing
|
|
||||||
the `GtkSectionModel` interface. Both `GtkListView` and `GtkGridView` can
|
|
||||||
display headers for sections, by installing a separate **_header factory_**.
|
|
||||||
|
|
||||||
Many GTK list models support section inherently, or they pass through the
|
|
||||||
section of a model they are wrapping.
|
|
||||||
|
|
||||||
## Comparison to GtkTreeView
|
## Comparison to GtkTreeView
|
||||||
|
|
||||||
Developers familiar with `GtkTreeView` may wonder how this way of doing lists
|
Developers familiar with `GtkTreeView` may wonder how this way of doing lists
|
||||||
|
|||||||
+2
-2
@@ -57,7 +57,7 @@ window_paste (GSimpleAction *action,
|
|||||||
{
|
{
|
||||||
GtkWindow *window = GTK_WINDOW (user_data);
|
GtkWindow *window = GTK_WINDOW (user_data);
|
||||||
GtkTextView *text = g_object_get_data ((GObject*)window, "plugman-text");
|
GtkTextView *text = g_object_get_data ((GObject*)window, "plugman-text");
|
||||||
|
|
||||||
gtk_text_buffer_paste_clipboard (gtk_text_view_get_buffer (text),
|
gtk_text_buffer_paste_clipboard (gtk_text_view_get_buffer (text),
|
||||||
gtk_widget_get_clipboard (GTK_WIDGET (text)),
|
gtk_widget_get_clipboard (GTK_WIDGET (text)),
|
||||||
NULL,
|
NULL,
|
||||||
@@ -221,7 +221,7 @@ plugin_action (GAction *action,
|
|||||||
g_message ("Color: %s", g_action_get_name (action));
|
g_message ("Color: %s", g_action_get_name (action));
|
||||||
|
|
||||||
css_provider = gtk_css_provider_new ();
|
css_provider = gtk_css_provider_new ();
|
||||||
gtk_css_provider_load_from_string (css_provider, css_to_load);
|
gtk_css_provider_load_from_data (css_provider, css_to_load, -1);
|
||||||
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
|
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
|
||||||
GTK_STYLE_PROVIDER (css_provider),
|
GTK_STYLE_PROVIDER (css_provider),
|
||||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
gdk_deprecated_sources = files([
|
|
||||||
'gdkpixbuf.c',
|
|
||||||
])
|
|
||||||
|
|
||||||
gdk_deprecated_headers = files([
|
|
||||||
'gdkpixbuf.h',
|
|
||||||
])
|
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
#include <gdk/gdkmonitor.h>
|
#include <gdk/gdkmonitor.h>
|
||||||
#include <gdk/gdkpaintable.h>
|
#include <gdk/gdkpaintable.h>
|
||||||
#include <gdk/gdkpango.h>
|
#include <gdk/gdkpango.h>
|
||||||
#include <gdk/deprecated/gdkpixbuf.h>
|
#include <gdk/gdkpixbuf.h>
|
||||||
#include <gdk/gdkpopup.h>
|
#include <gdk/gdkpopup.h>
|
||||||
#include <gdk/gdkpopuplayout.h>
|
#include <gdk/gdkpopuplayout.h>
|
||||||
#include <gdk/gdkrectangle.h>
|
#include <gdk/gdkrectangle.h>
|
||||||
|
|||||||
+38
-3
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include "gdkcairo.h"
|
#include "gdkcairoprivate.h"
|
||||||
|
|
||||||
#include "gdkrgba.h"
|
#include "gdkrgba.h"
|
||||||
#include "gdktexture.h"
|
#include "gdktexture.h"
|
||||||
@@ -90,7 +90,7 @@ gdk_cairo_region (cairo_t *cr,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
gdk_cairo_surface_paint_pixbuf (cairo_surface_t *surface,
|
gdk_cairo_surface_paint_pixbuf (cairo_surface_t *surface,
|
||||||
const GdkPixbuf *pixbuf)
|
const GdkPixbuf *pixbuf)
|
||||||
{
|
{
|
||||||
@@ -171,7 +171,7 @@ gdk_cairo_set_source_pixbuf (cairo_t *cr,
|
|||||||
*
|
*
|
||||||
* Returns: %TRUE if the extents fit in a `GdkRectangle`, %FALSE if not
|
* Returns: %TRUE if the extents fit in a `GdkRectangle`, %FALSE if not
|
||||||
*/
|
*/
|
||||||
static gboolean
|
gboolean
|
||||||
_gdk_cairo_surface_extents (cairo_surface_t *surface,
|
_gdk_cairo_surface_extents (cairo_surface_t *surface,
|
||||||
GdkRectangle *extents)
|
GdkRectangle *extents)
|
||||||
{
|
{
|
||||||
@@ -303,3 +303,38 @@ gdk_cairo_region_create_from_surface (cairo_surface_t *surface)
|
|||||||
|
|
||||||
return region;
|
return region;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cairo_region_t *
|
||||||
|
gdk_cairo_region_from_clip (cairo_t *cr)
|
||||||
|
{
|
||||||
|
cairo_rectangle_list_t *rectangles;
|
||||||
|
cairo_region_t *region;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
rectangles = cairo_copy_clip_rectangle_list (cr);
|
||||||
|
|
||||||
|
if (rectangles->status != CAIRO_STATUS_SUCCESS)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
region = cairo_region_create ();
|
||||||
|
for (i = 0; i < rectangles->num_rectangles; i++)
|
||||||
|
{
|
||||||
|
cairo_rectangle_int_t clip_rect;
|
||||||
|
cairo_rectangle_t *rect;
|
||||||
|
|
||||||
|
rect = &rectangles->rectangles[i];
|
||||||
|
|
||||||
|
/* Here we assume clip rects are ints for direct targets, which
|
||||||
|
is true for cairo */
|
||||||
|
clip_rect.x = (int)rect->x;
|
||||||
|
clip_rect.y = (int)rect->y;
|
||||||
|
clip_rect.width = (int)rect->width;
|
||||||
|
clip_rect.height = (int)rect->height;
|
||||||
|
|
||||||
|
cairo_region_union_rectangle (region, &clip_rect);
|
||||||
|
}
|
||||||
|
|
||||||
|
cairo_rectangle_list_destroy (rectangles);
|
||||||
|
|
||||||
|
return region;
|
||||||
|
}
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <gdk/gdktypes.h>
|
#include <gdk/gdktypes.h>
|
||||||
#include <gdk/deprecated/gdkpixbuf.h>
|
#include <gdk/gdkpixbuf.h>
|
||||||
#include <pango/pangocairo.h>
|
#include <pango/pangocairo.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
/* GDK - The GIMP Drawing Kit
|
||||||
|
* Copyright (C) 2020 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "gdkcairo.h"
|
||||||
|
|
||||||
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||||
|
#include <cairo.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
gboolean _gdk_cairo_surface_extents (cairo_surface_t *surface,
|
||||||
|
GdkRectangle *extents);
|
||||||
|
|
||||||
|
void gdk_cairo_surface_paint_pixbuf (cairo_surface_t *surface,
|
||||||
|
const GdkPixbuf *pixbuf);
|
||||||
|
|
||||||
|
cairo_region_t *gdk_cairo_region_from_clip (cairo_t *cr);
|
||||||
|
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
#include "gdkcontentserializer.h"
|
#include "gdkcontentserializer.h"
|
||||||
|
|
||||||
#include "gdkcontentformats.h"
|
#include "gdkcontentformats.h"
|
||||||
#include "deprecated/gdkpixbuf.h"
|
#include "gdkpixbuf.h"
|
||||||
#include "filetransferportalprivate.h"
|
#include "filetransferportalprivate.h"
|
||||||
#include "gdktextureprivate.h"
|
#include "gdktextureprivate.h"
|
||||||
#include "gdkrgba.h"
|
#include "gdkrgba.h"
|
||||||
@@ -642,9 +642,7 @@ pixbuf_serializer (GdkContentSerializer *serializer)
|
|||||||
else if (G_VALUE_HOLDS (value, GDK_TYPE_TEXTURE))
|
else if (G_VALUE_HOLDS (value, GDK_TYPE_TEXTURE))
|
||||||
{
|
{
|
||||||
GdkTexture *texture = g_value_get_object (value);
|
GdkTexture *texture = g_value_get_object (value);
|
||||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
|
||||||
pixbuf = gdk_pixbuf_get_from_texture (texture);
|
pixbuf = gdk_pixbuf_get_from_texture (texture);
|
||||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -371,12 +371,6 @@ gdk_draw_context_begin_frame_full (GdkDrawContext *context,
|
|||||||
priv->surface->paint_context = g_object_ref (context);
|
priv->surface->paint_context = g_object_ref (context);
|
||||||
|
|
||||||
GDK_DRAW_CONTEXT_GET_CLASS (context)->begin_frame (context, prefers_high_depth, priv->frame_region);
|
GDK_DRAW_CONTEXT_GET_CLASS (context)->begin_frame (context, prefers_high_depth, priv->frame_region);
|
||||||
|
|
||||||
cairo_region_intersect_rectangle (priv->frame_region,
|
|
||||||
&(cairo_rectangle_int_t) {
|
|
||||||
0, 0,
|
|
||||||
priv->surface->width, priv->surface->height
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_SYSPROF
|
#ifdef HAVE_SYSPROF
|
||||||
|
|||||||
+23
-23
@@ -466,26 +466,29 @@ gdk_gl_context_real_get_damage (GdkGLContext *context)
|
|||||||
eglQuerySurface (gdk_display_get_egl_display (display), egl_surface,
|
eglQuerySurface (gdk_display_get_egl_display (display), egl_surface,
|
||||||
EGL_BUFFER_AGE_EXT, &buffer_age);
|
EGL_BUFFER_AGE_EXT, &buffer_age);
|
||||||
|
|
||||||
if (buffer_age > 0 && buffer_age <= GDK_GL_MAX_TRACKED_BUFFERS)
|
switch (buffer_age)
|
||||||
{
|
{
|
||||||
cairo_region_t *damage = cairo_region_create ();
|
case 1:
|
||||||
int i;
|
return cairo_region_create ();
|
||||||
|
break;
|
||||||
|
|
||||||
for (i = 0; i < buffer_age - 1; i++)
|
case 2:
|
||||||
{
|
if (context->old_updated_area[0])
|
||||||
if (context->old_updated_area[i] == NULL)
|
return cairo_region_copy (context->old_updated_area[0]);
|
||||||
{
|
break;
|
||||||
cairo_region_create_rectangle (&(GdkRectangle) {
|
|
||||||
0, 0,
|
|
||||||
gdk_surface_get_width (surface),
|
|
||||||
gdk_surface_get_height (surface)
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
cairo_region_union (damage, context->old_updated_area[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return damage;
|
case 3:
|
||||||
|
if (context->old_updated_area[0] &&
|
||||||
|
context->old_updated_area[1])
|
||||||
|
{
|
||||||
|
cairo_region_t *damage = cairo_region_copy (context->old_updated_area[0]);
|
||||||
|
cairo_region_union (damage, context->old_updated_area[1]);
|
||||||
|
return damage;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -594,7 +597,6 @@ gdk_gl_context_real_begin_frame (GdkDrawContext *draw_context,
|
|||||||
cairo_region_t *damage;
|
cairo_region_t *damage;
|
||||||
double scale;
|
double scale;
|
||||||
int ww, wh;
|
int ww, wh;
|
||||||
int i;
|
|
||||||
|
|
||||||
surface = gdk_draw_context_get_surface (draw_context);
|
surface = gdk_draw_context_get_surface (draw_context);
|
||||||
scale = gdk_gl_context_get_scale (context);
|
scale = gdk_gl_context_get_scale (context);
|
||||||
@@ -606,11 +608,9 @@ gdk_gl_context_real_begin_frame (GdkDrawContext *draw_context,
|
|||||||
|
|
||||||
damage = GDK_GL_CONTEXT_GET_CLASS (context)->get_damage (context);
|
damage = GDK_GL_CONTEXT_GET_CLASS (context)->get_damage (context);
|
||||||
|
|
||||||
g_clear_pointer (&context->old_updated_area[GDK_GL_MAX_TRACKED_BUFFERS - 1], cairo_region_destroy);
|
if (context->old_updated_area[1])
|
||||||
for (i = GDK_GL_MAX_TRACKED_BUFFERS - 1; i > 0; i--)
|
cairo_region_destroy (context->old_updated_area[1]);
|
||||||
{
|
context->old_updated_area[1] = context->old_updated_area[0];
|
||||||
context->old_updated_area[i] = context->old_updated_area[i - 1];
|
|
||||||
}
|
|
||||||
context->old_updated_area[0] = cairo_region_copy (region);
|
context->old_updated_area[0] = cairo_region_copy (region);
|
||||||
|
|
||||||
cairo_region_union (region, damage);
|
cairo_region_union (region, damage);
|
||||||
|
|||||||
@@ -34,11 +34,6 @@ typedef enum {
|
|||||||
GDK_GL_CGL
|
GDK_GL_CGL
|
||||||
} GdkGLBackend;
|
} GdkGLBackend;
|
||||||
|
|
||||||
/* The maximum amount of buffers we track update regions for.
|
|
||||||
* Note that this is equal to the max buffer age value we
|
|
||||||
* can provide a damage region for */
|
|
||||||
#define GDK_GL_MAX_TRACKED_BUFFERS 4
|
|
||||||
|
|
||||||
#define GDK_GL_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_GL_CONTEXT, GdkGLContextClass))
|
#define GDK_GL_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_GL_CONTEXT, GdkGLContextClass))
|
||||||
#define GDK_IS_GL_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_GL_CONTEXT))
|
#define GDK_IS_GL_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_GL_CONTEXT))
|
||||||
#define GDK_GL_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_GL_CONTEXT, GdkGLContextClass))
|
#define GDK_GL_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_GL_CONTEXT, GdkGLContextClass))
|
||||||
@@ -50,7 +45,7 @@ struct _GdkGLContext
|
|||||||
GdkDrawContext parent_instance;
|
GdkDrawContext parent_instance;
|
||||||
|
|
||||||
/* We store the old drawn areas to support buffer-age optimizations */
|
/* We store the old drawn areas to support buffer-age optimizations */
|
||||||
cairo_region_t *old_updated_area[GDK_GL_MAX_TRACKED_BUFFERS];
|
cairo_region_t *old_updated_area[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GdkGLContextClass
|
struct _GdkGLContextClass
|
||||||
|
|||||||
@@ -157,9 +157,6 @@ convert_no_alpha (guchar *dest_data,
|
|||||||
*
|
*
|
||||||
* Returns: (nullable) (transfer full): A newly-created pixbuf with a
|
* Returns: (nullable) (transfer full): A newly-created pixbuf with a
|
||||||
* reference count of 1
|
* reference count of 1
|
||||||
*
|
|
||||||
* Deprecated: 4.12: Use [class@Gdk.Texture] and subclasses instead
|
|
||||||
* cairo surfaces and pixbufs
|
|
||||||
*/
|
*/
|
||||||
GdkPixbuf *
|
GdkPixbuf *
|
||||||
gdk_pixbuf_get_from_surface (cairo_surface_t *surface,
|
gdk_pixbuf_get_from_surface (cairo_surface_t *surface,
|
||||||
@@ -237,9 +234,6 @@ pixbuf_texture_unref_cb (guchar *pixels,
|
|||||||
* to draw it on screen.
|
* to draw it on screen.
|
||||||
*
|
*
|
||||||
* Returns: (transfer full) (nullable): a new `GdkPixbuf`
|
* Returns: (transfer full) (nullable): a new `GdkPixbuf`
|
||||||
*
|
|
||||||
* Deprecated: 4.12: Use [class@Gdk.Texture] and subclasses instead
|
|
||||||
* cairo surfaces and pixbufs
|
|
||||||
*/
|
*/
|
||||||
GdkPixbuf *
|
GdkPixbuf *
|
||||||
gdk_pixbuf_get_from_texture (GdkTexture *texture)
|
gdk_pixbuf_get_from_texture (GdkTexture *texture)
|
||||||
@@ -33,13 +33,13 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
GDK_DEPRECATED_IN_4_12
|
GDK_AVAILABLE_IN_ALL
|
||||||
GdkPixbuf *gdk_pixbuf_get_from_surface (cairo_surface_t *surface,
|
GdkPixbuf *gdk_pixbuf_get_from_surface (cairo_surface_t *surface,
|
||||||
int src_x,
|
int src_x,
|
||||||
int src_y,
|
int src_y,
|
||||||
int width,
|
int width,
|
||||||
int height);
|
int height);
|
||||||
GDK_DEPRECATED_IN_4_12
|
GDK_AVAILABLE_IN_ALL
|
||||||
GdkPixbuf *gdk_pixbuf_get_from_texture (GdkTexture *texture);
|
GdkPixbuf *gdk_pixbuf_get_from_texture (GdkTexture *texture);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
+1
-3
@@ -170,7 +170,7 @@ parse_rgb_value (const char *str,
|
|||||||
*
|
*
|
||||||
* The string can be either one of:
|
* The string can be either one of:
|
||||||
*
|
*
|
||||||
* - A standard name (Taken from the CSS specification).
|
* - A standard name (Taken from the Css specification).
|
||||||
* - A hexadecimal value in the form “\#rgb”, “\#rrggbb”,
|
* - A hexadecimal value in the form “\#rgb”, “\#rrggbb”,
|
||||||
* “\#rrrgggbbb” or ”\#rrrrggggbbbb”
|
* “\#rrrgggbbb” or ”\#rrrrggggbbbb”
|
||||||
* - A hexadecimal value in the form “\#rgba”, “\#rrggbbaa”,
|
* - A hexadecimal value in the form “\#rgba”, “\#rrggbbaa”,
|
||||||
@@ -178,8 +178,6 @@ parse_rgb_value (const char *str,
|
|||||||
* - A RGB color in the form “rgb(r,g,b)” (In this case the color
|
* - A RGB color in the form “rgb(r,g,b)” (In this case the color
|
||||||
* will have full opacity)
|
* will have full opacity)
|
||||||
* - A RGBA color in the form “rgba(r,g,b,a)”
|
* - A RGBA color in the form “rgba(r,g,b,a)”
|
||||||
* - A HSL color in the form "hsl(hue, saturation, lightness)"
|
|
||||||
* - A HSLA color in the form "hsla(hue, saturation, lightness, alpha)"
|
|
||||||
*
|
*
|
||||||
* Where “r”, “g”, “b” and “a” are respectively the red, green,
|
* Where “r”, “g”, “b” and “a” are respectively the red, green,
|
||||||
* blue and alpha color values. In the last two cases, “r”, “g”,
|
* blue and alpha color values. In the last two cases, “r”, “g”,
|
||||||
|
|||||||
@@ -225,17 +225,17 @@ gdk_texture_downloader_download_into (const GdkTextureDownloader *self,
|
|||||||
/**
|
/**
|
||||||
* gdk_texture_downloader_download_bytes:
|
* gdk_texture_downloader_download_bytes:
|
||||||
* @self: the downloader
|
* @self: the downloader
|
||||||
* @out_stride: (out): The stride of the resulting data in bytes
|
* @out_stride: (out): The stride of the resulting data in bytes.
|
||||||
*
|
*
|
||||||
* Downloads the given texture pixels into a `GBytes`. The rowstride will
|
* Downloads the given texture pixels into a `GBytes`. The rowstride will
|
||||||
* be stored in the stride value.
|
* be stored in the stride value.
|
||||||
*
|
*
|
||||||
* This function will abort if it tries to download a large texture and
|
* This function will abort if it tries to download a large texture and
|
||||||
* fails to allocate memory. If you think that may happen, you should handle
|
* fails to allocate memory. If you think that may happen, you should
|
||||||
* memory allocation yourself and use [method@Gdk.TextureDownloader.download_into]
|
* handle memory allocation yourself and use
|
||||||
* once allocation succeeded.
|
* gdk_texture_downloader_download_into() once allocation succeeded.
|
||||||
*
|
*
|
||||||
* Returns: The downloaded pixels
|
* Returns: The downloaded pixels.
|
||||||
*
|
*
|
||||||
* Since: 4.10
|
* Since: 4.10
|
||||||
**/
|
**/
|
||||||
|
|||||||
+4
-7
@@ -135,8 +135,7 @@ gdk_toplevel_default_export_handle_finish (GdkToplevel *toplevel,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_toplevel_default_unexport_handle (GdkToplevel *toplevel,
|
gdk_toplevel_default_unexport_handle (GdkToplevel *toplevel)
|
||||||
const char *handle)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -792,7 +791,7 @@ gdk_toplevel_export_handle (GdkToplevel *toplevel,
|
|||||||
* @result: the `GAsyncResult`
|
* @result: the `GAsyncResult`
|
||||||
* @error: return location for an error
|
* @error: return location for an error
|
||||||
*
|
*
|
||||||
* Finishes the [method@Gdk.Toplevel.export_handle] call and
|
* Finishes the [method@Gdk.Toplevel.export_handle] cal and
|
||||||
* returns the resulting handle.
|
* returns the resulting handle.
|
||||||
*
|
*
|
||||||
* Returns: (nullable) (transfer full): the exported handle,
|
* Returns: (nullable) (transfer full): the exported handle,
|
||||||
@@ -811,7 +810,6 @@ gdk_toplevel_export_handle_finish (GdkToplevel *toplevel,
|
|||||||
/*< private >
|
/*< private >
|
||||||
* gdk_toplevel_unexport_handle:
|
* gdk_toplevel_unexport_handle:
|
||||||
* @toplevel: a `GdkToplevel`
|
* @toplevel: a `GdkToplevel`
|
||||||
* @handle: the handle to unexport
|
|
||||||
*
|
*
|
||||||
* Destroys the handle that was obtained with [method@Gdk.Toplevel.export_handle].
|
* Destroys the handle that was obtained with [method@Gdk.Toplevel.export_handle].
|
||||||
*
|
*
|
||||||
@@ -821,8 +819,7 @@ gdk_toplevel_export_handle_finish (GdkToplevel *toplevel,
|
|||||||
* Since: 4.10
|
* Since: 4.10
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gdk_toplevel_unexport_handle (GdkToplevel *toplevel,
|
gdk_toplevel_unexport_handle (GdkToplevel *toplevel)
|
||||||
const char *handle)
|
|
||||||
{
|
{
|
||||||
GDK_TOPLEVEL_GET_IFACE (toplevel)->unexport_handle (toplevel, handle);
|
GDK_TOPLEVEL_GET_IFACE (toplevel)->unexport_handle (toplevel);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,8 +49,7 @@ struct _GdkToplevelInterface
|
|||||||
GAsyncResult *result,
|
GAsyncResult *result,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
void (* unexport_handle) (GdkToplevel *toplevel,
|
void (* unexport_handle) (GdkToplevel *toplevel);
|
||||||
const char *handle);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
@@ -83,8 +82,7 @@ char *gdk_toplevel_export_handle_finish (GdkToplevel *toplevel,
|
|||||||
GAsyncResult *result,
|
GAsyncResult *result,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
void gdk_toplevel_unexport_handle (GdkToplevel *toplevel,
|
void gdk_toplevel_unexport_handle (GdkToplevel *toplevel);
|
||||||
const char *handle);
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|||||||
+3
-4
@@ -1,5 +1,3 @@
|
|||||||
subdir('deprecated')
|
|
||||||
|
|
||||||
gdk_public_sources = files([
|
gdk_public_sources = files([
|
||||||
'gdk.c',
|
'gdk.c',
|
||||||
'gdkapplaunchcontext.c',
|
'gdkapplaunchcontext.c',
|
||||||
@@ -40,6 +38,7 @@ gdk_public_sources = files([
|
|||||||
'gdkmonitor.c',
|
'gdkmonitor.c',
|
||||||
'gdkpaintable.c',
|
'gdkpaintable.c',
|
||||||
'gdkpango.c',
|
'gdkpango.c',
|
||||||
|
'gdkpixbuf.c',
|
||||||
'gdkpipeiostream.c',
|
'gdkpipeiostream.c',
|
||||||
'gdkrectangle.c',
|
'gdkrectangle.c',
|
||||||
'gdkrgba.c',
|
'gdkrgba.c',
|
||||||
@@ -95,6 +94,7 @@ gdk_public_headers = files([
|
|||||||
'gdkmonitor.h',
|
'gdkmonitor.h',
|
||||||
'gdkpaintable.h',
|
'gdkpaintable.h',
|
||||||
'gdkpango.h',
|
'gdkpango.h',
|
||||||
|
'gdkpixbuf.h',
|
||||||
'gdkrectangle.h',
|
'gdkrectangle.h',
|
||||||
'gdkrgba.h',
|
'gdkrgba.h',
|
||||||
'gdkseat.h',
|
'gdkseat.h',
|
||||||
@@ -112,9 +112,8 @@ gdk_public_headers = files([
|
|||||||
'gdkdragsurface.h',
|
'gdkdragsurface.h',
|
||||||
])
|
])
|
||||||
install_headers(gdk_public_headers, subdir: 'gtk-4.0/gdk/')
|
install_headers(gdk_public_headers, subdir: 'gtk-4.0/gdk/')
|
||||||
install_headers(gdk_deprecated_headers, subdir: 'gtk-4.0/gdk/deprecated')
|
|
||||||
|
|
||||||
gdk_sources = gdk_public_sources + gdk_deprecated_sources
|
gdk_sources = gdk_public_sources
|
||||||
|
|
||||||
gdk_private_h_sources = files([
|
gdk_private_h_sources = files([
|
||||||
'gdkeventsprivate.h',
|
'gdkeventsprivate.h',
|
||||||
|
|||||||
@@ -1148,10 +1148,7 @@ gdk_wayland_surface_destroy (GdkSurface *surface,
|
|||||||
|
|
||||||
gdk_wayland_surface_hide_surface (surface);
|
gdk_wayland_surface_hide_surface (surface);
|
||||||
|
|
||||||
if (GDK_IS_TOPLEVEL (surface))
|
gdk_wayland_surface_destroy_wl_surface (GDK_WAYLAND_SURFACE(surface));
|
||||||
gdk_wayland_toplevel_destroy (GDK_TOPLEVEL (surface));
|
|
||||||
|
|
||||||
gdk_wayland_surface_destroy_wl_surface (GDK_WAYLAND_SURFACE (surface));
|
|
||||||
|
|
||||||
frame_clock = gdk_surface_get_frame_clock (surface);
|
frame_clock = gdk_surface_get_frame_clock (surface);
|
||||||
g_signal_handlers_disconnect_by_func (frame_clock, on_frame_clock_before_paint, surface);
|
g_signal_handlers_disconnect_by_func (frame_clock, on_frame_clock_before_paint, surface);
|
||||||
|
|||||||
@@ -39,4 +39,3 @@ void gdk_wayland_toplevel_announce_ssd (GdkToplevel *toplevel);
|
|||||||
gboolean gdk_wayland_toplevel_inhibit_idle (GdkToplevel *toplevel);
|
gboolean gdk_wayland_toplevel_inhibit_idle (GdkToplevel *toplevel);
|
||||||
void gdk_wayland_toplevel_uninhibit_idle (GdkToplevel *toplevel);
|
void gdk_wayland_toplevel_uninhibit_idle (GdkToplevel *toplevel);
|
||||||
|
|
||||||
void gdk_wayland_toplevel_destroy (GdkToplevel *toplevel);
|
|
||||||
|
|||||||
@@ -54,16 +54,11 @@ static void gdk_wayland_toplevel_sync_parent (GdkWaylandToplevel *to
|
|||||||
static void gdk_wayland_toplevel_sync_parent_of_imported (GdkWaylandToplevel *toplevel);
|
static void gdk_wayland_toplevel_sync_parent_of_imported (GdkWaylandToplevel *toplevel);
|
||||||
static void gdk_wayland_surface_create_xdg_toplevel (GdkWaylandToplevel *toplevel);
|
static void gdk_wayland_surface_create_xdg_toplevel (GdkWaylandToplevel *toplevel);
|
||||||
static void gdk_wayland_toplevel_sync_title (GdkWaylandToplevel *toplevel);
|
static void gdk_wayland_toplevel_sync_title (GdkWaylandToplevel *toplevel);
|
||||||
|
static gboolean gdk_wayland_toplevel_is_exported (GdkWaylandToplevel *toplevel);
|
||||||
static void unset_transient_for_exported (GdkWaylandToplevel *toplevel);
|
static void unset_transient_for_exported (GdkWaylandToplevel *toplevel);
|
||||||
|
|
||||||
/* {{{ GdkWaylandToplevel definition */
|
/* {{{ GdkWaylandToplevel definition */
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
struct zxdg_exported_v1 *xdg_exported;
|
|
||||||
struct zxdg_exported_v2 *xdg_exported_v2;
|
|
||||||
char *handle;
|
|
||||||
} GdkWaylandExported;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GdkWaylandToplevel:
|
* GdkWaylandToplevel:
|
||||||
*
|
*
|
||||||
@@ -88,7 +83,8 @@ struct _GdkWaylandToplevel
|
|||||||
GdkWaylandToplevel *transient_for;
|
GdkWaylandToplevel *transient_for;
|
||||||
|
|
||||||
struct org_kde_kwin_server_decoration *server_decoration;
|
struct org_kde_kwin_server_decoration *server_decoration;
|
||||||
GList *exported;
|
struct zxdg_exported_v1 *xdg_exported;
|
||||||
|
struct zxdg_exported_v2 *xdg_exported_v2;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
int width;
|
int width;
|
||||||
@@ -106,6 +102,12 @@ struct _GdkWaylandToplevel
|
|||||||
gboolean size_is_fixed;
|
gboolean size_is_fixed;
|
||||||
} next_layout;
|
} next_layout;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
GdkWaylandToplevelExported callback;
|
||||||
|
gpointer user_data;
|
||||||
|
GDestroyNotify destroy_func;
|
||||||
|
} exported;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
gboolean was_set;
|
gboolean was_set;
|
||||||
|
|
||||||
@@ -1278,6 +1280,9 @@ gdk_wayland_toplevel_finalize (GObject *object)
|
|||||||
|
|
||||||
display_wayland->toplevels = g_list_remove (display_wayland->toplevels, self);
|
display_wayland->toplevels = g_list_remove (display_wayland->toplevels, self);
|
||||||
|
|
||||||
|
if (gdk_wayland_toplevel_is_exported (self))
|
||||||
|
gdk_wayland_toplevel_unexport_handle (GDK_TOPLEVEL (self));
|
||||||
|
|
||||||
g_free (self->application.application_id);
|
g_free (self->application.application_id);
|
||||||
g_free (self->application.app_menu_path);
|
g_free (self->application.app_menu_path);
|
||||||
g_free (self->application.menubar_path);
|
g_free (self->application.menubar_path);
|
||||||
@@ -1742,12 +1747,8 @@ xdg_exported_handle_v1 (void *data,
|
|||||||
struct zxdg_exported_v1 *zxdg_exported_v1,
|
struct zxdg_exported_v1 *zxdg_exported_v1,
|
||||||
const char *handle)
|
const char *handle)
|
||||||
{
|
{
|
||||||
GTask *task = G_TASK (data);
|
g_task_return_pointer (G_TASK (data), g_strdup (handle), g_free);
|
||||||
GdkWaylandExported *exported = (GdkWaylandExported *)g_task_get_task_data (task);
|
g_object_unref (data);
|
||||||
|
|
||||||
exported->handle = g_strdup (handle);
|
|
||||||
g_task_return_pointer (task, g_strdup (handle), g_free);
|
|
||||||
g_object_unref (task);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct zxdg_exported_v1_listener xdg_exported_listener_v1 = {
|
static const struct zxdg_exported_v1_listener xdg_exported_listener_v1 = {
|
||||||
@@ -1759,12 +1760,8 @@ xdg_exported_handle_v2 (void *data,
|
|||||||
struct zxdg_exported_v2 *zxdg_exported_v2,
|
struct zxdg_exported_v2 *zxdg_exported_v2,
|
||||||
const char *handle)
|
const char *handle)
|
||||||
{
|
{
|
||||||
GTask *task = G_TASK (data);
|
g_task_return_pointer (G_TASK (data), g_strdup (handle), g_free);
|
||||||
GdkWaylandExported *exported = (GdkWaylandExported *)g_task_get_task_data (task);
|
g_object_unref (data);
|
||||||
|
|
||||||
exported->handle = g_strdup (handle);
|
|
||||||
g_task_return_pointer (task, g_strdup (handle), g_free);
|
|
||||||
g_object_unref (task);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct zxdg_exported_v2_listener xdg_exported_listener_v2 = {
|
static const struct zxdg_exported_v2_listener xdg_exported_listener_v2 = {
|
||||||
@@ -1787,27 +1784,19 @@ gdk_wayland_toplevel_real_export_handle (GdkToplevel *toplevel,
|
|||||||
|
|
||||||
if (display_wayland->xdg_exporter_v2)
|
if (display_wayland->xdg_exporter_v2)
|
||||||
{
|
{
|
||||||
GdkWaylandExported *exported = g_new0 (GdkWaylandExported, 1);
|
wayland_toplevel->xdg_exported_v2 =
|
||||||
exported->xdg_exported_v2 =
|
|
||||||
zxdg_exporter_v2_export_toplevel (display_wayland->xdg_exporter_v2,
|
zxdg_exporter_v2_export_toplevel (display_wayland->xdg_exporter_v2,
|
||||||
gdk_wayland_surface_get_wl_surface (surface));
|
gdk_wayland_surface_get_wl_surface (surface));
|
||||||
zxdg_exported_v2_add_listener (exported->xdg_exported_v2,
|
zxdg_exported_v2_add_listener (wayland_toplevel->xdg_exported_v2,
|
||||||
&xdg_exported_listener_v2, task);
|
&xdg_exported_listener_v2, task);
|
||||||
|
|
||||||
wayland_toplevel->exported = g_list_prepend (wayland_toplevel->exported, exported);
|
|
||||||
g_task_set_task_data (task, exported, NULL);
|
|
||||||
}
|
}
|
||||||
else if (display_wayland->xdg_exporter)
|
else if (display_wayland->xdg_exporter)
|
||||||
{
|
{
|
||||||
GdkWaylandExported *exported = g_new0 (GdkWaylandExported, 1);
|
wayland_toplevel->xdg_exported =
|
||||||
exported->xdg_exported =
|
|
||||||
zxdg_exporter_v1_export (display_wayland->xdg_exporter,
|
zxdg_exporter_v1_export (display_wayland->xdg_exporter,
|
||||||
gdk_wayland_surface_get_wl_surface (surface));
|
gdk_wayland_surface_get_wl_surface (surface));
|
||||||
zxdg_exported_v1_add_listener (exported->xdg_exported,
|
zxdg_exported_v1_add_listener (wayland_toplevel->xdg_exported,
|
||||||
&xdg_exported_listener_v1, task);
|
&xdg_exported_listener_v1, task);
|
||||||
|
|
||||||
wayland_toplevel->exported = g_list_prepend (wayland_toplevel->exported, exported);
|
|
||||||
g_task_set_task_data (task, exported, NULL);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1826,36 +1815,15 @@ gdk_wayland_toplevel_real_export_handle_finish (GdkToplevel *toplevel,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
destroy_exported (GdkWaylandExported *exported)
|
gdk_wayland_toplevel_real_unexport_handle (GdkToplevel *toplevel)
|
||||||
{
|
|
||||||
g_clear_pointer (&exported->handle, g_free);
|
|
||||||
g_clear_pointer (&exported->xdg_exported_v2, zxdg_exported_v2_destroy);
|
|
||||||
g_clear_pointer (&exported->xdg_exported, zxdg_exported_v1_destroy);
|
|
||||||
g_free (exported);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gdk_wayland_toplevel_real_unexport_handle (GdkToplevel *toplevel,
|
|
||||||
const char *handle)
|
|
||||||
{
|
{
|
||||||
GdkWaylandToplevel *wayland_toplevel = GDK_WAYLAND_TOPLEVEL (toplevel);
|
GdkWaylandToplevel *wayland_toplevel = GDK_WAYLAND_TOPLEVEL (toplevel);
|
||||||
|
|
||||||
g_return_if_fail (GDK_IS_WAYLAND_TOPLEVEL (toplevel));
|
g_return_if_fail (GDK_IS_WAYLAND_TOPLEVEL (toplevel));
|
||||||
g_return_if_fail (handle != NULL);
|
g_return_if_fail (wayland_toplevel->xdg_exported_v2 || wayland_toplevel->xdg_exported);
|
||||||
|
|
||||||
for (GList *l = wayland_toplevel->exported; l; l = l->next)
|
g_clear_pointer (&wayland_toplevel->xdg_exported_v2, zxdg_exported_v2_destroy);
|
||||||
{
|
g_clear_pointer (&wayland_toplevel->xdg_exported, zxdg_exported_v1_destroy);
|
||||||
GdkWaylandExported *exported = l->data;
|
|
||||||
|
|
||||||
if (exported->handle && strcmp (exported->handle, handle) == 0)
|
|
||||||
{
|
|
||||||
wayland_toplevel->exported = g_list_delete_link (wayland_toplevel->exported, l);
|
|
||||||
destroy_exported (exported);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
g_warn_if_reached ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@@ -2287,32 +2255,6 @@ gdk_wayland_toplevel_set_dbus_properties (GdkToplevel *toplevel,
|
|||||||
maybe_set_gtk_surface_dbus_properties (wayland_toplevel);
|
maybe_set_gtk_surface_dbus_properties (wayland_toplevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
gdk_wayland_toplevel_destroy (GdkToplevel *toplevel)
|
|
||||||
{
|
|
||||||
GdkWaylandToplevel *self = GDK_WAYLAND_TOPLEVEL (toplevel);
|
|
||||||
|
|
||||||
while (self->exported)
|
|
||||||
{
|
|
||||||
GdkWaylandExported *exported = self->exported->data;
|
|
||||||
self->exported = g_list_delete_link (self->exported, self->exported);
|
|
||||||
if (exported->handle == NULL)
|
|
||||||
{
|
|
||||||
GTask *task;
|
|
||||||
|
|
||||||
if (exported->xdg_exported_v2)
|
|
||||||
task = G_TASK (wl_proxy_get_user_data ((struct wl_proxy *) exported->xdg_exported_v2));
|
|
||||||
else
|
|
||||||
task = G_TASK (wl_proxy_get_user_data ((struct wl_proxy *) exported->xdg_exported));
|
|
||||||
|
|
||||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED, "Surface was destroyed");
|
|
||||||
g_object_unref (task);
|
|
||||||
}
|
|
||||||
|
|
||||||
destroy_exported (exported);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* }}} */
|
/* }}} */
|
||||||
/* {{{ Toplevel API */
|
/* {{{ Toplevel API */
|
||||||
|
|
||||||
@@ -2455,6 +2397,12 @@ gdk_wayland_toplevel_uninhibit_idle (GdkToplevel *toplevel)
|
|||||||
* marking surfaces as transient for out-of-process surfaces.
|
* marking surfaces as transient for out-of-process surfaces.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gdk_wayland_toplevel_is_exported (GdkWaylandToplevel *toplevel)
|
||||||
|
{
|
||||||
|
return toplevel->xdg_exported != NULL || toplevel->xdg_exported_v2 != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
GdkWaylandToplevelExported callback;
|
GdkWaylandToplevelExported callback;
|
||||||
gpointer user_data;
|
gpointer user_data;
|
||||||
@@ -2502,12 +2450,6 @@ export_handle_done (GObject *source,
|
|||||||
* from another surface as transient for this one, see
|
* from another surface as transient for this one, see
|
||||||
* [method@GdkWayland.WaylandToplevel.set_transient_for_exported].
|
* [method@GdkWayland.WaylandToplevel.set_transient_for_exported].
|
||||||
*
|
*
|
||||||
* Before 4.12, this API could not safely be used multiple times,
|
|
||||||
* since there was no reference counting for handles. Starting with
|
|
||||||
* 4.12, every call to this function obtains a new handle, and every
|
|
||||||
* call to [method@GdkWayland.WaylandToplevel.drop_exported_handle] drops
|
|
||||||
* just the handle that it is given.
|
|
||||||
*
|
|
||||||
* Note that this API depends on an unstable Wayland protocol,
|
* Note that this API depends on an unstable Wayland protocol,
|
||||||
* and thus may require changes in the future.
|
* and thus may require changes in the future.
|
||||||
*
|
*
|
||||||
@@ -2544,53 +2486,15 @@ gdk_wayland_toplevel_export_handle (GdkToplevel *toplevel,
|
|||||||
* It is an error to call this function on a surface that
|
* It is an error to call this function on a surface that
|
||||||
* does not have a handle.
|
* does not have a handle.
|
||||||
*
|
*
|
||||||
* Since 4.12, this function does nothing. Use
|
|
||||||
* [method@GdkWayland.WaylandToplevel.drop_exported_handle] instead to drop a
|
|
||||||
* handle that was obtained with [method@GdkWayland.WaylandToplevel.export_handle].
|
|
||||||
*
|
|
||||||
* Note that this API depends on an unstable Wayland protocol,
|
* Note that this API depends on an unstable Wayland protocol,
|
||||||
* and thus may require changes in the future.
|
* and thus may require changes in the future.
|
||||||
*
|
|
||||||
* Deprecated: 4.12: Use [method@GdkWayland.WaylandToplevel.drop_exported_handle]
|
|
||||||
* instead, this function does nothing
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gdk_wayland_toplevel_unexport_handle (GdkToplevel *toplevel)
|
gdk_wayland_toplevel_unexport_handle (GdkToplevel *toplevel)
|
||||||
{
|
{
|
||||||
GdkWaylandToplevel *wayland_toplevel = GDK_WAYLAND_TOPLEVEL (toplevel);
|
g_return_if_fail (GDK_IS_WAYLAND_TOPLEVEL (toplevel));
|
||||||
|
|
||||||
if (wayland_toplevel->exported != NULL &&
|
gdk_toplevel_unexport_handle (toplevel);
|
||||||
wayland_toplevel->exported->next == NULL)
|
|
||||||
{
|
|
||||||
GdkWaylandExported *exported = wayland_toplevel->exported->data;
|
|
||||||
|
|
||||||
if (exported->handle)
|
|
||||||
{
|
|
||||||
gdk_toplevel_unexport_handle (toplevel, exported->handle);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
g_warning ("Use gdk_wayland_toplevel_drop_exported_handle()");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gdk_wayland_toplevel_drop_exported_handle:
|
|
||||||
* @toplevel: (type GdkWaylandToplevel): the `GdkToplevel` that was exported
|
|
||||||
* @handle: the handle to drop
|
|
||||||
*
|
|
||||||
* Destroy a handle that was obtained with gdk_wayland_toplevel_export_handle().
|
|
||||||
*
|
|
||||||
* Note that this API depends on an unstable Wayland protocol,
|
|
||||||
* and thus may require changes in the future.
|
|
||||||
*
|
|
||||||
* Since: 4.12
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
gdk_wayland_toplevel_drop_exported_handle (GdkToplevel *toplevel,
|
|
||||||
const char *handle)
|
|
||||||
{
|
|
||||||
gdk_toplevel_unexport_handle (toplevel, handle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -52,13 +52,9 @@ gboolean gdk_wayland_toplevel_export_handle (GdkToplevel
|
|||||||
gpointer user_data,
|
gpointer user_data,
|
||||||
GDestroyNotify destroy_func);
|
GDestroyNotify destroy_func);
|
||||||
|
|
||||||
GDK_DEPRECATED_IN_4_12_FOR(gdk_wayland_toplevel_drop_exported_handle)
|
GDK_AVAILABLE_IN_ALL
|
||||||
void gdk_wayland_toplevel_unexport_handle (GdkToplevel *toplevel);
|
void gdk_wayland_toplevel_unexport_handle (GdkToplevel *toplevel);
|
||||||
|
|
||||||
GDK_AVAILABLE_IN_4_12
|
|
||||||
void gdk_wayland_toplevel_drop_exported_handle (GdkToplevel *toplevel,
|
|
||||||
const char *handle);
|
|
||||||
|
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
gboolean gdk_wayland_toplevel_set_transient_for_exported (GdkToplevel *toplevel,
|
gboolean gdk_wayland_toplevel_set_transient_for_exported (GdkToplevel *toplevel,
|
||||||
const char *parent_handle_str);
|
const char *parent_handle_str);
|
||||||
|
|||||||
@@ -144,8 +144,7 @@ struct _GdkX11Display
|
|||||||
guint server_time_is_monotonic_time : 1;
|
guint server_time_is_monotonic_time : 1;
|
||||||
|
|
||||||
/* GLX extensions we check */
|
/* GLX extensions we check */
|
||||||
guint has_glx_sgi_swap_control : 1;
|
guint has_glx_swap_interval : 1;
|
||||||
guint has_glx_swap_control : 1;
|
|
||||||
guint has_glx_create_context : 1;
|
guint has_glx_create_context : 1;
|
||||||
guint has_glx_texture_from_pixmap : 1;
|
guint has_glx_texture_from_pixmap : 1;
|
||||||
guint has_glx_video_sync : 1;
|
guint has_glx_video_sync : 1;
|
||||||
|
|||||||
+29
-45
@@ -162,7 +162,7 @@ gdk_x11_gl_context_glx_end_frame (GdkDrawContext *draw_context,
|
|||||||
if (display_x11->has_glx_video_sync)
|
if (display_x11->has_glx_video_sync)
|
||||||
glXGetVideoSyncSGI (&end_frame_counter);
|
glXGetVideoSyncSGI (&end_frame_counter);
|
||||||
|
|
||||||
if (self->do_frame_sync && !display_x11->has_glx_sgi_swap_control && !display_x11->has_glx_swap_control)
|
if (self->do_frame_sync && !display_x11->has_glx_swap_interval)
|
||||||
{
|
{
|
||||||
glFinish ();
|
glFinish ();
|
||||||
|
|
||||||
@@ -249,7 +249,7 @@ gdk_x11_gl_context_glx_make_current (GdkGLContext *context,
|
|||||||
if (!glXMakeContextCurrent (dpy, drawable, drawable, self->glx_context))
|
if (!glXMakeContextCurrent (dpy, drawable, drawable, self->glx_context))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!surfaceless)
|
if (!surfaceless && GDK_X11_DISPLAY (display)->has_glx_swap_interval)
|
||||||
{
|
{
|
||||||
/* If the WM is compositing there is no particular need to delay
|
/* If the WM is compositing there is no particular need to delay
|
||||||
* the swap when drawing on the offscreen, rendering to the screen
|
* the swap when drawing on the offscreen, rendering to the screen
|
||||||
@@ -257,35 +257,14 @@ gdk_x11_gl_context_glx_make_current (GdkGLContext *context,
|
|||||||
* to the vblank. */
|
* to the vblank. */
|
||||||
do_frame_sync = ! gdk_display_is_composited (display);
|
do_frame_sync = ! gdk_display_is_composited (display);
|
||||||
|
|
||||||
if (GDK_X11_DISPLAY (display)->has_glx_swap_control)
|
if (do_frame_sync != self->do_frame_sync)
|
||||||
{
|
{
|
||||||
if (do_frame_sync != self->do_frame_sync)
|
self->do_frame_sync = do_frame_sync;
|
||||||
{
|
|
||||||
self->do_frame_sync = do_frame_sync;
|
|
||||||
|
|
||||||
if (do_frame_sync)
|
if (do_frame_sync)
|
||||||
glXSwapIntervalEXT (dpy, drawable, 1);
|
glXSwapIntervalSGI (1);
|
||||||
else
|
else
|
||||||
glXSwapIntervalEXT (dpy, drawable, 0);
|
glXSwapIntervalSGI (0);
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (GDK_X11_DISPLAY (display)->has_glx_sgi_swap_control)
|
|
||||||
{
|
|
||||||
/* If the WM is compositing there is no particular need to delay
|
|
||||||
* the swap when drawing on the offscreen, rendering to the screen
|
|
||||||
* happens later anyway, and its up to the compositor to sync that
|
|
||||||
* to the vblank. */
|
|
||||||
do_frame_sync = ! gdk_display_is_composited (display);
|
|
||||||
|
|
||||||
if (do_frame_sync != self->do_frame_sync)
|
|
||||||
{
|
|
||||||
self->do_frame_sync = do_frame_sync;
|
|
||||||
|
|
||||||
if (do_frame_sync)
|
|
||||||
glXSwapIntervalSGI (1);
|
|
||||||
else
|
|
||||||
glXSwapIntervalSGI (0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -308,20 +287,29 @@ gdk_x11_gl_context_glx_get_damage (GdkGLContext *context)
|
|||||||
glXQueryDrawable (dpy, gdk_x11_gl_context_glx_get_drawable (self),
|
glXQueryDrawable (dpy, gdk_x11_gl_context_glx_get_drawable (self),
|
||||||
GLX_BACK_BUFFER_AGE_EXT, &buffer_age);
|
GLX_BACK_BUFFER_AGE_EXT, &buffer_age);
|
||||||
|
|
||||||
if (buffer_age > 0 && buffer_age <= GDK_GL_MAX_TRACKED_BUFFERS)
|
switch (buffer_age)
|
||||||
{
|
{
|
||||||
cairo_region_t *damage = cairo_region_create ();
|
case 1:
|
||||||
int i;
|
return cairo_region_create ();
|
||||||
|
break;
|
||||||
|
|
||||||
for (i = 0; i < buffer_age - 1; i++)
|
case 2:
|
||||||
{
|
if (context->old_updated_area[0])
|
||||||
if (context->old_updated_area[i] == NULL)
|
return cairo_region_copy (context->old_updated_area[0]);
|
||||||
return GDK_GL_CONTEXT_CLASS (gdk_x11_gl_context_glx_parent_class)->get_damage (context);
|
break;
|
||||||
|
|
||||||
cairo_region_union (damage, context->old_updated_area[i]);
|
case 3:
|
||||||
}
|
if (context->old_updated_area[0] &&
|
||||||
|
context->old_updated_area[1])
|
||||||
|
{
|
||||||
|
cairo_region_t *damage = cairo_region_copy (context->old_updated_area[0]);
|
||||||
|
cairo_region_union (damage, context->old_updated_area[1]);
|
||||||
|
return damage;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
return damage;
|
default:
|
||||||
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -957,10 +945,8 @@ gdk_x11_display_init_glx (GdkX11Display *display_x11,
|
|||||||
epoxy_has_glx_extension (dpy, screen_num, "GLX_ARB_create_context_profile");
|
epoxy_has_glx_extension (dpy, screen_num, "GLX_ARB_create_context_profile");
|
||||||
display_x11->has_glx_create_es2_context =
|
display_x11->has_glx_create_es2_context =
|
||||||
epoxy_has_glx_extension (dpy, screen_num, "GLX_EXT_create_context_es2_profile");
|
epoxy_has_glx_extension (dpy, screen_num, "GLX_EXT_create_context_es2_profile");
|
||||||
display_x11->has_glx_sgi_swap_control =
|
display_x11->has_glx_swap_interval =
|
||||||
epoxy_has_glx_extension (dpy, screen_num, "GLX_SGI_swap_control");
|
epoxy_has_glx_extension (dpy, screen_num, "GLX_SGI_swap_control");
|
||||||
display_x11->has_glx_swap_control =
|
|
||||||
epoxy_has_glx_extension (dpy, screen_num, "GLX_EXT_swap_control");
|
|
||||||
display_x11->has_glx_texture_from_pixmap =
|
display_x11->has_glx_texture_from_pixmap =
|
||||||
epoxy_has_glx_extension (dpy, screen_num, "GLX_EXT_texture_from_pixmap");
|
epoxy_has_glx_extension (dpy, screen_num, "GLX_EXT_texture_from_pixmap");
|
||||||
display_x11->has_glx_video_sync =
|
display_x11->has_glx_video_sync =
|
||||||
@@ -1021,7 +1007,6 @@ gdk_x11_display_init_glx (GdkX11Display *display_x11,
|
|||||||
"\t* GLX_ARB_create_context_profile: %s\n"
|
"\t* GLX_ARB_create_context_profile: %s\n"
|
||||||
"\t* GLX_EXT_create_context_es2_profile: %s\n"
|
"\t* GLX_EXT_create_context_es2_profile: %s\n"
|
||||||
"\t* GLX_SGI_swap_control: %s\n"
|
"\t* GLX_SGI_swap_control: %s\n"
|
||||||
"\t* GLX_EXT_swap_control: %s\n"
|
|
||||||
"\t* GLX_EXT_texture_from_pixmap: %s\n"
|
"\t* GLX_EXT_texture_from_pixmap: %s\n"
|
||||||
"\t* GLX_SGI_video_sync: %s\n"
|
"\t* GLX_SGI_video_sync: %s\n"
|
||||||
"\t* GLX_EXT_buffer_age: %s\n"
|
"\t* GLX_EXT_buffer_age: %s\n"
|
||||||
@@ -1033,8 +1018,7 @@ gdk_x11_display_init_glx (GdkX11Display *display_x11,
|
|||||||
glXGetClientString (dpy, GLX_VENDOR),
|
glXGetClientString (dpy, GLX_VENDOR),
|
||||||
display_x11->has_glx_create_context ? "yes" : "no",
|
display_x11->has_glx_create_context ? "yes" : "no",
|
||||||
display_x11->has_glx_create_es2_context ? "yes" : "no",
|
display_x11->has_glx_create_es2_context ? "yes" : "no",
|
||||||
display_x11->has_glx_sgi_swap_control ? "yes" : "no",
|
display_x11->has_glx_swap_interval ? "yes" : "no",
|
||||||
display_x11->has_glx_swap_control ? "yes" : "no",
|
|
||||||
display_x11->has_glx_texture_from_pixmap ? "yes" : "no",
|
display_x11->has_glx_texture_from_pixmap ? "yes" : "no",
|
||||||
display_x11->has_glx_video_sync ? "yes" : "no",
|
display_x11->has_glx_video_sync ? "yes" : "no",
|
||||||
display_x11->has_glx_buffer_age ? "yes" : "no",
|
display_x11->has_glx_buffer_age ? "yes" : "no",
|
||||||
|
|||||||
@@ -5318,8 +5318,7 @@ gdk_x11_toplevel_export_handle_finish (GdkToplevel *toplevel,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_x11_toplevel_unexport_handle (GdkToplevel *toplevel,
|
gdk_x11_toplevel_unexport_handle (GdkToplevel *toplevel)
|
||||||
const char *handle)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -579,7 +579,7 @@ discard_batch (GskGLCommandQueue *self)
|
|||||||
self->batches.len--;
|
self->batches.len--;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
void
|
||||||
gsk_gl_command_queue_begin_draw (GskGLCommandQueue *self,
|
gsk_gl_command_queue_begin_draw (GskGLCommandQueue *self,
|
||||||
GskGLUniformProgram *program,
|
GskGLUniformProgram *program,
|
||||||
guint width,
|
guint width,
|
||||||
@@ -596,7 +596,7 @@ gsk_gl_command_queue_begin_draw (GskGLCommandQueue *self,
|
|||||||
* of batches we can have in one frame.
|
* of batches we can have in one frame.
|
||||||
*/
|
*/
|
||||||
if (will_ignore_batch (self))
|
if (will_ignore_batch (self))
|
||||||
return FALSE;
|
return;
|
||||||
|
|
||||||
self->program_info = program;
|
self->program_info = program;
|
||||||
|
|
||||||
@@ -617,8 +617,6 @@ gsk_gl_command_queue_begin_draw (GskGLCommandQueue *self,
|
|||||||
self->fbo_max = MAX (self->fbo_max, batch->draw.framebuffer);
|
self->fbo_max = MAX (self->fbo_max, batch->draw.framebuffer);
|
||||||
|
|
||||||
self->in_draw = TRUE;
|
self->in_draw = TRUE;
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -723,10 +721,6 @@ gsk_gl_command_queue_split_draw (GskGLCommandQueue *self)
|
|||||||
|
|
||||||
g_assert (GSK_IS_GL_COMMAND_QUEUE (self));
|
g_assert (GSK_IS_GL_COMMAND_QUEUE (self));
|
||||||
g_assert (self->batches.len > 0);
|
g_assert (self->batches.len > 0);
|
||||||
|
|
||||||
if (will_ignore_batch (self))
|
|
||||||
return;
|
|
||||||
|
|
||||||
g_assert (self->in_draw == TRUE);
|
g_assert (self->in_draw == TRUE);
|
||||||
|
|
||||||
program = self->program_info;
|
program = self->program_info;
|
||||||
|
|||||||
@@ -331,7 +331,7 @@ void gsk_gl_command_queue_delete_program (GskGLCommandQueue
|
|||||||
void gsk_gl_command_queue_clear (GskGLCommandQueue *self,
|
void gsk_gl_command_queue_clear (GskGLCommandQueue *self,
|
||||||
guint clear_bits,
|
guint clear_bits,
|
||||||
const graphene_rect_t *viewport);
|
const graphene_rect_t *viewport);
|
||||||
gboolean gsk_gl_command_queue_begin_draw (GskGLCommandQueue *self,
|
void gsk_gl_command_queue_begin_draw (GskGLCommandQueue *self,
|
||||||
GskGLUniformProgram *program_info,
|
GskGLUniformProgram *program_info,
|
||||||
guint width,
|
guint width,
|
||||||
guint height);
|
guint height);
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ gsk_gl_compiler_new (GskGLDriver *driver,
|
|||||||
self->driver = g_object_ref (driver);
|
self->driver = g_object_ref (driver);
|
||||||
self->debug_shaders = !!debug_shaders;
|
self->debug_shaders = !!debug_shaders;
|
||||||
|
|
||||||
context = gsk_gl_driver_get_context (self->driver);
|
context = gsk_gl_command_queue_get_context (self->driver->shared_command_queue);
|
||||||
|
|
||||||
if (gdk_gl_context_get_use_es (context))
|
if (gdk_gl_context_get_use_es (context))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1131,7 +1131,7 @@ gsk_gl_driver_lookup_shader (GskGLDriver *self,
|
|||||||
return program;
|
return program;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#ifdef G_ENABLE_DEBUG
|
||||||
void
|
void
|
||||||
gsk_gl_driver_save_texture_to_png (GskGLDriver *driver,
|
gsk_gl_driver_save_texture_to_png (GskGLDriver *driver,
|
||||||
int texture_id,
|
int texture_id,
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ GskGLProgram * gsk_gl_driver_lookup_shader (GskGLDriver *s
|
|||||||
GskGLShader *shader,
|
GskGLShader *shader,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
#if 0
|
#ifdef G_ENABLE_DEBUG
|
||||||
void gsk_gl_driver_save_texture_to_png (GskGLDriver *self,
|
void gsk_gl_driver_save_texture_to_png (GskGLDriver *self,
|
||||||
int texture_id,
|
int texture_id,
|
||||||
int width,
|
int width,
|
||||||
|
|||||||
+933
-977
File diff suppressed because it is too large
Load Diff
@@ -88,7 +88,7 @@ gsk_gl_texture_library_real_compact (GskGLTextureLibrary *self,
|
|||||||
GskGLTextureAtlasEntry *entry;
|
GskGLTextureAtlasEntry *entry;
|
||||||
GHashTableIter iter;
|
GHashTableIter iter;
|
||||||
guint dropped = 0;
|
guint dropped = 0;
|
||||||
G_GNUC_UNUSED guint atlased = 0;
|
guint atlased = 0;
|
||||||
|
|
||||||
g_hash_table_iter_init (&iter, self->hash_table);
|
g_hash_table_iter_init (&iter, self->hash_table);
|
||||||
while (g_hash_table_iter_next (&iter, NULL, (gpointer *)&entry))
|
while (g_hash_table_iter_next (&iter, NULL, (gpointer *)&entry))
|
||||||
|
|||||||
@@ -4413,11 +4413,6 @@ gsk_shadow_node_draw (GskRenderNode *node,
|
|||||||
pattern = cairo_pop_group (cr);
|
pattern = cairo_pop_group (cr);
|
||||||
cairo_restore (cr);
|
cairo_restore (cr);
|
||||||
|
|
||||||
cairo_save (cr);
|
|
||||||
/* clip so the blur area stays small */
|
|
||||||
gsk_cairo_rectangle (cr, &node->bounds);
|
|
||||||
cairo_clip (cr);
|
|
||||||
|
|
||||||
for (i = 0; i < self->n_shadows; i++)
|
for (i = 0; i < self->n_shadows; i++)
|
||||||
{
|
{
|
||||||
GskShadow *shadow = &self->shadows[i];
|
GskShadow *shadow = &self->shadows[i];
|
||||||
@@ -4439,7 +4434,6 @@ gsk_shadow_node_draw (GskRenderNode *node,
|
|||||||
|
|
||||||
cairo_set_source (cr, pattern);
|
cairo_set_source (cr, pattern);
|
||||||
cairo_paint (cr);
|
cairo_paint (cr);
|
||||||
cairo_restore (cr);
|
|
||||||
|
|
||||||
cairo_pattern_destroy (pattern);
|
cairo_pattern_destroy (pattern);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1081,21 +1081,20 @@ parse_declarations (GtkCssParser *parser,
|
|||||||
{
|
{
|
||||||
if (gtk_css_parser_try_ident (parser, declarations[i].name))
|
if (gtk_css_parser_try_ident (parser, declarations[i].name))
|
||||||
{
|
{
|
||||||
if (parsed & (1 << i))
|
|
||||||
{
|
|
||||||
gtk_css_parser_warn_syntax (parser, "Variable \"%s\" defined multiple times", declarations[i].name);
|
|
||||||
/* Unset, just to be sure */
|
|
||||||
parsed &= ~(1 << i);
|
|
||||||
if (declarations[i].clear_func)
|
|
||||||
declarations[i].clear_func (declarations[i].result);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!gtk_css_parser_try_token (parser, GTK_CSS_TOKEN_COLON))
|
if (!gtk_css_parser_try_token (parser, GTK_CSS_TOKEN_COLON))
|
||||||
{
|
{
|
||||||
gtk_css_parser_error_syntax (parser, "Expected ':' after variable declaration");
|
gtk_css_parser_error_syntax (parser, "Expected ':' after variable declaration");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (parsed & (1 << i))
|
||||||
|
{
|
||||||
|
gtk_css_parser_warn_syntax (parser, "Variable \"%s\" defined multiple times", declarations[i].name);
|
||||||
|
/* Unset, just to be sure */
|
||||||
|
parsed &= ~(1 << i);
|
||||||
|
if (declarations[i].clear_func)
|
||||||
|
declarations[i].clear_func (declarations[i].result);
|
||||||
|
}
|
||||||
if (!declarations[i].parse_func (parser, context, declarations[i].result))
|
if (!declarations[i].parse_func (parser, context, declarations[i].result))
|
||||||
{
|
{
|
||||||
/* nothing to do */
|
/* nothing to do */
|
||||||
|
|||||||
@@ -689,6 +689,230 @@ gsk_rounded_rect_intersect_with_rect (const GskRoundedRect *self,
|
|||||||
return GSK_INTERSECTION_NONEMPTY;
|
return GSK_INTERSECTION_NONEMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
rect_corner (const graphene_rect_t *r,
|
||||||
|
unsigned int i,
|
||||||
|
graphene_point_t *p)
|
||||||
|
{
|
||||||
|
switch (i)
|
||||||
|
{
|
||||||
|
case GSK_CORNER_TOP_LEFT:
|
||||||
|
graphene_rect_get_top_left (r, p);
|
||||||
|
break;
|
||||||
|
case GSK_CORNER_TOP_RIGHT:
|
||||||
|
graphene_rect_get_top_right (r, p);
|
||||||
|
break;
|
||||||
|
case GSK_CORNER_BOTTOM_RIGHT:
|
||||||
|
graphene_rect_get_bottom_right (r, p);
|
||||||
|
break;
|
||||||
|
case GSK_CORNER_BOTTOM_LEFT:
|
||||||
|
graphene_rect_get_bottom_left (r, p);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
g_assert_not_reached ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
corner_rect (const GskRoundedRect *s,
|
||||||
|
unsigned int i,
|
||||||
|
graphene_rect_t *r)
|
||||||
|
{
|
||||||
|
switch (i)
|
||||||
|
{
|
||||||
|
case GSK_CORNER_TOP_LEFT:
|
||||||
|
graphene_rect_init (r,
|
||||||
|
s->bounds.origin.x,
|
||||||
|
s->bounds.origin.y,
|
||||||
|
s->corner[i].width,
|
||||||
|
s->corner[i].height);
|
||||||
|
break;
|
||||||
|
case GSK_CORNER_TOP_RIGHT:
|
||||||
|
graphene_rect_init (r,
|
||||||
|
s->bounds.origin.x + s->bounds.size.width - s->corner[i].width,
|
||||||
|
s->bounds.origin.y,
|
||||||
|
s->corner[i].width,
|
||||||
|
s->corner[i].height);
|
||||||
|
break;
|
||||||
|
case GSK_CORNER_BOTTOM_RIGHT:
|
||||||
|
graphene_rect_init (r,
|
||||||
|
s->bounds.origin.x + s->bounds.size.width - s->corner[i].width,
|
||||||
|
s->bounds.origin.y + s->bounds.size.height - s->corner[i].height,
|
||||||
|
s->corner[i].width,
|
||||||
|
s->corner[i].height);
|
||||||
|
break;
|
||||||
|
case GSK_CORNER_BOTTOM_LEFT:
|
||||||
|
graphene_rect_init (r,
|
||||||
|
s->bounds.origin.x,
|
||||||
|
s->bounds.origin.y + s->bounds.size.height - s->corner[i].height,
|
||||||
|
s->corner[i].width,
|
||||||
|
s->corner[i].height);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
g_assert_not_reached ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline gboolean
|
||||||
|
point_in_interior (const graphene_point_t *p,
|
||||||
|
const graphene_rect_t *r)
|
||||||
|
{
|
||||||
|
if (graphene_rect_contains_point (r, p))
|
||||||
|
{
|
||||||
|
if (p->x > r->origin.x && p->x < r->origin.x + r->size.width)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
if (p->y > r->origin.y && p->y < r->origin.y + r->size.height)
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
GskRoundedRectIntersection
|
||||||
|
gsk_rounded_rect_intersect (const GskRoundedRect *self,
|
||||||
|
const GskRoundedRect *other,
|
||||||
|
GskRoundedRect *result)
|
||||||
|
{
|
||||||
|
if (!graphene_rect_intersection (&self->bounds, &other->bounds, &result->bounds))
|
||||||
|
return GSK_INTERSECTION_EMPTY;
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
graphene_point_t p, p1, p2;
|
||||||
|
|
||||||
|
rect_corner (&self->bounds, i, &p1);
|
||||||
|
rect_corner (&other->bounds, i, &p2);
|
||||||
|
rect_corner (&result->bounds, i, &p);
|
||||||
|
|
||||||
|
if (graphene_point_equal (&p, &p1))
|
||||||
|
{
|
||||||
|
if (graphene_point_equal (&p, &p2))
|
||||||
|
{
|
||||||
|
graphene_rect_t c;
|
||||||
|
graphene_rect_t d;
|
||||||
|
|
||||||
|
corner_rect (self, i, &c);
|
||||||
|
corner_rect (other, i, &d);
|
||||||
|
|
||||||
|
/* corners coincide */
|
||||||
|
if (graphene_rect_contains_rect (&c, &d))
|
||||||
|
{
|
||||||
|
graphene_point_t q1, q2;
|
||||||
|
|
||||||
|
rect_corner (&c, (i + 1) % 4, &q1);
|
||||||
|
rect_corner (&c, (i + 3) % 4, &q2);
|
||||||
|
|
||||||
|
if (gsk_rounded_rect_contains_point (other, &q1) &&
|
||||||
|
gsk_rounded_rect_contains_point (other, &q2))
|
||||||
|
result->corner[i] = self->corner[i];
|
||||||
|
else
|
||||||
|
return GSK_INTERSECTION_NOT_REPRESENTABLE;
|
||||||
|
}
|
||||||
|
else if (graphene_rect_contains_rect (&d, &c))
|
||||||
|
{
|
||||||
|
graphene_point_t q1, q2;
|
||||||
|
|
||||||
|
rect_corner (&d, (i + 1) % 4, &q1);
|
||||||
|
rect_corner (&d, (i + 3) % 4, &q2);
|
||||||
|
|
||||||
|
if (gsk_rounded_rect_contains_point (self, &q1) &&
|
||||||
|
gsk_rounded_rect_contains_point (self, &q2))
|
||||||
|
result->corner[i] = other->corner[i];
|
||||||
|
else
|
||||||
|
return GSK_INTERSECTION_NOT_REPRESENTABLE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return GSK_INTERSECTION_NOT_REPRESENTABLE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
graphene_rect_t c;
|
||||||
|
graphene_point_t q1, q2;
|
||||||
|
|
||||||
|
corner_rect (self, i, &c);
|
||||||
|
|
||||||
|
rect_corner (&c, (i + 1) % 4, &q1);
|
||||||
|
rect_corner (&c, (i + 3) % 4, &q2);
|
||||||
|
|
||||||
|
if (gsk_rounded_rect_contains_point (other, &q1) &&
|
||||||
|
gsk_rounded_rect_contains_point (other, &q2))
|
||||||
|
{
|
||||||
|
if (gsk_rounded_rect_contains_point (other, &p))
|
||||||
|
result->corner[i] = self->corner[i];
|
||||||
|
else
|
||||||
|
#if 1
|
||||||
|
return GSK_INTERSECTION_NEEDS_QUARTIC;
|
||||||
|
#else
|
||||||
|
if (/* no intersection for i */)
|
||||||
|
result->corner[i] = self->corner[i];
|
||||||
|
else
|
||||||
|
return GSK_INTERSECTION_NOT_REPRESENTABLE;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return GSK_INTERSECTION_NOT_REPRESENTABLE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (graphene_point_equal (&p, &p2))
|
||||||
|
{
|
||||||
|
graphene_rect_t d;
|
||||||
|
graphene_point_t q1, q2;
|
||||||
|
|
||||||
|
corner_rect (other, i, &d);
|
||||||
|
|
||||||
|
rect_corner (&d, (i + 1) % 4, &q1);
|
||||||
|
rect_corner (&d, (i + 3) % 4, &q2);
|
||||||
|
|
||||||
|
if (gsk_rounded_rect_contains_point (self, &q1) &&
|
||||||
|
gsk_rounded_rect_contains_point (self, &q2))
|
||||||
|
{
|
||||||
|
if (gsk_rounded_rect_contains_point (self, &p))
|
||||||
|
result->corner[i] = other->corner[i];
|
||||||
|
else
|
||||||
|
#if 1
|
||||||
|
return GSK_INTERSECTION_NEEDS_QUARTIC;
|
||||||
|
#else
|
||||||
|
if (/* no intersection for i */
|
||||||
|
result->corner[i] = other->corner[i];
|
||||||
|
else
|
||||||
|
return GSK_INTERSECTION_NOT_REPRESENTABLE;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return GSK_INTERSECTION_NOT_REPRESENTABLE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
graphene_rect_t c, d;
|
||||||
|
|
||||||
|
corner_rect (self, (i + 2) % 4, &c);
|
||||||
|
if (graphene_rect_contains_point (&c, &p) &&
|
||||||
|
!gsk_rounded_rect_contains_point (self, &p))
|
||||||
|
return GSK_INTERSECTION_EMPTY;
|
||||||
|
|
||||||
|
corner_rect (other, (i + 2) % 4, &d);
|
||||||
|
if (graphene_rect_contains_point (&d, &p) &&
|
||||||
|
!gsk_rounded_rect_contains_point (other, &p))
|
||||||
|
return GSK_INTERSECTION_EMPTY;
|
||||||
|
|
||||||
|
for (unsigned int j = 0; j < 4; j++)
|
||||||
|
{
|
||||||
|
corner_rect (self, j, &c);
|
||||||
|
corner_rect (other, j, &d);
|
||||||
|
|
||||||
|
if (point_in_interior (&p, &c) ||
|
||||||
|
point_in_interior (&p, &d))
|
||||||
|
return GSK_INTERSECTION_NOT_REPRESENTABLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
result->corner[i] = (graphene_size_t) { 0, 0 };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return GSK_INTERSECTION_NONEMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
append_arc (cairo_t *cr, double angle1, double angle2, gboolean negative)
|
append_arc (cairo_t *cr, double angle1, double angle2, gboolean negative)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,13 +37,17 @@ char * gsk_rounded_rect_to_string (const GskRounde
|
|||||||
typedef enum {
|
typedef enum {
|
||||||
GSK_INTERSECTION_EMPTY,
|
GSK_INTERSECTION_EMPTY,
|
||||||
GSK_INTERSECTION_NONEMPTY,
|
GSK_INTERSECTION_NONEMPTY,
|
||||||
GSK_INTERSECTION_NOT_REPRESENTABLE
|
GSK_INTERSECTION_NOT_REPRESENTABLE,
|
||||||
|
GSK_INTERSECTION_NEEDS_QUARTIC
|
||||||
} GskRoundedRectIntersection;
|
} GskRoundedRectIntersection;
|
||||||
|
|
||||||
GskRoundedRectIntersection gsk_rounded_rect_intersect_with_rect (const GskRoundedRect *self,
|
GskRoundedRectIntersection gsk_rounded_rect_intersect_with_rect (const GskRoundedRect *self,
|
||||||
const graphene_rect_t *rect,
|
const graphene_rect_t *rect,
|
||||||
GskRoundedRect *result) G_GNUC_PURE;
|
GskRoundedRect *result) G_GNUC_PURE;
|
||||||
|
|
||||||
|
GskRoundedRectIntersection gsk_rounded_rect_intersect (const GskRoundedRect *self,
|
||||||
|
const GskRoundedRect *other,
|
||||||
|
GskRoundedRect *result) G_GNUC_PURE;
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ gsk_vulkan_clip_intersect_rounded_rect (GskVulkanClip *dest,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case GSK_VULKAN_CLIP_NONE:
|
case GSK_VULKAN_CLIP_NONE:
|
||||||
dest->type = gsk_rounded_rect_is_circular (rounded) ? GSK_VULKAN_CLIP_ROUNDED_CIRCULAR : GSK_VULKAN_CLIP_ROUNDED;
|
dest->type = gsk_rounded_rect_is_circular (&dest->rect) ? GSK_VULKAN_CLIP_ROUNDED_CIRCULAR : GSK_VULKAN_CLIP_ROUNDED;
|
||||||
gsk_rounded_rect_init_copy (&dest->rect, rounded);
|
gsk_rounded_rect_init_copy (&dest->rect, rounded);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -450,7 +450,7 @@ gsk_vulkan_glyph_cache_begin_frame (GskVulkanGlyphCache *cache)
|
|||||||
GHashTableIter iter;
|
GHashTableIter iter;
|
||||||
GlyphCacheKey *key;
|
GlyphCacheKey *key;
|
||||||
GskVulkanCachedGlyph *value;
|
GskVulkanCachedGlyph *value;
|
||||||
G_GNUC_UNUSED guint dropped = 0;
|
guint dropped = 0;
|
||||||
|
|
||||||
cache->timestamp++;
|
cache->timestamp++;
|
||||||
|
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ gsk_vulkan_render_pass_new (GdkVulkanContext *context,
|
|||||||
graphene_matrix_init_ortho (&self->p,
|
graphene_matrix_init_ortho (&self->p,
|
||||||
viewport->origin.x, viewport->origin.x + viewport->size.width,
|
viewport->origin.x, viewport->origin.x + viewport->size.width,
|
||||||
viewport->origin.y, viewport->origin.y + viewport->size.height,
|
viewport->origin.y, viewport->origin.y + viewport->size.height,
|
||||||
2 * ORTHO_NEAR_PLANE - ORTHO_FAR_PLANE,
|
ORTHO_NEAR_PLANE,
|
||||||
ORTHO_FAR_PLANE);
|
ORTHO_FAR_PLANE);
|
||||||
|
|
||||||
if (signal_semaphore != VK_NULL_HANDLE) // this is a dependent pass
|
if (signal_semaphore != VK_NULL_HANDLE) // this is a dependent pass
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
gsk_private_vulkan_include_shaders = [
|
# FIXME: what's up with these?
|
||||||
'clip.frag.glsl',
|
#gsk_private_vulkan_include_shaders = [
|
||||||
'clip.vert.glsl',
|
# 'clip.frag.glsl',
|
||||||
'constants.glsl',
|
# 'clip.vert.glsl',
|
||||||
'rounded-rect.glsl',
|
# 'constants.glsl',
|
||||||
]
|
# 'rounded-rect.glsl',
|
||||||
|
#]
|
||||||
|
|
||||||
gsk_private_vulkan_fragment_shaders = [
|
gsk_private_vulkan_fragment_shaders = [
|
||||||
'blendmode.frag',
|
'blendmode.frag',
|
||||||
@@ -50,7 +51,6 @@ foreach shader: gsk_private_vulkan_shaders
|
|||||||
compiled_shader = custom_target(spv_shader,
|
compiled_shader = custom_target(spv_shader,
|
||||||
input: shader,
|
input: shader,
|
||||||
output: spv_shader,
|
output: spv_shader,
|
||||||
depend_files: gsk_private_vulkan_include_shaders,
|
|
||||||
command: [
|
command: [
|
||||||
glslc,
|
glslc,
|
||||||
stage_arg,
|
stage_arg,
|
||||||
@@ -61,7 +61,6 @@ foreach shader: gsk_private_vulkan_shaders
|
|||||||
compiled_clip_shader = custom_target(clip_spv_shader,
|
compiled_clip_shader = custom_target(clip_spv_shader,
|
||||||
input: shader,
|
input: shader,
|
||||||
output: clip_spv_shader,
|
output: clip_spv_shader,
|
||||||
depend_files: gsk_private_vulkan_include_shaders,
|
|
||||||
command: [
|
command: [
|
||||||
glslc,
|
glslc,
|
||||||
stage_arg,
|
stage_arg,
|
||||||
@@ -72,7 +71,6 @@ foreach shader: gsk_private_vulkan_shaders
|
|||||||
compiled_clip_rounded_shader = custom_target(clip_rounded_spv_shader,
|
compiled_clip_rounded_shader = custom_target(clip_rounded_spv_shader,
|
||||||
input: shader,
|
input: shader,
|
||||||
output: clip_rounded_spv_shader,
|
output: clip_rounded_spv_shader,
|
||||||
depend_files: gsk_private_vulkan_include_shaders,
|
|
||||||
command: [
|
command: [
|
||||||
glslc,
|
glslc,
|
||||||
stage_arg,
|
stage_arg,
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
GtkWindow *parent;
|
GtkWindow *parent;
|
||||||
char *handle;
|
|
||||||
GAppLaunchContext *context;
|
GAppLaunchContext *context;
|
||||||
char *uri;
|
char *uri;
|
||||||
GTask *task;
|
GTask *task;
|
||||||
@@ -40,10 +39,9 @@ typedef struct {
|
|||||||
static void
|
static void
|
||||||
gtk_show_uri_data_free (GtkShowUriData *data)
|
gtk_show_uri_data_free (GtkShowUriData *data)
|
||||||
{
|
{
|
||||||
if (data->parent && data->handle)
|
if (data->parent)
|
||||||
gtk_window_unexport_handle (data->parent, data->handle);
|
gtk_window_unexport_handle (data->parent);
|
||||||
g_clear_object (&data->parent);
|
g_clear_object (&data->parent);
|
||||||
g_free (data->handle);
|
|
||||||
g_clear_object (&data->context);
|
g_clear_object (&data->context);
|
||||||
g_free (data->uri);
|
g_free (data->uri);
|
||||||
g_clear_object (&data->task);
|
g_clear_object (&data->task);
|
||||||
@@ -74,10 +72,7 @@ window_handle_exported (GtkWindow *window,
|
|||||||
GtkShowUriData *data = user_data;
|
GtkShowUriData *data = user_data;
|
||||||
|
|
||||||
if (handle)
|
if (handle)
|
||||||
{
|
g_app_launch_context_setenv (data->context, "PARENT_WINDOW_ID", handle);
|
||||||
g_app_launch_context_setenv (data->context, "PARENT_WINDOW_ID", handle);
|
|
||||||
data->handle = g_strdup (handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_app_info_launch_default_for_uri_async (data->uri,
|
g_app_info_launch_default_for_uri_async (data->uri,
|
||||||
data->context,
|
data->context,
|
||||||
|
|||||||
@@ -17,13 +17,11 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <gdk/gdk.h>
|
#include <gdk/gdk.h>
|
||||||
#include "gdktextureutilsprivate.h"
|
#include "gdkpixbufutilsprivate.h"
|
||||||
#include "gtkscalerprivate.h"
|
#include "gtkscalerprivate.h"
|
||||||
|
|
||||||
#include "gdk/gdktextureprivate.h"
|
#include "gdk/gdktextureprivate.h"
|
||||||
|
|
||||||
/* {{{ Pixbuf helpers */
|
|
||||||
|
|
||||||
static GdkPixbuf *
|
static GdkPixbuf *
|
||||||
load_from_stream (GdkPixbufLoader *loader,
|
load_from_stream (GdkPixbufLoader *loader,
|
||||||
GInputStream *stream,
|
GInputStream *stream,
|
||||||
@@ -93,7 +91,7 @@ size_prepared_cb (GdkPixbufLoader *loader,
|
|||||||
* load the image at its original size times the
|
* load the image at its original size times the
|
||||||
* given scale.
|
* given scale.
|
||||||
*/
|
*/
|
||||||
static GdkPixbuf *
|
GdkPixbuf *
|
||||||
_gdk_pixbuf_new_from_stream_scaled (GInputStream *stream,
|
_gdk_pixbuf_new_from_stream_scaled (GInputStream *stream,
|
||||||
double scale,
|
double scale,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
@@ -147,7 +145,7 @@ size_prepared_cb2 (GdkPixbufLoader *loader,
|
|||||||
gdk_pixbuf_loader_set_size (loader, width, height);
|
gdk_pixbuf_loader_set_size (loader, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GdkPixbuf *
|
GdkPixbuf *
|
||||||
_gdk_pixbuf_new_from_stream_at_scale (GInputStream *stream,
|
_gdk_pixbuf_new_from_stream_at_scale (GInputStream *stream,
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
@@ -174,7 +172,44 @@ _gdk_pixbuf_new_from_stream_at_scale (GInputStream *stream,
|
|||||||
return pixbuf;
|
return pixbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GdkPixbuf *
|
GdkPixbuf *
|
||||||
|
_gdk_pixbuf_new_from_stream (GInputStream *stream,
|
||||||
|
GCancellable *cancellable,
|
||||||
|
GError **error)
|
||||||
|
{
|
||||||
|
return _gdk_pixbuf_new_from_stream_scaled (stream, 0, cancellable, error);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Like gdk_pixbuf_new_from_resource_at_scale, but
|
||||||
|
* load the image at its original size times the
|
||||||
|
* given scale.
|
||||||
|
*/
|
||||||
|
GdkPixbuf *
|
||||||
|
_gdk_pixbuf_new_from_resource_scaled (const char *resource_path,
|
||||||
|
double scale,
|
||||||
|
GError **error)
|
||||||
|
{
|
||||||
|
GInputStream *stream;
|
||||||
|
GdkPixbuf *pixbuf;
|
||||||
|
|
||||||
|
stream = g_resources_open_stream (resource_path, 0, error);
|
||||||
|
if (stream == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
pixbuf = _gdk_pixbuf_new_from_stream_scaled (stream, scale, NULL, error);
|
||||||
|
g_object_unref (stream);
|
||||||
|
|
||||||
|
return pixbuf;
|
||||||
|
}
|
||||||
|
|
||||||
|
GdkPixbuf *
|
||||||
|
_gdk_pixbuf_new_from_resource (const char *resource_path,
|
||||||
|
GError **error)
|
||||||
|
{
|
||||||
|
return _gdk_pixbuf_new_from_resource_scaled (resource_path, 0, error);
|
||||||
|
}
|
||||||
|
|
||||||
|
GdkPixbuf *
|
||||||
_gdk_pixbuf_new_from_resource_at_scale (const char *resource_path,
|
_gdk_pixbuf_new_from_resource_at_scale (const char *resource_path,
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
@@ -192,10 +227,8 @@ _gdk_pixbuf_new_from_resource_at_scale (const char *resource_path,
|
|||||||
g_object_unref (stream);
|
g_object_unref (stream);
|
||||||
|
|
||||||
return pixbuf;
|
return pixbuf;
|
||||||
}
|
|
||||||
|
|
||||||
/* }}} */
|
}
|
||||||
/* {{{ Symbolic processing */
|
|
||||||
|
|
||||||
static GdkPixbuf *
|
static GdkPixbuf *
|
||||||
load_symbolic_svg (const char *escaped_file_data,
|
load_symbolic_svg (const char *escaped_file_data,
|
||||||
@@ -302,17 +335,19 @@ gtk_make_symbolic_pixbuf_from_data (const char *file_data,
|
|||||||
char *escaped_file_data;
|
char *escaped_file_data;
|
||||||
|
|
||||||
/* Fetch size from the original icon */
|
/* Fetch size from the original icon */
|
||||||
GInputStream *stream = g_memory_input_stream_new_from_data (file_data, file_len, NULL);
|
{
|
||||||
GdkPixbuf *reference = gdk_pixbuf_new_from_stream (stream, NULL, error);
|
GInputStream *stream = g_memory_input_stream_new_from_data (file_data, file_len, NULL);
|
||||||
|
GdkPixbuf *reference = gdk_pixbuf_new_from_stream (stream, NULL, error);
|
||||||
|
|
||||||
g_object_unref (stream);
|
g_object_unref (stream);
|
||||||
|
|
||||||
if (!reference)
|
if (!reference)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
icon_width = gdk_pixbuf_get_width (reference);
|
icon_width = gdk_pixbuf_get_width (reference);
|
||||||
icon_height = gdk_pixbuf_get_height (reference);
|
icon_height = gdk_pixbuf_get_height (reference);
|
||||||
g_object_unref (reference);
|
g_object_unref (reference);
|
||||||
|
}
|
||||||
|
|
||||||
escaped_file_data = g_base64_encode ((guchar *) file_data, file_len);
|
escaped_file_data = g_base64_encode ((guchar *) file_data, file_len);
|
||||||
icon_width_str = g_strdup_printf ("%d", icon_width);
|
icon_width_str = g_strdup_printf ("%d", icon_width);
|
||||||
@@ -383,12 +418,12 @@ out:
|
|||||||
return pixbuf;
|
return pixbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GdkPixbuf *
|
GdkPixbuf *
|
||||||
make_symbolic_pixbuf_from_resource (const char *path,
|
gtk_make_symbolic_pixbuf_from_resource (const char *path,
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
double scale,
|
double scale,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GBytes *bytes;
|
GBytes *bytes;
|
||||||
const char *data;
|
const char *data;
|
||||||
@@ -408,12 +443,12 @@ make_symbolic_pixbuf_from_resource (const char *path,
|
|||||||
return pixbuf;
|
return pixbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GdkPixbuf *
|
GdkPixbuf *
|
||||||
make_symbolic_pixbuf_from_path (const char *path,
|
gtk_make_symbolic_pixbuf_from_path (const char *path,
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
double scale,
|
double scale,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
char *data;
|
char *data;
|
||||||
gsize size;
|
gsize size;
|
||||||
@@ -429,12 +464,12 @@ make_symbolic_pixbuf_from_path (const char *path,
|
|||||||
return pixbuf;
|
return pixbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GdkPixbuf *
|
GdkPixbuf *
|
||||||
make_symbolic_pixbuf_from_file (GFile *file,
|
gtk_make_symbolic_pixbuf_from_file (GFile *file,
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
double scale,
|
double scale,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
char *data;
|
char *data;
|
||||||
gsize size;
|
gsize size;
|
||||||
@@ -450,91 +485,6 @@ make_symbolic_pixbuf_from_file (GFile *file,
|
|||||||
return pixbuf;
|
return pixbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* }}} */
|
|
||||||
/* {{{ Texture API */
|
|
||||||
|
|
||||||
GdkTexture *
|
|
||||||
gdk_texture_new_from_stream_at_scale (GInputStream *stream,
|
|
||||||
int width,
|
|
||||||
int height,
|
|
||||||
gboolean aspect,
|
|
||||||
GCancellable *cancellable,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
GdkPixbuf *pixbuf;
|
|
||||||
GdkTexture *texture = NULL;
|
|
||||||
|
|
||||||
pixbuf = _gdk_pixbuf_new_from_stream_at_scale (stream, width, height, aspect, cancellable, error);
|
|
||||||
if (pixbuf)
|
|
||||||
{
|
|
||||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
|
||||||
g_object_unref (pixbuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
return texture;
|
|
||||||
}
|
|
||||||
|
|
||||||
GdkTexture *
|
|
||||||
gdk_texture_new_from_stream (GInputStream *stream,
|
|
||||||
GCancellable *cancellable,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
GdkPixbuf *pixbuf;
|
|
||||||
GdkTexture *texture = NULL;
|
|
||||||
|
|
||||||
pixbuf = _gdk_pixbuf_new_from_stream_scaled (stream, 0, cancellable, error);
|
|
||||||
if (pixbuf)
|
|
||||||
{
|
|
||||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
|
||||||
g_object_unref (pixbuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
return texture;
|
|
||||||
}
|
|
||||||
|
|
||||||
GdkTexture *
|
|
||||||
gdk_texture_new_from_resource_at_scale (const char *path,
|
|
||||||
int width,
|
|
||||||
int height,
|
|
||||||
gboolean preserve_aspect,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
GdkPixbuf *pixbuf;
|
|
||||||
GdkTexture *texture = NULL;
|
|
||||||
|
|
||||||
pixbuf = _gdk_pixbuf_new_from_resource_at_scale (path, width, height, preserve_aspect, error);
|
|
||||||
if (pixbuf)
|
|
||||||
{
|
|
||||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
|
||||||
g_object_unref (pixbuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
return texture;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* }}} */
|
|
||||||
/* {{{ Symbolic texture API */
|
|
||||||
|
|
||||||
GdkTexture *
|
|
||||||
gdk_texture_new_from_path_symbolic (const char *path,
|
|
||||||
int width,
|
|
||||||
int height,
|
|
||||||
double scale,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
GdkPixbuf *pixbuf;
|
|
||||||
GdkTexture *texture = NULL;
|
|
||||||
|
|
||||||
pixbuf = make_symbolic_pixbuf_from_path (path, width, height, scale, error);
|
|
||||||
if (pixbuf)
|
|
||||||
{
|
|
||||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
|
||||||
g_object_unref (pixbuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
return texture;
|
|
||||||
}
|
|
||||||
|
|
||||||
GdkTexture *
|
GdkTexture *
|
||||||
gtk_load_symbolic_texture_from_resource (const char *path)
|
gtk_load_symbolic_texture_from_resource (const char *path)
|
||||||
{
|
{
|
||||||
@@ -542,16 +492,16 @@ gtk_load_symbolic_texture_from_resource (const char *path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GdkTexture *
|
GdkTexture *
|
||||||
gdk_texture_new_from_resource_symbolic (const char *path,
|
gtk_make_symbolic_texture_from_resource (const char *path,
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
double scale,
|
double scale,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
GdkTexture *texture = NULL;
|
GdkTexture *texture = NULL;
|
||||||
|
|
||||||
pixbuf = make_symbolic_pixbuf_from_resource (path, width, height, scale, error);
|
pixbuf = gtk_make_symbolic_pixbuf_from_resource (path, width, height, scale, error);
|
||||||
if (pixbuf)
|
if (pixbuf)
|
||||||
{
|
{
|
||||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
||||||
@@ -572,7 +522,7 @@ gtk_load_symbolic_texture_from_file (GFile *file)
|
|||||||
if (stream == NULL)
|
if (stream == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
pixbuf = gdk_pixbuf_new_from_stream (stream, NULL, NULL);
|
pixbuf = _gdk_pixbuf_new_from_stream (stream, NULL, NULL);
|
||||||
g_object_unref (stream);
|
g_object_unref (stream);
|
||||||
if (pixbuf == NULL)
|
if (pixbuf == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -584,25 +534,22 @@ gtk_load_symbolic_texture_from_file (GFile *file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GdkTexture *
|
GdkTexture *
|
||||||
gdk_texture_new_from_file_symbolic (GFile *file,
|
gtk_make_symbolic_texture_from_file (GFile *file,
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
double scale,
|
double scale,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
GdkTexture *texture;
|
GdkTexture *texture;
|
||||||
|
|
||||||
pixbuf = make_symbolic_pixbuf_from_file (file, width, height, scale, error);
|
pixbuf = gtk_make_symbolic_pixbuf_from_file (file, width, height, scale, error);
|
||||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
||||||
g_object_unref (pixbuf);
|
g_object_unref (pixbuf);
|
||||||
|
|
||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* }}} */
|
|
||||||
/* {{{ Scaled paintable API */
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int scale_factor;
|
int scale_factor;
|
||||||
} LoaderData;
|
} LoaderData;
|
||||||
@@ -629,7 +576,7 @@ on_loader_size_prepared (GdkPixbufLoader *loader,
|
|||||||
height * loader_data->scale_factor);
|
height * loader_data->scale_factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GdkPaintable *
|
GdkPaintable *
|
||||||
gdk_paintable_new_from_bytes_scaled (GBytes *bytes,
|
gdk_paintable_new_from_bytes_scaled (GBytes *bytes,
|
||||||
int scale_factor)
|
int scale_factor)
|
||||||
{
|
{
|
||||||
@@ -733,7 +680,3 @@ gdk_paintable_new_from_file_scaled (GFile *file,
|
|||||||
|
|
||||||
return paintable;
|
return paintable;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* }}} */
|
|
||||||
|
|
||||||
/* vim:set foldmethod=marker expandtab: */
|
|
||||||
@@ -21,6 +21,30 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
GdkPixbuf *_gdk_pixbuf_new_from_stream (GInputStream *stream,
|
||||||
|
GCancellable *cancellable,
|
||||||
|
GError **error);
|
||||||
|
GdkPixbuf *_gdk_pixbuf_new_from_stream_at_scale (GInputStream *stream,
|
||||||
|
int width,
|
||||||
|
int height,
|
||||||
|
gboolean aspect,
|
||||||
|
GCancellable *cancellable,
|
||||||
|
GError **error);
|
||||||
|
GdkPixbuf *_gdk_pixbuf_new_from_stream_scaled (GInputStream *stream,
|
||||||
|
double scale,
|
||||||
|
GCancellable *cancellable,
|
||||||
|
GError **error);
|
||||||
|
GdkPixbuf *_gdk_pixbuf_new_from_resource (const char *resource_path,
|
||||||
|
GError **error);
|
||||||
|
GdkPixbuf *_gdk_pixbuf_new_from_resource_at_scale (const char *resource_path,
|
||||||
|
int width,
|
||||||
|
int height,
|
||||||
|
gboolean preserve_aspect,
|
||||||
|
GError **error);
|
||||||
|
GdkPixbuf *_gdk_pixbuf_new_from_resource_scaled (const char *resource_path,
|
||||||
|
double scale,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
GdkPixbuf *gtk_make_symbolic_pixbuf_from_data (const char *data,
|
GdkPixbuf *gtk_make_symbolic_pixbuf_from_data (const char *data,
|
||||||
gsize len,
|
gsize len,
|
||||||
int width,
|
int width,
|
||||||
@@ -28,41 +52,36 @@ GdkPixbuf *gtk_make_symbolic_pixbuf_from_data (const char *data,
|
|||||||
double scale,
|
double scale,
|
||||||
const char *debug_output_to,
|
const char *debug_output_to,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
GdkPixbuf *gtk_make_symbolic_pixbuf_from_file (GFile *file,
|
||||||
GdkTexture *gdk_texture_new_from_stream (GInputStream *stream,
|
|
||||||
GCancellable *cancellable,
|
|
||||||
GError **error);
|
|
||||||
GdkTexture *gdk_texture_new_from_stream_at_scale (GInputStream *stream,
|
|
||||||
int width,
|
|
||||||
int height,
|
|
||||||
gboolean aspect,
|
|
||||||
GCancellable *cancellable,
|
|
||||||
GError **error);
|
|
||||||
GdkTexture *gdk_texture_new_from_resource_at_scale (const char *path,
|
|
||||||
int width,
|
|
||||||
int height,
|
|
||||||
gboolean aspect,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
GdkTexture *gdk_texture_new_from_path_symbolic (const char *path,
|
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
double scale,
|
double scale,
|
||||||
GError **error);
|
GError **error);
|
||||||
GdkTexture *gdk_texture_new_from_file_symbolic (GFile *file,
|
GdkPixbuf *gtk_make_symbolic_pixbuf_from_path (const char *path,
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
double scale,
|
double scale,
|
||||||
GError **error);
|
GError **error);
|
||||||
GdkTexture *gdk_texture_new_from_resource_symbolic (const char *path,
|
GdkPixbuf *gtk_make_symbolic_pixbuf_from_resource (const char *path,
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
double scale,
|
double scale,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
GdkTexture *gtk_load_symbolic_texture_from_file (GFile *file);
|
GdkTexture *gtk_load_symbolic_texture_from_file (GFile *file);
|
||||||
|
GdkTexture *gtk_make_symbolic_texture_from_file (GFile *file,
|
||||||
|
int width,
|
||||||
|
int height,
|
||||||
|
double scale,
|
||||||
|
GError **error);
|
||||||
GdkTexture *gtk_load_symbolic_texture_from_resource (const char *data);
|
GdkTexture *gtk_load_symbolic_texture_from_resource (const char *data);
|
||||||
|
GdkTexture *gtk_make_symbolic_texture_from_resource (const char *path,
|
||||||
|
int width,
|
||||||
|
int height,
|
||||||
|
double scale,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
|
GdkPaintable *gdk_paintable_new_from_bytes_scaled (GBytes *bytes,
|
||||||
|
int scale_factor);
|
||||||
GdkPaintable *gdk_paintable_new_from_path_scaled (const char *path,
|
GdkPaintable *gdk_paintable_new_from_path_scaled (const char *path,
|
||||||
int scale_factor);
|
int scale_factor);
|
||||||
GdkPaintable *gdk_paintable_new_from_resource_scaled (const char *path,
|
GdkPaintable *gdk_paintable_new_from_resource_scaled (const char *path,
|
||||||
@@ -71,3 +90,4 @@ GdkPaintable *gdk_paintable_new_from_file_scaled (GFile *file,
|
|||||||
int scale_factor);
|
int scale_factor);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
@@ -220,7 +220,6 @@ enum
|
|||||||
PROP_COLUMNS,
|
PROP_COLUMNS,
|
||||||
PROP_ENABLE_RUBBERBAND,
|
PROP_ENABLE_RUBBERBAND,
|
||||||
PROP_HADJUSTMENT,
|
PROP_HADJUSTMENT,
|
||||||
PROP_HEADER_FACTORY,
|
|
||||||
PROP_HSCROLL_POLICY,
|
PROP_HSCROLL_POLICY,
|
||||||
PROP_MODEL,
|
PROP_MODEL,
|
||||||
PROP_REORDERABLE,
|
PROP_REORDERABLE,
|
||||||
@@ -630,10 +629,6 @@ gtk_column_view_get_property (GObject *object,
|
|||||||
g_value_set_object (value, self->hadjustment);
|
g_value_set_object (value, self->hadjustment);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_HEADER_FACTORY:
|
|
||||||
g_value_set_object (value, gtk_column_view_get_header_factory (self));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PROP_HSCROLL_POLICY:
|
case PROP_HSCROLL_POLICY:
|
||||||
g_value_set_enum (value, gtk_scrollable_get_hscroll_policy (GTK_SCROLLABLE (self->listview)));
|
g_value_set_enum (value, gtk_scrollable_get_hscroll_policy (GTK_SCROLLABLE (self->listview)));
|
||||||
break;
|
break;
|
||||||
@@ -717,10 +712,6 @@ gtk_column_view_set_property (GObject *object,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_HEADER_FACTORY:
|
|
||||||
gtk_column_view_set_header_factory (self, g_value_get_object (value));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PROP_HSCROLL_POLICY:
|
case PROP_HSCROLL_POLICY:
|
||||||
if (gtk_scrollable_get_hscroll_policy (GTK_SCROLLABLE (self->listview)) != g_value_get_enum (value))
|
if (gtk_scrollable_get_hscroll_policy (GTK_SCROLLABLE (self->listview)) != g_value_get_enum (value))
|
||||||
{
|
{
|
||||||
@@ -920,18 +911,6 @@ gtk_column_view_class_init (GtkColumnViewClass *klass)
|
|||||||
GTK_LIST_TAB_ALL,
|
GTK_LIST_TAB_ALL,
|
||||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
||||||
|
|
||||||
/**
|
|
||||||
* GtkColumnView:header-factory: (attributes org.gtk.Property.get=gtk_column_view_get_header_factory org.gtk.Property.set=gtk_column_view_set_header_factory)
|
|
||||||
*
|
|
||||||
* Factory for creating header widgets.
|
|
||||||
*
|
|
||||||
* Since: 4.12
|
|
||||||
*/
|
|
||||||
properties[PROP_HEADER_FACTORY] =
|
|
||||||
g_param_spec_object ("header-factory", NULL, NULL,
|
|
||||||
GTK_TYPE_LIST_ITEM_FACTORY,
|
|
||||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
|
||||||
|
|
||||||
g_object_class_install_properties (gobject_class, N_PROPS, properties);
|
g_object_class_install_properties (gobject_class, N_PROPS, properties);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2128,49 +2107,3 @@ gtk_column_view_get_tab_behavior (GtkColumnView *self)
|
|||||||
return gtk_list_view_get_tab_behavior (self->listview);
|
return gtk_list_view_get_tab_behavior (self->listview);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* gtk_column_view_get_header_factory: (attributes org.gtk.Method.get_property=header-factory)
|
|
||||||
* @self: a `GtkColumnView`
|
|
||||||
*
|
|
||||||
* Gets the factory that's currently used to populate section headers.
|
|
||||||
*
|
|
||||||
* Returns: (nullable) (transfer none): The factory in use
|
|
||||||
*
|
|
||||||
* Since: 4.12
|
|
||||||
*/
|
|
||||||
GtkListItemFactory *
|
|
||||||
gtk_column_view_get_header_factory (GtkColumnView *self)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (GTK_IS_COLUMN_VIEW (self), NULL);
|
|
||||||
|
|
||||||
return gtk_list_view_get_header_factory (self->listview);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gtk_column_view_set_header_factory: (attributes org.gtk.Method.set_property=header-factory)
|
|
||||||
* @self: a `GtkColumnView`
|
|
||||||
* @factory: (nullable) (transfer none): the factory to use
|
|
||||||
*
|
|
||||||
* Sets the `GtkListItemFactory` to use for populating the
|
|
||||||
* [class@Gtk.ListHeader] objects used in section headers.
|
|
||||||
*
|
|
||||||
* If this factory is set to %NULL, the list will not show
|
|
||||||
* section headers.
|
|
||||||
*
|
|
||||||
* Since: 4.12
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
gtk_column_view_set_header_factory (GtkColumnView *self,
|
|
||||||
GtkListItemFactory *factory)
|
|
||||||
{
|
|
||||||
g_return_if_fail (GTK_IS_COLUMN_VIEW (self));
|
|
||||||
g_return_if_fail (factory == NULL || GTK_IS_LIST_ITEM_FACTORY (factory));
|
|
||||||
|
|
||||||
if (factory == gtk_list_view_get_header_factory (self->listview))
|
|
||||||
return;
|
|
||||||
|
|
||||||
gtk_list_view_set_header_factory (self->listview, factory);
|
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_HEADER_FACTORY]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@@ -122,13 +122,5 @@ GDK_AVAILABLE_IN_4_12
|
|||||||
GtkListItemFactory *
|
GtkListItemFactory *
|
||||||
gtk_column_view_get_row_factory (GtkColumnView *self);
|
gtk_column_view_get_row_factory (GtkColumnView *self);
|
||||||
|
|
||||||
|
|
||||||
GDK_AVAILABLE_IN_4_12
|
|
||||||
void gtk_column_view_set_header_factory (GtkColumnView *self,
|
|
||||||
GtkListItemFactory *factory);
|
|
||||||
GDK_AVAILABLE_IN_4_12
|
|
||||||
GtkListItemFactory *
|
|
||||||
gtk_column_view_get_header_factory (GtkColumnView *self);
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#include "gtkcssimageprivate.h"
|
#include "gtkcssimageprivate.h"
|
||||||
#include "gtkcsspalettevalueprivate.h"
|
#include "gtkcsspalettevalueprivate.h"
|
||||||
#include "gtkcsscolorvalueprivate.h"
|
#include "gtkcsscolorvalueprivate.h"
|
||||||
#include "gdktextureutilsprivate.h"
|
#include "gdkpixbufutilsprivate.h"
|
||||||
|
|
||||||
#include "gtkstyleproviderprivate.h"
|
#include "gtkstyleproviderprivate.h"
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ gtk_css_image_recolor_load_texture (GtkCssImageRecolor *recolor,
|
|||||||
if (g_str_has_suffix (uri, ".symbolic.png"))
|
if (g_str_has_suffix (uri, ".symbolic.png"))
|
||||||
recolor->texture = gtk_load_symbolic_texture_from_resource (resource_path);
|
recolor->texture = gtk_load_symbolic_texture_from_resource (resource_path);
|
||||||
else
|
else
|
||||||
recolor->texture = gdk_texture_new_from_resource_symbolic (resource_path, 0, 0, 1.0, NULL);
|
recolor->texture = gtk_make_symbolic_texture_from_resource (resource_path, 0, 0, 1.0, NULL);
|
||||||
|
|
||||||
g_free (resource_path);
|
g_free (resource_path);
|
||||||
}
|
}
|
||||||
@@ -119,7 +119,7 @@ gtk_css_image_recolor_load_texture (GtkCssImageRecolor *recolor,
|
|||||||
if (g_str_has_suffix (uri, ".symbolic.png"))
|
if (g_str_has_suffix (uri, ".symbolic.png"))
|
||||||
recolor->texture = gtk_load_symbolic_texture_from_file (recolor->file);
|
recolor->texture = gtk_load_symbolic_texture_from_file (recolor->file);
|
||||||
else
|
else
|
||||||
recolor->texture = gdk_texture_new_from_file_symbolic (recolor->file, 0, 0, 1.0, NULL);
|
recolor->texture = gtk_make_symbolic_texture_from_file (recolor->file, 0, 0, 1.0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (uri);
|
g_free (uri);
|
||||||
|
|||||||
+15
-1
@@ -47,7 +47,21 @@ gtk_css_image_url_load_image (GtkCssImageUrl *url,
|
|||||||
return url->loaded_image;
|
return url->loaded_image;
|
||||||
}
|
}
|
||||||
|
|
||||||
texture = gdk_texture_new_from_file (url->file, &local_error);
|
/* We special case resources here so we can use gdk_texture_new_from_resource. */
|
||||||
|
if (g_file_has_uri_scheme (url->file, "resource"))
|
||||||
|
{
|
||||||
|
char *uri = g_file_get_uri (url->file);
|
||||||
|
char *resource_path = g_uri_unescape_string (uri + strlen ("resource://"), NULL);
|
||||||
|
|
||||||
|
texture = gdk_texture_new_from_resource (resource_path);
|
||||||
|
|
||||||
|
g_free (resource_path);
|
||||||
|
g_free (uri);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
texture = gdk_texture_new_from_file (url->file, &local_error);
|
||||||
|
}
|
||||||
|
|
||||||
if (texture == NULL)
|
if (texture == NULL)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
#include "gtkborder.h"
|
#include "gtkborder.h"
|
||||||
#include "gtktypes.h"
|
#include "gtktypes.h"
|
||||||
#include "gtkcssvalueprivate.h"
|
#include "gtkcssvalueprivate.h"
|
||||||
|
#include "gtkroundedboxprivate.h"
|
||||||
#include "gtksnapshot.h"
|
#include "gtksnapshot.h"
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|||||||
+4
-4
@@ -19,7 +19,7 @@
|
|||||||
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
||||||
* file for a list of people on the GTK+ Team. See the ChangeLog
|
* file for a list of people on the GTK+ Team. See the ChangeLog
|
||||||
* files for a list of changes. These files are distributed with
|
* files for a list of changes. These files are distributed with
|
||||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@@ -207,7 +207,7 @@ gtk_drag_source_set_property (GObject *object,
|
|||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
GtkDragSource *source = GTK_DRAG_SOURCE (object);
|
GtkDragSource *source = GTK_DRAG_SOURCE (object);
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_CONTENT:
|
case PROP_CONTENT:
|
||||||
@@ -424,13 +424,13 @@ gtk_drag_source_class_init (GtkDragSourceClass *class)
|
|||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
0,
|
0,
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
_gtk_marshal_VOID__OBJECT_BOOLEAN,
|
_gtk_marshal_OBJECT__BOOLEAN,
|
||||||
G_TYPE_NONE, 2,
|
G_TYPE_NONE, 2,
|
||||||
GDK_TYPE_DRAG,
|
GDK_TYPE_DRAG,
|
||||||
G_TYPE_BOOLEAN);
|
G_TYPE_BOOLEAN);
|
||||||
g_signal_set_va_marshaller (signals[DRAG_END],
|
g_signal_set_va_marshaller (signals[DRAG_END],
|
||||||
GTK_TYPE_DRAG_SOURCE,
|
GTK_TYPE_DRAG_SOURCE,
|
||||||
_gtk_marshal_VOID__OBJECT_BOOLEANv);
|
_gtk_marshal_OBJECT__BOOLEANv);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GtkDragSource::drag-cancel:
|
* GtkDragSource::drag-cancel:
|
||||||
|
|||||||
@@ -150,13 +150,13 @@ make_action_unique (GdkDragAction actions)
|
|||||||
|
|
||||||
if (actions & GDK_ACTION_MOVE)
|
if (actions & GDK_ACTION_MOVE)
|
||||||
return GDK_ACTION_MOVE;
|
return GDK_ACTION_MOVE;
|
||||||
|
|
||||||
if (actions & GDK_ACTION_LINK)
|
if (actions & GDK_ACTION_LINK)
|
||||||
return GDK_ACTION_LINK;
|
return GDK_ACTION_LINK;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GdkDragAction
|
static GdkDragAction
|
||||||
gtk_drop_target_async_drag_enter (GtkDropTargetAsync *self,
|
gtk_drop_target_async_drag_enter (GtkDropTargetAsync *self,
|
||||||
GdkDrop *drop,
|
GdkDrop *drop,
|
||||||
@@ -166,7 +166,7 @@ gtk_drop_target_async_drag_enter (GtkDropTargetAsync *self,
|
|||||||
return make_action_unique (self->actions & gdk_drop_get_actions (drop));
|
return make_action_unique (self->actions & gdk_drop_get_actions (drop));
|
||||||
}
|
}
|
||||||
|
|
||||||
static GdkDragAction
|
static GdkDragAction
|
||||||
gtk_drop_target_async_drag_motion (GtkDropTargetAsync *self,
|
gtk_drop_target_async_drag_motion (GtkDropTargetAsync *self,
|
||||||
GdkDrop *drop,
|
GdkDrop *drop,
|
||||||
double x,
|
double x,
|
||||||
@@ -457,12 +457,12 @@ gtk_drop_target_async_class_init (GtkDropTargetAsyncClass *class)
|
|||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
G_STRUCT_OFFSET (GtkDropTargetAsyncClass, drag_enter),
|
G_STRUCT_OFFSET (GtkDropTargetAsyncClass, drag_enter),
|
||||||
g_signal_accumulator_first_wins, NULL,
|
g_signal_accumulator_first_wins, NULL,
|
||||||
_gtk_marshal_FLAGS__OBJECT_DOUBLE_DOUBLE,
|
_gtk_marshal_ENUM__OBJECT_DOUBLE_DOUBLE,
|
||||||
GDK_TYPE_DRAG_ACTION, 3,
|
GDK_TYPE_DRAG_ACTION, 3,
|
||||||
GDK_TYPE_DROP, G_TYPE_DOUBLE, G_TYPE_DOUBLE);
|
GDK_TYPE_DROP, G_TYPE_DOUBLE, G_TYPE_DOUBLE);
|
||||||
g_signal_set_va_marshaller (signals[DRAG_ENTER],
|
g_signal_set_va_marshaller (signals[DRAG_ENTER],
|
||||||
GTK_TYPE_DROP_TARGET_ASYNC,
|
GTK_TYPE_DROP_TARGET_ASYNC,
|
||||||
_gtk_marshal_FLAGS__OBJECT_DOUBLE_DOUBLEv);
|
_gtk_marshal_ENUM__OBJECT_DOUBLE_DOUBLEv);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GtkDropTargetAsync::drag-motion:
|
* GtkDropTargetAsync::drag-motion:
|
||||||
@@ -481,12 +481,12 @@ gtk_drop_target_async_class_init (GtkDropTargetAsyncClass *class)
|
|||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
G_STRUCT_OFFSET (GtkDropTargetAsyncClass, drag_motion),
|
G_STRUCT_OFFSET (GtkDropTargetAsyncClass, drag_motion),
|
||||||
g_signal_accumulator_first_wins, NULL,
|
g_signal_accumulator_first_wins, NULL,
|
||||||
_gtk_marshal_FLAGS__OBJECT_DOUBLE_DOUBLE,
|
_gtk_marshal_ENUM__OBJECT_DOUBLE_DOUBLE,
|
||||||
GDK_TYPE_DRAG_ACTION, 3,
|
GDK_TYPE_DRAG_ACTION, 3,
|
||||||
GDK_TYPE_DROP, G_TYPE_DOUBLE, G_TYPE_DOUBLE);
|
GDK_TYPE_DROP, G_TYPE_DOUBLE, G_TYPE_DOUBLE);
|
||||||
g_signal_set_va_marshaller (signals[DRAG_MOTION],
|
g_signal_set_va_marshaller (signals[DRAG_MOTION],
|
||||||
GTK_TYPE_DROP_TARGET_ASYNC,
|
GTK_TYPE_DROP_TARGET_ASYNC,
|
||||||
_gtk_marshal_FLAGS__OBJECT_DOUBLE_DOUBLEv);
|
_gtk_marshal_ENUM__OBJECT_DOUBLE_DOUBLEv);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GtkDropTargetAsync::drag-leave:
|
* GtkDropTargetAsync::drag-leave:
|
||||||
@@ -617,7 +617,7 @@ GdkContentFormats *
|
|||||||
gtk_drop_target_async_get_formats (GtkDropTargetAsync *self)
|
gtk_drop_target_async_get_formats (GtkDropTargetAsync *self)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (GTK_IS_DROP_TARGET_ASYNC (self), NULL);
|
g_return_val_if_fail (GTK_IS_DROP_TARGET_ASYNC (self), NULL);
|
||||||
|
|
||||||
return self->formats;
|
return self->formats;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -633,7 +633,7 @@ gtk_drop_target_async_set_actions (GtkDropTargetAsync *self,
|
|||||||
GdkDragAction actions)
|
GdkDragAction actions)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GTK_IS_DROP_TARGET_ASYNC (self));
|
g_return_if_fail (GTK_IS_DROP_TARGET_ASYNC (self));
|
||||||
|
|
||||||
if (self->actions == actions)
|
if (self->actions == actions)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -69,9 +69,9 @@ typedef enum
|
|||||||
GTK_ALIGN_START,
|
GTK_ALIGN_START,
|
||||||
GTK_ALIGN_END,
|
GTK_ALIGN_END,
|
||||||
GTK_ALIGN_CENTER,
|
GTK_ALIGN_CENTER,
|
||||||
GTK_ALIGN_BASELINE_FILL GDK_AVAILABLE_ENUMERATOR_IN_4_12,
|
GTK_ALIGN_BASELINE_FILL,
|
||||||
GTK_ALIGN_BASELINE GDK_DEPRECATED_ENUMERATOR_IN_4_12_FOR(GTK_ALIGN_BASELINE_FILL) = GTK_ALIGN_BASELINE_FILL,
|
GTK_ALIGN_BASELINE GDK_DEPRECATED_ENUMERATOR_IN_4_12_FOR(GTK_ALIGN_BASELINE_FILL) = GTK_ALIGN_BASELINE_FILL,
|
||||||
GTK_ALIGN_BASELINE_CENTER GDK_AVAILABLE_ENUMERATOR_IN_4_12,
|
GTK_ALIGN_BASELINE_CENTER,
|
||||||
} GtkAlign;
|
} GtkAlign;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -410,22 +410,16 @@ gtk_event_controller_scroll_handle_event (GtkEventController *controller,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (ABS (scroll->cur_dx) >= 0.5)
|
if (ABS (scroll->cur_dx) >= 1)
|
||||||
{
|
{
|
||||||
steps = trunc (scroll->cur_dx);
|
steps = trunc (scroll->cur_dx);
|
||||||
if (steps == 0)
|
|
||||||
steps = (scroll->cur_dx > 0) ? 1 : -1;
|
|
||||||
|
|
||||||
scroll->cur_dx -= steps;
|
scroll->cur_dx -= steps;
|
||||||
dx = steps;
|
dx = steps;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ABS (scroll->cur_dy) >= 0.5)
|
if (ABS (scroll->cur_dy) >= 1)
|
||||||
{
|
{
|
||||||
steps = trunc (scroll->cur_dy);
|
steps = trunc (scroll->cur_dy);
|
||||||
if (steps == 0)
|
|
||||||
steps = (scroll->cur_dy > 0) ? 1 : -1;
|
|
||||||
|
|
||||||
scroll->cur_dy -= steps;
|
scroll->cur_dy -= steps;
|
||||||
dy = steps;
|
dy = steps;
|
||||||
}
|
}
|
||||||
@@ -465,22 +459,16 @@ gtk_event_controller_scroll_handle_event (GtkEventController *controller,
|
|||||||
scroll->cur_dy += dy;
|
scroll->cur_dy += dy;
|
||||||
dx = dy = 0;
|
dx = dy = 0;
|
||||||
|
|
||||||
if (ABS (scroll->cur_dx) >= 0.5)
|
if (ABS (scroll->cur_dx) >= 1)
|
||||||
{
|
{
|
||||||
steps = trunc (scroll->cur_dx);
|
steps = trunc (scroll->cur_dx);
|
||||||
if (steps == 0)
|
|
||||||
steps = (scroll->cur_dx > 0) ? 1 : -1;
|
|
||||||
|
|
||||||
scroll->cur_dx -= steps;
|
scroll->cur_dx -= steps;
|
||||||
dx = steps;
|
dx = steps;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ABS (scroll->cur_dy) >= 0.5)
|
if (ABS (scroll->cur_dy) >= 1)
|
||||||
{
|
{
|
||||||
steps = trunc (scroll->cur_dy);
|
steps = trunc (scroll->cur_dy);
|
||||||
if (steps == 0)
|
|
||||||
steps = (scroll->cur_dy > 0) ? 1 : -1;
|
|
||||||
|
|
||||||
scroll->cur_dy -= steps;
|
scroll->cur_dy -= steps;
|
||||||
dy = steps;
|
dy = steps;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -40,7 +40,7 @@
|
|||||||
* expanded widget yourself, such as when you want to actually create
|
* expanded widget yourself, such as when you want to actually create
|
||||||
* the widget at expansion time. In this case, create a `GtkExpander`
|
* the widget at expansion time. In this case, create a `GtkExpander`
|
||||||
* but do not add a child to it. The expander widget has an
|
* but do not add a child to it. The expander widget has an
|
||||||
* [property@Gtk.Expander:expanded] property which can be used to
|
* [property@Gtk.Expander:expanded[ property which can be used to
|
||||||
* monitor its expansion state. You should watch this property with
|
* monitor its expansion state. You should watch this property with
|
||||||
* a signal connection as follows:
|
* a signal connection as follows:
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ typedef struct {
|
|||||||
|
|
||||||
const char *method_name;
|
const char *method_name;
|
||||||
|
|
||||||
char *exported_handle;
|
|
||||||
GtkWindow *exported_window;
|
GtkWindow *exported_window;
|
||||||
PortalErrorHandler error_handler;
|
PortalErrorHandler error_handler;
|
||||||
} FilechooserPortalData;
|
} FilechooserPortalData;
|
||||||
@@ -80,11 +79,7 @@ filechooser_portal_data_clear (FilechooserPortalData *data)
|
|||||||
|
|
||||||
if (data->exported_window)
|
if (data->exported_window)
|
||||||
{
|
{
|
||||||
if (data->exported_handle)
|
gtk_window_unexport_handle (data->exported_window);
|
||||||
{
|
|
||||||
gtk_window_unexport_handle (data->exported_window, data->exported_handle);
|
|
||||||
g_clear_pointer (&data->exported_handle, g_free);
|
|
||||||
}
|
|
||||||
g_clear_object (&data->exported_window);
|
g_clear_object (&data->exported_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -465,7 +460,6 @@ window_handle_exported (GtkWindow *window,
|
|||||||
gtk_grab_add (GTK_WIDGET (data->grab_widget));
|
gtk_grab_add (GTK_WIDGET (data->grab_widget));
|
||||||
}
|
}
|
||||||
|
|
||||||
data->exported_handle = g_strdup (handle_str);
|
|
||||||
show_portal_file_chooser (self, handle_str);
|
show_portal_file_chooser (self, handle_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -580,10 +580,7 @@ gtk_file_chooser_widget_finalize (GObject *object)
|
|||||||
stop_loading_and_clear_list_model (impl, FALSE);
|
stop_loading_and_clear_list_model (impl, FALSE);
|
||||||
search_clear_model (impl, FALSE);
|
search_clear_model (impl, FALSE);
|
||||||
recent_clear_model (impl, FALSE);
|
recent_clear_model (impl, FALSE);
|
||||||
g_clear_object (&impl->recent_model);
|
|
||||||
g_clear_object (&impl->search_model);
|
|
||||||
g_clear_object (&impl->model_for_search);
|
g_clear_object (&impl->model_for_search);
|
||||||
g_clear_object (&impl->browse_files_model);
|
|
||||||
|
|
||||||
g_clear_object (&impl->selection_model);
|
g_clear_object (&impl->selection_model);
|
||||||
g_clear_object (&impl->sort_model);
|
g_clear_object (&impl->sort_model);
|
||||||
@@ -3964,7 +3961,6 @@ set_list_model (GtkFileChooserWidget *impl,
|
|||||||
|
|
||||||
set_busy_cursor (impl, TRUE);
|
set_busy_cursor (impl, TRUE);
|
||||||
|
|
||||||
g_clear_object (&impl->browse_files_model);
|
|
||||||
impl->browse_files_model =
|
impl->browse_files_model =
|
||||||
_gtk_file_system_model_new_for_directory (impl->current_folder, MODEL_ATTRIBUTES);
|
_gtk_file_system_model_new_for_directory (impl->current_folder, MODEL_ATTRIBUTES);
|
||||||
|
|
||||||
|
|||||||
+14
-13
@@ -229,9 +229,9 @@ open_done (GObject *source,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
show_item_done (GObject *source,
|
show_folder_done (GObject *source,
|
||||||
GAsyncResult *result,
|
GAsyncResult *result,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GDBusConnection *bus = G_DBUS_CONNECTION (source);
|
GDBusConnection *bus = G_DBUS_CONNECTION (source);
|
||||||
GTask *task = G_TASK (data);
|
GTask *task = G_TASK (data);
|
||||||
@@ -261,10 +261,11 @@ show_item_done (GObject *source,
|
|||||||
#define FILE_MANAGER_DBUS_PATH "/org/freedesktop/FileManager1"
|
#define FILE_MANAGER_DBUS_PATH "/org/freedesktop/FileManager1"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
show_item (GtkWindow *parent,
|
show_folder (GtkWindow *parent,
|
||||||
const char *uri,
|
const char *uri,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GTask *task)
|
GAsyncReadyCallback callback,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GDBusConnection *bus;
|
GDBusConnection *bus;
|
||||||
GVariantBuilder uris_builder = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE_STRING_ARRAY);
|
GVariantBuilder uris_builder = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE_STRING_ARRAY);
|
||||||
@@ -273,10 +274,10 @@ show_item (GtkWindow *parent,
|
|||||||
|
|
||||||
if (!bus)
|
if (!bus)
|
||||||
{
|
{
|
||||||
g_task_return_new_error (task,
|
g_task_return_new_error (G_TASK (user_data),
|
||||||
GTK_DIALOG_ERROR, GTK_DIALOG_ERROR_FAILED,
|
GTK_DIALOG_ERROR, GTK_DIALOG_ERROR_FAILED,
|
||||||
"Session bus not available");
|
"Session bus not available");
|
||||||
g_object_unref (task);
|
g_object_unref (G_TASK (user_data));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -286,14 +287,14 @@ show_item (GtkWindow *parent,
|
|||||||
FILE_MANAGER_DBUS_NAME,
|
FILE_MANAGER_DBUS_NAME,
|
||||||
FILE_MANAGER_DBUS_PATH,
|
FILE_MANAGER_DBUS_PATH,
|
||||||
FILE_MANAGER_DBUS_IFACE,
|
FILE_MANAGER_DBUS_IFACE,
|
||||||
"ShowItems",
|
"ShowFolders",
|
||||||
g_variant_new ("(ass)", &uris_builder, ""),
|
g_variant_new ("(ass)", &uris_builder, ""),
|
||||||
NULL, /* ignore returned type */
|
NULL, /* ignore returned type */
|
||||||
G_DBUS_CALL_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
cancellable,
|
cancellable,
|
||||||
show_item_done,
|
show_folder_done,
|
||||||
task);
|
user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||||
@@ -469,7 +470,7 @@ gtk_file_launcher_open_containing_folder (GtkFileLauncher *self,
|
|||||||
{
|
{
|
||||||
char *uri = g_file_get_uri (self->file);
|
char *uri = g_file_get_uri (self->file);
|
||||||
|
|
||||||
show_item (parent, uri, cancellable, task);
|
show_folder (parent, uri, cancellable, show_folder_done, task);
|
||||||
|
|
||||||
g_free (uri);
|
g_free (uri);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -747,9 +747,7 @@ gtk_file_system_model_monitor_change (GFileMonitor * monitor,
|
|||||||
case G_FILE_MONITOR_EVENT_CREATED:
|
case G_FILE_MONITOR_EVENT_CREATED:
|
||||||
case G_FILE_MONITOR_EVENT_CHANGED:
|
case G_FILE_MONITOR_EVENT_CHANGED:
|
||||||
case G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED:
|
case G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED:
|
||||||
if (g_file_equal (file, model->dir))
|
/* We can treat all of these the same way */
|
||||||
return;
|
|
||||||
/* We can treat all children the same way */
|
|
||||||
g_file_query_info_async (file,
|
g_file_query_info_async (file,
|
||||||
model->attributes,
|
model->attributes,
|
||||||
G_FILE_QUERY_INFO_NONE,
|
G_FILE_QUERY_INFO_NONE,
|
||||||
|
|||||||
@@ -34,11 +34,9 @@
|
|||||||
* It hides some elements from the other model according to
|
* It hides some elements from the other model according to
|
||||||
* criteria given by a `GtkFilter`.
|
* criteria given by a `GtkFilter`.
|
||||||
*
|
*
|
||||||
* The model can be set up to do incremental filtering, so that
|
* The model can be set up to do incremental searching, so that
|
||||||
* filtering long lists doesn't block the UI. See
|
* filtering long lists doesn't block the UI. See
|
||||||
* [method@Gtk.FilterListModel.set_incremental] for details.
|
* [method@Gtk.FilterListModel.set_incremental] for details.
|
||||||
*
|
|
||||||
* `GtkFilterListModel` passes through sections from the underlying model.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@@ -190,39 +188,6 @@ gtk_filter_list_model_get_section (GtkSectionModel *model,
|
|||||||
*out_end = *out_start + gtk_bitset_get_size_in_range (self->matches, start, end - 1);
|
*out_end = *out_start + gtk_bitset_get_size_in_range (self->matches, start, end - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_filter_list_model_sections_changed_cb (GtkSectionModel *model,
|
|
||||||
unsigned int position,
|
|
||||||
unsigned int n_items,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
GtkFilterListModel *self = GTK_FILTER_LIST_MODEL (user_data);
|
|
||||||
unsigned int start, end;
|
|
||||||
|
|
||||||
switch (self->strictness)
|
|
||||||
{
|
|
||||||
case GTK_FILTER_MATCH_NONE:
|
|
||||||
return;
|
|
||||||
|
|
||||||
case GTK_FILTER_MATCH_ALL:
|
|
||||||
gtk_section_model_sections_changed (GTK_SECTION_MODEL (self), position, n_items);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GTK_FILTER_MATCH_SOME:
|
|
||||||
if (position > 0)
|
|
||||||
start = gtk_bitset_get_size_in_range (self->matches, 0, position - 1);
|
|
||||||
else
|
|
||||||
start = 0;
|
|
||||||
end = gtk_bitset_get_size_in_range (self->matches, 0, position + n_items - 1);
|
|
||||||
if (end - start > 0)
|
|
||||||
gtk_section_model_sections_changed (GTK_SECTION_MODEL (self), start, end - start);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
g_assert_not_reached ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_filter_list_model_section_model_init (GtkSectionModelInterface *iface)
|
gtk_filter_list_model_section_model_init (GtkSectionModelInterface *iface)
|
||||||
{
|
{
|
||||||
@@ -498,7 +463,6 @@ gtk_filter_list_model_clear_model (GtkFilterListModel *self)
|
|||||||
|
|
||||||
gtk_filter_list_model_stop_filtering (self);
|
gtk_filter_list_model_stop_filtering (self);
|
||||||
g_signal_handlers_disconnect_by_func (self->model, gtk_filter_list_model_items_changed_cb, self);
|
g_signal_handlers_disconnect_by_func (self->model, gtk_filter_list_model_items_changed_cb, self);
|
||||||
g_signal_handlers_disconnect_by_func (self->model, gtk_filter_list_model_sections_changed_cb, self);
|
|
||||||
g_clear_object (&self->model);
|
g_clear_object (&self->model);
|
||||||
if (self->matches)
|
if (self->matches)
|
||||||
gtk_bitset_remove_all (self->matches);
|
gtk_bitset_remove_all (self->matches);
|
||||||
@@ -863,8 +827,6 @@ gtk_filter_list_model_set_model (GtkFilterListModel *self,
|
|||||||
{
|
{
|
||||||
self->model = g_object_ref (model);
|
self->model = g_object_ref (model);
|
||||||
g_signal_connect (model, "items-changed", G_CALLBACK (gtk_filter_list_model_items_changed_cb), self);
|
g_signal_connect (model, "items-changed", G_CALLBACK (gtk_filter_list_model_items_changed_cb), self);
|
||||||
if (GTK_IS_SECTION_MODEL (model))
|
|
||||||
g_signal_connect (model, "sections-changed", G_CALLBACK (gtk_filter_list_model_sections_changed_cb), self);
|
|
||||||
if (removed == 0)
|
if (removed == 0)
|
||||||
{
|
{
|
||||||
self->strictness = GTK_FILTER_MATCH_NONE;
|
self->strictness = GTK_FILTER_MATCH_NONE;
|
||||||
|
|||||||
@@ -29,8 +29,8 @@
|
|||||||
*
|
*
|
||||||
* `GtkFlattenListModel` is a list model that concatenates other list models.
|
* `GtkFlattenListModel` is a list model that concatenates other list models.
|
||||||
*
|
*
|
||||||
* `GtkFlattenListModel` takes a list model containing list models, and flattens
|
* `GtkFlattenListModel` takes a list model containing list models,
|
||||||
* it into a single model. Each list model becomes a section in the single model.
|
* and flattens it into a single model.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
|||||||
+68
-146
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include "gtkgridviewprivate.h"
|
#include "gtkgridview.h"
|
||||||
|
|
||||||
#include "gtkbitset.h"
|
#include "gtkbitset.h"
|
||||||
#include "gtklistbaseprivate.h"
|
#include "gtklistbaseprivate.h"
|
||||||
@@ -384,37 +384,6 @@ gtk_grid_view_get_allocation (GtkListBase *base,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns the column that the given item will fall in.
|
|
||||||
*/
|
|
||||||
unsigned int
|
|
||||||
gtk_grid_view_get_column_for_position (GtkListItemManager *items,
|
|
||||||
unsigned int n_columns,
|
|
||||||
unsigned int position)
|
|
||||||
{
|
|
||||||
return position % n_columns;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Determine whether a tile is contained in a single row,
|
|
||||||
* or spans multiple rows.
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
gtk_grid_view_is_multirow_tile (GtkListItemManager *items,
|
|
||||||
unsigned int n_columns,
|
|
||||||
GtkListTile *tile)
|
|
||||||
{
|
|
||||||
unsigned int position;
|
|
||||||
unsigned int col;
|
|
||||||
|
|
||||||
if (tile->n_items <= 1)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
position = gtk_list_tile_get_position (items, tile);
|
|
||||||
|
|
||||||
col = position % n_columns;
|
|
||||||
|
|
||||||
return col + tile->n_items > n_columns;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gtk_grid_view_get_position_from_allocation (GtkListBase *base,
|
gtk_grid_view_get_position_from_allocation (GtkListBase *base,
|
||||||
int x,
|
int x,
|
||||||
@@ -425,7 +394,6 @@ gtk_grid_view_get_position_from_allocation (GtkListBase *base,
|
|||||||
GtkGridView *self = GTK_GRID_VIEW (base);
|
GtkGridView *self = GTK_GRID_VIEW (base);
|
||||||
GtkListTile *tile;
|
GtkListTile *tile;
|
||||||
guint pos;
|
guint pos;
|
||||||
guint col;
|
|
||||||
|
|
||||||
tile = gtk_list_item_manager_get_nearest_tile (self->item_manager, x, y);
|
tile = gtk_list_item_manager_get_nearest_tile (self->item_manager, x, y);
|
||||||
if (tile == NULL)
|
if (tile == NULL)
|
||||||
@@ -443,43 +411,44 @@ gtk_grid_view_get_position_from_allocation (GtkListBase *base,
|
|||||||
}
|
}
|
||||||
|
|
||||||
pos = gtk_list_tile_get_position (self->item_manager, tile);
|
pos = gtk_list_tile_get_position (self->item_manager, tile);
|
||||||
col = gtk_grid_view_get_column_for_position (self->item_manager, self->n_columns, pos);
|
|
||||||
|
|
||||||
if (tile->n_items > 1)
|
if (tile->n_items > 1)
|
||||||
{
|
{
|
||||||
int xspacing, yspacing;
|
int xspacing, yspacing;
|
||||||
unsigned int row_height;
|
|
||||||
unsigned int row_index;
|
|
||||||
|
|
||||||
gtk_list_base_get_border_spacing (base, &xspacing, &yspacing);
|
gtk_list_base_get_border_spacing (base, &xspacing, &yspacing);
|
||||||
|
|
||||||
/* offset in x direction */
|
/* offset in x direction */
|
||||||
pos += column_index (self, xspacing, MAX (tile->area.width - 1, x - tile->area.x));
|
pos += column_index (self, xspacing, MAX (tile->area.width - 1, x - tile->area.x));
|
||||||
|
if (area)
|
||||||
|
{
|
||||||
|
guint col = MIN (column_index (self, xspacing, x), self->n_columns - 1);
|
||||||
|
area->x = column_start (self, xspacing, col);
|
||||||
|
area->width = column_end (self, xspacing, col) - area->x;
|
||||||
|
}
|
||||||
|
|
||||||
/* offset in y direction */
|
/* offset in y direction */
|
||||||
if (tile->n_items > self->n_columns)
|
if (tile->n_items > self->n_columns)
|
||||||
{
|
{
|
||||||
guint rows_in_tile = tile->n_items / self->n_columns;
|
guint rows_in_tile = tile->n_items / self->n_columns;
|
||||||
|
guint row_height = (tile->area.height + yspacing) / rows_in_tile - yspacing;
|
||||||
row_height = (tile->area.height + yspacing) / rows_in_tile - yspacing;
|
guint row_index = MIN (tile->area.height - 1, y - tile->area.y) / (row_height + yspacing);
|
||||||
row_index = MIN (tile->area.height - 1, y - tile->area.y) / (row_height + yspacing);
|
|
||||||
pos += self->n_columns * row_index;
|
pos += self->n_columns * row_index;
|
||||||
|
|
||||||
|
if (area)
|
||||||
|
{
|
||||||
|
area->y = tile->area.y + row_index * (row_height + yspacing);
|
||||||
|
area->height = row_height;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
row_height = tile->area.height;
|
if (area)
|
||||||
row_index = 0;
|
{
|
||||||
|
area->y = tile->area.y;
|
||||||
|
area->height = tile->area.height;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
col = gtk_grid_view_get_column_for_position (self->item_manager, self->n_columns, pos);
|
|
||||||
|
|
||||||
if (area)
|
|
||||||
{
|
|
||||||
area->x = column_start (self, xspacing, col);
|
|
||||||
area->y = tile->area.y + row_index * (row_height + yspacing);
|
|
||||||
area->width = column_end (self, xspacing, col) - area->x;
|
|
||||||
area->height = row_height;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -688,7 +657,7 @@ gtk_grid_view_measure_list (GtkWidget *widget,
|
|||||||
gtk_grid_view_measure_column_size (self, &col_min, &col_nat);
|
gtk_grid_view_measure_column_size (self, &col_min, &col_nat);
|
||||||
for_size = MAX (for_size, col_min * (int) self->min_columns);
|
for_size = MAX (for_size, col_min * (int) self->min_columns);
|
||||||
n_columns = gtk_grid_view_compute_n_columns (self, for_size, xspacing, col_min, col_nat);
|
n_columns = gtk_grid_view_compute_n_columns (self, for_size, xspacing, col_min, col_nat);
|
||||||
column_size = (for_size + xspacing) / n_columns - xspacing;
|
column_size = for_size / n_columns;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
row_height = 0;
|
row_height = 0;
|
||||||
@@ -767,48 +736,6 @@ gtk_grid_view_measure (GtkWidget *widget,
|
|||||||
gtk_grid_view_measure_across (widget, for_size, minimum, natural);
|
gtk_grid_view_measure_across (widget, for_size, minimum, natural);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
gtk_grid_view_split_tiles_by_columns (GtkListItemManager *items,
|
|
||||||
guint n_columns)
|
|
||||||
{
|
|
||||||
GtkListTile *tile;
|
|
||||||
|
|
||||||
for (tile = gtk_list_item_manager_get_first (items);
|
|
||||||
tile != NULL;
|
|
||||||
tile = gtk_rb_tree_node_get_next (tile))
|
|
||||||
{
|
|
||||||
if (tile->n_items > 1)
|
|
||||||
{
|
|
||||||
guint pos, col;
|
|
||||||
guint remaining;
|
|
||||||
|
|
||||||
pos = gtk_list_tile_get_position (items, tile);
|
|
||||||
col = gtk_grid_view_get_column_for_position (items, n_columns, pos);
|
|
||||||
|
|
||||||
if (col > 0)
|
|
||||||
{
|
|
||||||
/* Determine if the first row needs to be split off */
|
|
||||||
remaining = n_columns - col;
|
|
||||||
if (remaining > 0 && tile->n_items > remaining)
|
|
||||||
gtk_list_tile_split (items, tile, remaining);
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
pos += tile->n_items - 1;
|
|
||||||
col = gtk_grid_view_get_column_for_position (items, n_columns, pos);
|
|
||||||
|
|
||||||
if (col < n_columns - 1)
|
|
||||||
{
|
|
||||||
/* Determine if the last row needs to be split off */
|
|
||||||
remaining = n_columns - (col - 1);
|
|
||||||
if (remaining > 0 && col + 1 < tile->n_items)
|
|
||||||
tile = gtk_list_tile_split (items, tile, tile->n_items - (col + 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_grid_view_size_allocate (GtkWidget *widget,
|
gtk_grid_view_size_allocate (GtkWidget *widget,
|
||||||
int width,
|
int width,
|
||||||
@@ -829,10 +756,8 @@ gtk_grid_view_size_allocate (GtkWidget *widget,
|
|||||||
min_row_height = ceil ((double) height / GTK_GRID_VIEW_MAX_VISIBLE_ROWS);
|
min_row_height = ceil ((double) height / GTK_GRID_VIEW_MAX_VISIBLE_ROWS);
|
||||||
gtk_list_base_get_border_spacing (GTK_LIST_BASE (self), &xspacing, &yspacing);
|
gtk_list_base_get_border_spacing (GTK_LIST_BASE (self), &xspacing, &yspacing);
|
||||||
|
|
||||||
gtk_list_item_manager_gc_tiles (self->item_manager);
|
|
||||||
|
|
||||||
/* step 0: exit early if list is empty */
|
/* step 0: exit early if list is empty */
|
||||||
tile = gtk_list_item_manager_get_first (self->item_manager);
|
tile = gtk_list_tile_gc (self->item_manager, gtk_list_item_manager_get_first (self->item_manager));
|
||||||
if (tile == NULL)
|
if (tile == NULL)
|
||||||
{
|
{
|
||||||
gtk_list_base_allocate (GTK_LIST_BASE (self));
|
gtk_list_base_allocate (GTK_LIST_BASE (self));
|
||||||
@@ -845,29 +770,32 @@ gtk_grid_view_size_allocate (GtkWidget *widget,
|
|||||||
orientation == GTK_ORIENTATION_VERTICAL ? width : height,
|
orientation == GTK_ORIENTATION_VERTICAL ? width : height,
|
||||||
xspacing,
|
xspacing,
|
||||||
col_min, col_nat);
|
col_min, col_nat);
|
||||||
self->column_width = ((orientation == GTK_ORIENTATION_VERTICAL ? width : height) + xspacing) / self->n_columns - xspacing;
|
self->column_width = (orientation == GTK_ORIENTATION_VERTICAL ? width : height) / self->n_columns;
|
||||||
self->column_width = MAX (self->column_width, col_min);
|
self->column_width = MAX (self->column_width, col_min);
|
||||||
|
|
||||||
/* step 2: split tiles as required */
|
/* step 2: determine height of known rows */
|
||||||
gtk_grid_view_split_tiles_by_columns (self->item_manager, self->n_columns);
|
|
||||||
|
|
||||||
/* step 3: determine height of known rows */
|
|
||||||
heights = g_array_new (FALSE, FALSE, sizeof (int));
|
heights = g_array_new (FALSE, FALSE, sizeof (int));
|
||||||
|
|
||||||
tile = gtk_list_item_manager_get_first (self->item_manager);
|
for (;
|
||||||
while (tile != NULL)
|
tile != NULL;
|
||||||
|
tile = gtk_list_tile_gc (self->item_manager, tile))
|
||||||
{
|
{
|
||||||
if (gtk_grid_view_is_multirow_tile (self->item_manager, self->n_columns, tile))
|
/* if it's a multirow tile, handle it here */
|
||||||
|
if (tile->n_items > 1 && tile->n_items >= self->n_columns)
|
||||||
{
|
{
|
||||||
|
if (tile->n_items % self->n_columns)
|
||||||
|
gtk_list_tile_split (self->item_manager, tile, tile->n_items / self->n_columns * self->n_columns);
|
||||||
tile = gtk_rb_tree_node_get_next (tile);
|
tile = gtk_rb_tree_node_get_next (tile);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Not a multirow tile */
|
||||||
|
i = 0;
|
||||||
row_height = 0;
|
row_height = 0;
|
||||||
|
|
||||||
for (i = 0, start = tile;
|
for (i = 0, start = tile;
|
||||||
i < self->n_columns && tile != NULL;
|
i < self->n_columns && tile != NULL;
|
||||||
tile = gtk_rb_tree_node_get_next (tile))
|
tile = gtk_list_tile_gc (self->item_manager, gtk_rb_tree_node_get_next (tile)))
|
||||||
{
|
{
|
||||||
if (tile->widget)
|
if (tile->widget)
|
||||||
{
|
{
|
||||||
@@ -884,53 +812,32 @@ gtk_grid_view_size_allocate (GtkWidget *widget,
|
|||||||
g_array_append_val (heights, size);
|
g_array_append_val (heights, size);
|
||||||
row_height = MAX (row_height, size);
|
row_height = MAX (row_height, size);
|
||||||
}
|
}
|
||||||
|
if (tile->n_items > self->n_columns - i)
|
||||||
|
gtk_list_tile_split (self->item_manager, tile, self->n_columns - i);
|
||||||
i += tile->n_items;
|
i += tile->n_items;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (row_height > 0)
|
if (row_height > 0)
|
||||||
{
|
{
|
||||||
for (i = 0;
|
for (i = 0;
|
||||||
start != tile;
|
start != tile;
|
||||||
start = gtk_rb_tree_node_get_next (start))
|
start = gtk_rb_tree_node_get_next (start))
|
||||||
{
|
{
|
||||||
unsigned int n_columns;
|
|
||||||
unsigned int tile_height;
|
|
||||||
|
|
||||||
if (gtk_list_tile_is_footer (start))
|
|
||||||
{
|
|
||||||
n_columns = self->n_columns - i;
|
|
||||||
if (n_columns != 0 && n_columns != self->n_columns)
|
|
||||||
tile_height = row_height;
|
|
||||||
else
|
|
||||||
tile_height = 0;
|
|
||||||
}
|
|
||||||
else if (gtk_list_tile_is_header (start))
|
|
||||||
{
|
|
||||||
n_columns = self->n_columns;
|
|
||||||
tile_height = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
n_columns = start->n_items;
|
|
||||||
tile_height = row_height;
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_list_tile_set_area_size (self->item_manager,
|
gtk_list_tile_set_area_size (self->item_manager,
|
||||||
start,
|
start,
|
||||||
column_end (self, xspacing, i + n_columns - 1)
|
column_end (self, xspacing, i + start->n_items - 1)
|
||||||
- column_start (self, xspacing, i),
|
- column_start (self, xspacing, i),
|
||||||
tile_height);
|
row_height);
|
||||||
|
i += start->n_items;
|
||||||
i = (i + start->n_items) % self->n_columns;
|
|
||||||
}
|
}
|
||||||
|
g_assert (i <= self->n_columns);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* step 4: determine height of rows with only unknown items */
|
/* step 3: determine height of rows with only unknown items */
|
||||||
unknown_row_height = gtk_grid_view_get_unknown_row_size (self, heights);
|
unknown_row_height = gtk_grid_view_get_unknown_row_size (self, heights);
|
||||||
g_array_free (heights, TRUE);
|
g_array_free (heights, TRUE);
|
||||||
|
|
||||||
/* step 5: determine height for remaining rows and set each row's position */
|
/* step 4: determine height for remaining rows and set each row's position */
|
||||||
y = 0;
|
y = 0;
|
||||||
i = 0;
|
i = 0;
|
||||||
for (tile = gtk_list_item_manager_get_first (self->item_manager);
|
for (tile = gtk_list_item_manager_get_first (self->item_manager);
|
||||||
@@ -941,8 +848,7 @@ gtk_grid_view_size_allocate (GtkWidget *widget,
|
|||||||
tile,
|
tile,
|
||||||
column_start (self, xspacing, i),
|
column_start (self, xspacing, i),
|
||||||
y);
|
y);
|
||||||
|
if (tile->n_items >= self->n_columns && tile->widget == NULL)
|
||||||
if (gtk_grid_view_is_multirow_tile (self->item_manager, self->n_columns, tile))
|
|
||||||
{
|
{
|
||||||
g_assert (i == 0);
|
g_assert (i == 0);
|
||||||
g_assert (tile->n_items % self->n_columns == 0);
|
g_assert (tile->n_items % self->n_columns == 0);
|
||||||
@@ -955,10 +861,15 @@ gtk_grid_view_size_allocate (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gtk_list_tile_set_area_size (self->item_manager,
|
if (tile->area.height == 0)
|
||||||
tile,
|
{
|
||||||
column_end (self, xspacing, i + tile->n_items - 1) - tile->area.x,
|
/* this case is for the last row - it may not be a full row so it won't
|
||||||
unknown_row_height);
|
* be a multirow tile but it may have no widgets either */
|
||||||
|
gtk_list_tile_set_area_size (self->item_manager,
|
||||||
|
tile,
|
||||||
|
column_end (self, xspacing, i + tile->n_items - 1) - tile->area.x,
|
||||||
|
unknown_row_height);
|
||||||
|
}
|
||||||
i += tile->n_items;
|
i += tile->n_items;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -969,8 +880,23 @@ gtk_grid_view_size_allocate (GtkWidget *widget,
|
|||||||
i = 0;
|
i = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* Add a filler tile for empty space in the bottom right */
|
||||||
|
if (i > 0)
|
||||||
|
{
|
||||||
|
GtkListTile *filler;
|
||||||
|
tile = gtk_list_item_manager_get_last (self->item_manager);
|
||||||
|
filler = gtk_list_tile_append_filler (self->item_manager, tile);
|
||||||
|
gtk_list_tile_set_area_position (self->item_manager,
|
||||||
|
filler,
|
||||||
|
column_start (self, xspacing, i),
|
||||||
|
y);
|
||||||
|
gtk_list_tile_set_area_size (self->item_manager,
|
||||||
|
filler,
|
||||||
|
column_end (self, xspacing, self->n_columns - 1) - filler->area.x,
|
||||||
|
tile->area.height);
|
||||||
|
}
|
||||||
|
|
||||||
/* step 6: allocate the rest */
|
/* step 4: allocate the rest */
|
||||||
gtk_list_base_allocate (GTK_LIST_BASE (self));
|
gtk_list_base_allocate (GTK_LIST_BASE (self));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1025,8 +951,6 @@ gtk_grid_view_dispose (GObject *object)
|
|||||||
|
|
||||||
self->item_manager = NULL;
|
self->item_manager = NULL;
|
||||||
|
|
||||||
g_clear_object (&self->factory);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (gtk_grid_view_parent_class)->dispose (object);
|
G_OBJECT_CLASS (gtk_grid_view_parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1411,8 +1335,6 @@ gtk_grid_view_set_factory (GtkGridView *self,
|
|||||||
if (!g_set_object (&self->factory, factory))
|
if (!g_set_object (&self->factory, factory))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gtk_grid_view_update_factories (self);
|
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_FACTORY]);
|
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_FACTORY]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright © 2023 Red Hat, Inc.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "gtk/gtktypes.h"
|
|
||||||
#include "gtk/gtkenums.h"
|
|
||||||
#include "gtk/gtkgridview.h"
|
|
||||||
#include "gtk/gtklistitemmanagerprivate.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
unsigned int gtk_grid_view_get_column_for_position (GtkListItemManager *items,
|
|
||||||
unsigned int n_columns,
|
|
||||||
unsigned int position);
|
|
||||||
|
|
||||||
gboolean gtk_grid_view_is_multirow_tile (GtkListItemManager *items,
|
|
||||||
unsigned int n_columns,
|
|
||||||
GtkListTile *tile);
|
|
||||||
|
|
||||||
void gtk_grid_view_split_tiles_by_columns (GtkListItemManager *items,
|
|
||||||
guint n_columns);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
@@ -20,7 +20,6 @@
|
|||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <gdk-pixbuf/gdk-pixdata.h>
|
#include <gdk-pixbuf/gdk-pixdata.h>
|
||||||
|
|
||||||
#if defined(G_ENABLE_DEBUG) || defined(BUILD_TOOLS)
|
|
||||||
|
|
||||||
#define VERBOSE(x)
|
#define VERBOSE(x)
|
||||||
|
|
||||||
@@ -402,4 +401,3 @@ gtk_icon_cache_validate (CacheInfo *info)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
+40
-14
@@ -51,7 +51,7 @@
|
|||||||
#include "gtkstyleproviderprivate.h"
|
#include "gtkstyleproviderprivate.h"
|
||||||
#include "gtksymbolicpaintable.h"
|
#include "gtksymbolicpaintable.h"
|
||||||
#include "gtkwidgetprivate.h"
|
#include "gtkwidgetprivate.h"
|
||||||
#include "gdktextureutilsprivate.h"
|
#include "gdkpixbufutilsprivate.h"
|
||||||
#include "gdk/gdktextureprivate.h"
|
#include "gdk/gdktextureprivate.h"
|
||||||
#include "gdk/gdkprofilerprivate.h"
|
#include "gdk/gdkprofilerprivate.h"
|
||||||
|
|
||||||
@@ -3747,15 +3747,22 @@ icon_ensure_texture__locked (GtkIconPaintable *icon,
|
|||||||
{
|
{
|
||||||
if (icon->is_svg)
|
if (icon->is_svg)
|
||||||
{
|
{
|
||||||
|
GdkPixbuf *source_pixbuf;
|
||||||
|
|
||||||
if (gtk_icon_paintable_is_symbolic (icon))
|
if (gtk_icon_paintable_is_symbolic (icon))
|
||||||
icon->texture = gdk_texture_new_from_resource_symbolic (icon->filename,
|
source_pixbuf = gtk_make_symbolic_pixbuf_from_resource (icon->filename,
|
||||||
pixel_size, pixel_size,
|
pixel_size, pixel_size,
|
||||||
icon->desired_scale,
|
icon->desired_scale,
|
||||||
&load_error);
|
&load_error);
|
||||||
else
|
else
|
||||||
icon->texture = gdk_texture_new_from_resource_at_scale (icon->filename,
|
source_pixbuf = _gdk_pixbuf_new_from_resource_at_scale (icon->filename,
|
||||||
pixel_size, pixel_size,
|
pixel_size, pixel_size,
|
||||||
TRUE, &load_error);
|
TRUE, &load_error);
|
||||||
|
if (source_pixbuf)
|
||||||
|
{
|
||||||
|
icon->texture = gdk_texture_new_for_pixbuf (source_pixbuf);
|
||||||
|
g_object_unref (source_pixbuf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
icon->texture = gdk_texture_new_from_resource (icon->filename);
|
icon->texture = gdk_texture_new_from_resource (icon->filename);
|
||||||
@@ -3764,8 +3771,10 @@ icon_ensure_texture__locked (GtkIconPaintable *icon,
|
|||||||
{
|
{
|
||||||
if (icon->is_svg)
|
if (icon->is_svg)
|
||||||
{
|
{
|
||||||
|
GdkPixbuf *source_pixbuf;
|
||||||
|
|
||||||
if (gtk_icon_paintable_is_symbolic (icon))
|
if (gtk_icon_paintable_is_symbolic (icon))
|
||||||
icon->texture = gdk_texture_new_from_path_symbolic (icon->filename,
|
source_pixbuf = gtk_make_symbolic_pixbuf_from_path (icon->filename,
|
||||||
pixel_size, pixel_size,
|
pixel_size, pixel_size,
|
||||||
icon->desired_scale,
|
icon->desired_scale,
|
||||||
&load_error);
|
&load_error);
|
||||||
@@ -3774,16 +3783,22 @@ icon_ensure_texture__locked (GtkIconPaintable *icon,
|
|||||||
GFile *file = g_file_new_for_path (icon->filename);
|
GFile *file = g_file_new_for_path (icon->filename);
|
||||||
GInputStream *stream = G_INPUT_STREAM (g_file_read (file, NULL, &load_error));
|
GInputStream *stream = G_INPUT_STREAM (g_file_read (file, NULL, &load_error));
|
||||||
|
|
||||||
|
g_object_unref (file);
|
||||||
if (stream)
|
if (stream)
|
||||||
{
|
{
|
||||||
icon->texture = gdk_texture_new_from_stream_at_scale (stream,
|
source_pixbuf = _gdk_pixbuf_new_from_stream_at_scale (stream,
|
||||||
pixel_size, pixel_size,
|
pixel_size, pixel_size,
|
||||||
TRUE, NULL,
|
TRUE, NULL,
|
||||||
&load_error);
|
&load_error);
|
||||||
g_object_unref (stream);
|
g_object_unref (stream);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
g_object_unref (file);
|
source_pixbuf = NULL;
|
||||||
|
}
|
||||||
|
if (source_pixbuf)
|
||||||
|
{
|
||||||
|
icon->texture = gdk_texture_new_for_pixbuf (source_pixbuf);
|
||||||
|
g_object_unref (source_pixbuf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -3794,24 +3809,35 @@ icon_ensure_texture__locked (GtkIconPaintable *icon,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
GInputStream *stream;
|
GInputStream *stream;
|
||||||
|
GdkPixbuf *source_pixbuf;
|
||||||
|
|
||||||
g_assert (icon->loadable);
|
g_assert (icon->loadable);
|
||||||
|
|
||||||
stream = g_loadable_icon_load (icon->loadable, pixel_size, NULL, NULL, &load_error);
|
stream = g_loadable_icon_load (icon->loadable,
|
||||||
|
pixel_size,
|
||||||
|
NULL, NULL,
|
||||||
|
&load_error);
|
||||||
if (stream)
|
if (stream)
|
||||||
{
|
{
|
||||||
/* SVG icons are a special case - we just immediately scale them
|
/* SVG icons are a special case - we just immediately scale them
|
||||||
* to the desired size
|
* to the desired size
|
||||||
*/
|
*/
|
||||||
if (icon->is_svg)
|
if (icon->is_svg)
|
||||||
icon->texture = gdk_texture_new_from_stream_at_scale (stream,
|
{
|
||||||
pixel_size, pixel_size,
|
source_pixbuf = _gdk_pixbuf_new_from_stream_at_scale (stream,
|
||||||
TRUE, NULL,
|
pixel_size, pixel_size,
|
||||||
&load_error);
|
TRUE, NULL,
|
||||||
|
&load_error);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
icon->texture = gdk_texture_new_from_stream (stream, NULL, &load_error);
|
source_pixbuf = _gdk_pixbuf_new_from_stream (stream,
|
||||||
|
NULL, &load_error);
|
||||||
g_object_unref (stream);
|
g_object_unref (stream);
|
||||||
|
if (source_pixbuf)
|
||||||
|
{
|
||||||
|
icon->texture = gdk_texture_new_for_pixbuf (source_pixbuf);
|
||||||
|
g_object_unref (source_pixbuf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-8
@@ -31,7 +31,7 @@
|
|||||||
#include "gtksnapshot.h"
|
#include "gtksnapshot.h"
|
||||||
#include "gtktypebuiltins.h"
|
#include "gtktypebuiltins.h"
|
||||||
#include "gtkwidgetprivate.h"
|
#include "gtkwidgetprivate.h"
|
||||||
#include "gdktextureutilsprivate.h"
|
#include "gdkpixbufutilsprivate.h"
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -475,9 +475,6 @@ gtk_image_new_from_resource (const char *resource_path)
|
|||||||
* want that, you should use [ctor@Gtk.Image.new_from_icon_name].
|
* want that, you should use [ctor@Gtk.Image.new_from_icon_name].
|
||||||
*
|
*
|
||||||
* Returns: a new `GtkImage`
|
* Returns: a new `GtkImage`
|
||||||
*
|
|
||||||
* Deprecated: 4.12: Use [ctor@Gtk.Image.new_from_paintable] and
|
|
||||||
* [ctor@Gdk.Texture.new_for_pixbuf] instead
|
|
||||||
*/
|
*/
|
||||||
GtkWidget*
|
GtkWidget*
|
||||||
gtk_image_new_from_pixbuf (GdkPixbuf *pixbuf)
|
gtk_image_new_from_pixbuf (GdkPixbuf *pixbuf)
|
||||||
@@ -486,9 +483,7 @@ gtk_image_new_from_pixbuf (GdkPixbuf *pixbuf)
|
|||||||
|
|
||||||
image = g_object_new (GTK_TYPE_IMAGE, NULL);
|
image = g_object_new (GTK_TYPE_IMAGE, NULL);
|
||||||
|
|
||||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
|
||||||
gtk_image_set_from_pixbuf (image, pixbuf);
|
gtk_image_set_from_pixbuf (image, pixbuf);
|
||||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
|
||||||
|
|
||||||
return GTK_WIDGET (image);
|
return GTK_WIDGET (image);
|
||||||
}
|
}
|
||||||
@@ -716,8 +711,6 @@ gtk_image_set_from_resource (GtkImage *image,
|
|||||||
* Note: This is a helper for [method@Gtk.Image.set_from_paintable],
|
* Note: This is a helper for [method@Gtk.Image.set_from_paintable],
|
||||||
* and you can't get back the exact pixbuf once this is called,
|
* and you can't get back the exact pixbuf once this is called,
|
||||||
* only a paintable.
|
* only a paintable.
|
||||||
*
|
|
||||||
* Deprecated: 4.12: Use [method@Gtk.Image.set_from_paintable] instead
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gtk_image_set_from_pixbuf (GtkImage *image,
|
gtk_image_set_from_pixbuf (GtkImage *image,
|
||||||
|
|||||||
+2
-2
@@ -74,7 +74,7 @@ GDK_AVAILABLE_IN_ALL
|
|||||||
GtkWidget* gtk_image_new_from_file (const char *filename);
|
GtkWidget* gtk_image_new_from_file (const char *filename);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GtkWidget* gtk_image_new_from_resource (const char *resource_path);
|
GtkWidget* gtk_image_new_from_resource (const char *resource_path);
|
||||||
GDK_DEPRECATED_IN_4_12_FOR(gtk_image_new_from_paintable)
|
GDK_AVAILABLE_IN_ALL
|
||||||
GtkWidget* gtk_image_new_from_pixbuf (GdkPixbuf *pixbuf);
|
GtkWidget* gtk_image_new_from_pixbuf (GdkPixbuf *pixbuf);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GtkWidget* gtk_image_new_from_paintable (GdkPaintable *paintable);
|
GtkWidget* gtk_image_new_from_paintable (GdkPaintable *paintable);
|
||||||
@@ -91,7 +91,7 @@ void gtk_image_set_from_file (GtkImage *image,
|
|||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
void gtk_image_set_from_resource (GtkImage *image,
|
void gtk_image_set_from_resource (GtkImage *image,
|
||||||
const char *resource_path);
|
const char *resource_path);
|
||||||
GDK_DEPRECATED_IN_4_12_FOR(gtk_image_set_from_paintable)
|
GDK_AVAILABLE_IN_ALL
|
||||||
void gtk_image_set_from_pixbuf (GtkImage *image,
|
void gtk_image_set_from_pixbuf (GtkImage *image,
|
||||||
GdkPixbuf *pixbuf);
|
GdkPixbuf *pixbuf);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
|||||||
+66
-102
@@ -198,6 +198,7 @@ gtk_list_item_manager_augment_node (GtkRbTree *tree,
|
|||||||
aug->has_footer = TRUE;
|
aug->has_footer = TRUE;
|
||||||
break;
|
break;
|
||||||
case GTK_LIST_TILE_ITEM:
|
case GTK_LIST_TILE_ITEM:
|
||||||
|
case GTK_LIST_TILE_FILLER:
|
||||||
case GTK_LIST_TILE_REMOVED:
|
case GTK_LIST_TILE_REMOVED:
|
||||||
aug->has_header = FALSE;
|
aug->has_header = FALSE;
|
||||||
aug->has_footer = FALSE;
|
aug->has_footer = FALSE;
|
||||||
@@ -568,7 +569,8 @@ gtk_list_tile_get_tile_at (GtkListItemManager *self,
|
|||||||
* If multiple tiles have the same distance, the one closest to the start
|
* If multiple tiles have the same distance, the one closest to the start
|
||||||
* will be returned.
|
* will be returned.
|
||||||
*
|
*
|
||||||
* Returns: (nullable): The tile nearest to (x, y) or NULL if there are no tiles
|
* Returns: (nullable): The tile nearest to (x, y) or NULL if there are no
|
||||||
|
* tile
|
||||||
**/
|
**/
|
||||||
GtkListTile *
|
GtkListTile *
|
||||||
gtk_list_item_manager_get_nearest_tile (GtkListItemManager *self,
|
gtk_list_item_manager_get_nearest_tile (GtkListItemManager *self,
|
||||||
@@ -595,7 +597,7 @@ gtk_list_tile_get_position (GtkListItemManager *self,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pos = 0;
|
pos = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (parent = gtk_rb_tree_node_get_parent (tile);
|
for (parent = gtk_rb_tree_node_get_parent (tile);
|
||||||
@@ -631,7 +633,7 @@ static GtkListTile *
|
|||||||
gtk_list_tile_get_next_skip (GtkListTile *tile)
|
gtk_list_tile_get_next_skip (GtkListTile *tile)
|
||||||
{
|
{
|
||||||
for (tile = gtk_rb_tree_node_get_next (tile);
|
for (tile = gtk_rb_tree_node_get_next (tile);
|
||||||
tile && tile->type == GTK_LIST_TILE_REMOVED;
|
tile && (tile->type == GTK_LIST_TILE_FILLER || tile->type == GTK_LIST_TILE_REMOVED);
|
||||||
tile = gtk_rb_tree_node_get_next (tile))
|
tile = gtk_rb_tree_node_get_next (tile))
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@@ -642,7 +644,7 @@ static GtkListTile *
|
|||||||
gtk_list_tile_get_previous_skip (GtkListTile *tile)
|
gtk_list_tile_get_previous_skip (GtkListTile *tile)
|
||||||
{
|
{
|
||||||
for (tile = gtk_rb_tree_node_get_previous (tile);
|
for (tile = gtk_rb_tree_node_get_previous (tile);
|
||||||
tile && tile->type == GTK_LIST_TILE_REMOVED;
|
tile && (tile->type == GTK_LIST_TILE_FILLER || tile->type == GTK_LIST_TILE_REMOVED);
|
||||||
tile = gtk_rb_tree_node_get_previous (tile))
|
tile = gtk_rb_tree_node_get_previous (tile))
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@@ -713,7 +715,6 @@ static void
|
|||||||
gtk_list_tile_set_type (GtkListTile *tile,
|
gtk_list_tile_set_type (GtkListTile *tile,
|
||||||
GtkListTileType type)
|
GtkListTileType type)
|
||||||
{
|
{
|
||||||
g_assert (tile != NULL);
|
|
||||||
if (tile->type == type)
|
if (tile->type == type)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -844,8 +845,7 @@ gtk_list_item_manager_remove_items (GtkListItemManager *self,
|
|||||||
if (offset)
|
if (offset)
|
||||||
tile = gtk_list_item_manager_ensure_split (self, tile, offset);
|
tile = gtk_list_item_manager_ensure_split (self, tile, offset);
|
||||||
header = gtk_list_tile_get_previous_skip (tile);
|
header = gtk_list_tile_get_previous_skip (tile);
|
||||||
if (header != NULL &&
|
if (header->type != GTK_LIST_TILE_HEADER && header->type != GTK_LIST_TILE_UNMATCHED_HEADER)
|
||||||
(header->type != GTK_LIST_TILE_HEADER && header->type != GTK_LIST_TILE_UNMATCHED_HEADER))
|
|
||||||
header = NULL;
|
header = NULL;
|
||||||
|
|
||||||
while (n_items > 0)
|
while (n_items > 0)
|
||||||
@@ -883,6 +883,7 @@ gtk_list_item_manager_remove_items (GtkListItemManager *self,
|
|||||||
gtk_list_tile_set_type (tile, GTK_LIST_TILE_REMOVED);
|
gtk_list_tile_set_type (tile, GTK_LIST_TILE_REMOVED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case GTK_LIST_TILE_FILLER:
|
||||||
case GTK_LIST_TILE_REMOVED:
|
case GTK_LIST_TILE_REMOVED:
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
@@ -910,7 +911,7 @@ gtk_list_item_manager_add_items (GtkListItemManager *self,
|
|||||||
GtkListItemChange *change,
|
GtkListItemChange *change,
|
||||||
guint position,
|
guint position,
|
||||||
guint n_items)
|
guint n_items)
|
||||||
{
|
{
|
||||||
GtkListTile *tile;
|
GtkListTile *tile;
|
||||||
guint offset;
|
guint offset;
|
||||||
gboolean has_sections;
|
gboolean has_sections;
|
||||||
@@ -925,7 +926,7 @@ gtk_list_item_manager_add_items (GtkListItemManager *self,
|
|||||||
{
|
{
|
||||||
/* at end of list, pick the footer */
|
/* at end of list, pick the footer */
|
||||||
for (tile = gtk_rb_tree_get_last (self->items);
|
for (tile = gtk_rb_tree_get_last (self->items);
|
||||||
tile && tile->type == GTK_LIST_TILE_REMOVED;
|
tile && (tile->type == GTK_LIST_TILE_REMOVED || tile->type == GTK_LIST_TILE_FILLER);
|
||||||
tile = gtk_rb_tree_node_get_previous (tile))
|
tile = gtk_rb_tree_node_get_previous (tile))
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@@ -951,7 +952,7 @@ gtk_list_item_manager_add_items (GtkListItemManager *self,
|
|||||||
}
|
}
|
||||||
if (offset)
|
if (offset)
|
||||||
tile = gtk_list_item_manager_ensure_split (self, tile, offset);
|
tile = gtk_list_item_manager_ensure_split (self, tile, offset);
|
||||||
|
|
||||||
tile = gtk_rb_tree_insert_before (self->items, tile);
|
tile = gtk_rb_tree_insert_before (self->items, tile);
|
||||||
tile->type = GTK_LIST_TILE_ITEM;
|
tile->type = GTK_LIST_TILE_ITEM;
|
||||||
tile->n_items = n_items;
|
tile->n_items = n_items;
|
||||||
@@ -961,7 +962,7 @@ gtk_list_item_manager_add_items (GtkListItemManager *self,
|
|||||||
{
|
{
|
||||||
GtkListTile *section = gtk_list_tile_get_previous_skip (tile);
|
GtkListTile *section = gtk_list_tile_get_previous_skip (tile);
|
||||||
|
|
||||||
if (section != NULL && section->type == GTK_LIST_TILE_HEADER)
|
if (section->type == GTK_LIST_TILE_HEADER)
|
||||||
{
|
{
|
||||||
gtk_list_item_change_clear_header (change, §ion->widget);
|
gtk_list_item_change_clear_header (change, §ion->widget);
|
||||||
gtk_list_tile_set_type (section,
|
gtk_list_tile_set_type (section,
|
||||||
@@ -999,7 +1000,7 @@ gtk_list_item_manager_merge_list_items (GtkListItemManager *self,
|
|||||||
* Splits the given tile into two tiles. The original
|
* Splits the given tile into two tiles. The original
|
||||||
* tile will remain with @n_items items, the remaining
|
* tile will remain with @n_items items, the remaining
|
||||||
* items will be given to the new tile, which will be
|
* items will be given to the new tile, which will be
|
||||||
* inserted after the tile.
|
* nserted after the tile.
|
||||||
*
|
*
|
||||||
* It is not valid for either tile to have 0 items after
|
* It is not valid for either tile to have 0 items after
|
||||||
* the split.
|
* the split.
|
||||||
@@ -1026,6 +1027,34 @@ gtk_list_tile_split (GtkListItemManager *self,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gtk_list_tile_append_filler:
|
||||||
|
* @self: the listitemmanager
|
||||||
|
* @previous: tile to append to
|
||||||
|
*
|
||||||
|
* Appends a filler tile.
|
||||||
|
*
|
||||||
|
* Filler tiles don't refer to any items or header and exist
|
||||||
|
* just to take up space, so that finding items by position gets
|
||||||
|
* easier.
|
||||||
|
*
|
||||||
|
* They ave a special garbage-collection behavior, see
|
||||||
|
* gtk_list_tile_gc().
|
||||||
|
*
|
||||||
|
* Returns: The new filler tile
|
||||||
|
**/
|
||||||
|
GtkListTile *
|
||||||
|
gtk_list_tile_append_filler (GtkListItemManager *self,
|
||||||
|
GtkListTile *previous)
|
||||||
|
{
|
||||||
|
GtkListTile *result;
|
||||||
|
|
||||||
|
result = gtk_rb_tree_insert_after (self->items, previous);
|
||||||
|
result->type = GTK_LIST_TILE_FILLER;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* gtk_list_tile_gc:
|
* gtk_list_tile_gc:
|
||||||
* @self: the listitemmanager
|
* @self: the listitemmanager
|
||||||
@@ -1043,7 +1072,7 @@ gtk_list_tile_split (GtkListItemManager *self,
|
|||||||
*
|
*
|
||||||
* Returns: The next tile or NULL if everything was gc'ed
|
* Returns: The next tile or NULL if everything was gc'ed
|
||||||
**/
|
**/
|
||||||
static GtkListTile *
|
GtkListTile *
|
||||||
gtk_list_tile_gc (GtkListItemManager *self,
|
gtk_list_tile_gc (GtkListItemManager *self,
|
||||||
GtkListTile *tile)
|
GtkListTile *tile)
|
||||||
{
|
{
|
||||||
@@ -1052,6 +1081,13 @@ gtk_list_tile_gc (GtkListItemManager *self,
|
|||||||
if (tile == NULL)
|
if (tile == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
if (tile->type == GTK_LIST_TILE_FILLER)
|
||||||
|
{
|
||||||
|
next = gtk_rb_tree_node_get_next (tile);
|
||||||
|
gtk_rb_tree_remove (self->items, tile);
|
||||||
|
tile = next;
|
||||||
|
}
|
||||||
|
|
||||||
while (tile)
|
while (tile)
|
||||||
{
|
{
|
||||||
next = gtk_rb_tree_node_get_next (tile);
|
next = gtk_rb_tree_node_get_next (tile);
|
||||||
@@ -1075,6 +1111,7 @@ gtk_list_tile_gc (GtkListItemManager *self,
|
|||||||
case GTK_LIST_TILE_FOOTER:
|
case GTK_LIST_TILE_FOOTER:
|
||||||
case GTK_LIST_TILE_UNMATCHED_HEADER:
|
case GTK_LIST_TILE_UNMATCHED_HEADER:
|
||||||
case GTK_LIST_TILE_UNMATCHED_FOOTER:
|
case GTK_LIST_TILE_UNMATCHED_FOOTER:
|
||||||
|
case GTK_LIST_TILE_FILLER:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GTK_LIST_TILE_REMOVED:
|
case GTK_LIST_TILE_REMOVED:
|
||||||
@@ -1093,18 +1130,6 @@ gtk_list_tile_gc (GtkListItemManager *self,
|
|||||||
return tile;
|
return tile;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
gtk_list_item_manager_gc_tiles (GtkListItemManager *self)
|
|
||||||
{
|
|
||||||
GtkListTile *tile;
|
|
||||||
|
|
||||||
for (tile = gtk_list_tile_gc (self, gtk_list_item_manager_get_first (self));
|
|
||||||
tile != NULL;
|
|
||||||
tile = gtk_list_tile_gc (self, gtk_rb_tree_node_get_next (tile)))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_list_item_manager_release_items (GtkListItemManager *self,
|
gtk_list_item_manager_release_items (GtkListItemManager *self,
|
||||||
GtkListItemChange *change)
|
GtkListItemChange *change)
|
||||||
@@ -1153,6 +1178,7 @@ gtk_list_item_manager_release_items (GtkListItemManager *self,
|
|||||||
deleted_section = TRUE;
|
deleted_section = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case GTK_LIST_TILE_FILLER:
|
||||||
case GTK_LIST_TILE_REMOVED:
|
case GTK_LIST_TILE_REMOVED:
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
@@ -1181,7 +1207,7 @@ gtk_list_item_manager_insert_section (GtkListItemManager *self,
|
|||||||
{
|
{
|
||||||
GtkListTile *tile, *footer, *header;
|
GtkListTile *tile, *footer, *header;
|
||||||
guint offset;
|
guint offset;
|
||||||
|
|
||||||
tile = gtk_list_item_manager_get_nth (self, pos, &offset);
|
tile = gtk_list_item_manager_get_nth (self, pos, &offset);
|
||||||
if (tile == NULL)
|
if (tile == NULL)
|
||||||
{
|
{
|
||||||
@@ -1199,8 +1225,7 @@ gtk_list_item_manager_insert_section (GtkListItemManager *self,
|
|||||||
tile = gtk_list_item_manager_ensure_split (self, tile, offset);
|
tile = gtk_list_item_manager_ensure_split (self, tile, offset);
|
||||||
|
|
||||||
header = gtk_list_tile_get_previous_skip (tile);
|
header = gtk_list_tile_get_previous_skip (tile);
|
||||||
if (header != NULL &&
|
if (header->type == GTK_LIST_TILE_HEADER || header->type == GTK_LIST_TILE_UNMATCHED_HEADER)
|
||||||
(header->type == GTK_LIST_TILE_HEADER || header->type == GTK_LIST_TILE_UNMATCHED_HEADER))
|
|
||||||
{
|
{
|
||||||
if (header_type == GTK_LIST_TILE_HEADER)
|
if (header_type == GTK_LIST_TILE_HEADER)
|
||||||
gtk_list_tile_set_type (header, header_type);
|
gtk_list_tile_set_type (header, header_type);
|
||||||
@@ -1232,7 +1257,7 @@ gtk_list_tile_find_widget_before (GtkListTile *tile)
|
|||||||
for (other = gtk_rb_tree_node_get_previous (tile);
|
for (other = gtk_rb_tree_node_get_previous (tile);
|
||||||
other;
|
other;
|
||||||
other = gtk_rb_tree_node_get_previous (other))
|
other = gtk_rb_tree_node_get_previous (other))
|
||||||
{
|
{
|
||||||
if (other->widget)
|
if (other->widget)
|
||||||
return other->widget;
|
return other->widget;
|
||||||
}
|
}
|
||||||
@@ -1386,6 +1411,7 @@ gtk_list_item_manager_ensure_items (GtkListItemManager *self,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case GTK_LIST_TILE_UNMATCHED_FOOTER:
|
case GTK_LIST_TILE_UNMATCHED_FOOTER:
|
||||||
|
case GTK_LIST_TILE_FILLER:
|
||||||
case GTK_LIST_TILE_REMOVED:
|
case GTK_LIST_TILE_REMOVED:
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
@@ -1434,7 +1460,7 @@ gtk_list_item_manager_model_items_changed_cb (GListModel *model,
|
|||||||
GtkListTile *tile, *new_tile;
|
GtkListTile *tile, *new_tile;
|
||||||
GtkWidget *insert_after;
|
GtkWidget *insert_after;
|
||||||
guint i, offset;
|
guint i, offset;
|
||||||
|
|
||||||
tile = gtk_list_item_manager_get_nth (self, position, &offset);
|
tile = gtk_list_item_manager_get_nth (self, position, &offset);
|
||||||
for (new_tile = tile ? gtk_rb_tree_node_get_previous (tile) : gtk_rb_tree_get_last (self->items);
|
for (new_tile = tile ? gtk_rb_tree_node_get_previous (tile) : gtk_rb_tree_get_last (self->items);
|
||||||
new_tile && new_tile->widget == NULL;
|
new_tile && new_tile->widget == NULL;
|
||||||
@@ -1550,7 +1576,7 @@ gtk_list_item_manager_model_items_changed_cb (GListModel *model,
|
|||||||
GtkListItemTracker *tracker = l->data;
|
GtkListItemTracker *tracker = l->data;
|
||||||
GtkListTile *tile;
|
GtkListTile *tile;
|
||||||
|
|
||||||
if (tracker->widget != NULL ||
|
if (tracker->widget != NULL ||
|
||||||
tracker->position == GTK_INVALID_LIST_POSITION)
|
tracker->position == GTK_INVALID_LIST_POSITION)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1565,67 +1591,6 @@ gtk_list_item_manager_model_items_changed_cb (GListModel *model,
|
|||||||
gtk_widget_queue_resize (self->widget);
|
gtk_widget_queue_resize (self->widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_list_item_manager_model_sections_changed_cb (GListModel *model,
|
|
||||||
guint position,
|
|
||||||
guint n_items,
|
|
||||||
GtkListItemManager *self)
|
|
||||||
{
|
|
||||||
GtkListItemChange change;
|
|
||||||
GtkListTile *tile, *header;
|
|
||||||
guint offset;
|
|
||||||
|
|
||||||
if (!gtk_list_item_manager_has_sections (self))
|
|
||||||
return;
|
|
||||||
|
|
||||||
gtk_list_item_change_init (&change);
|
|
||||||
|
|
||||||
tile = gtk_list_item_manager_get_nth (self, position, &offset);
|
|
||||||
header = gtk_list_tile_get_header (self, tile);
|
|
||||||
gtk_list_item_change_clear_header (&change, &header->widget);
|
|
||||||
gtk_list_tile_set_type (header, GTK_LIST_TILE_UNMATCHED_HEADER);
|
|
||||||
|
|
||||||
n_items -= MIN (n_items, position - offset);
|
|
||||||
while (n_items > 0)
|
|
||||||
{
|
|
||||||
switch (tile->type)
|
|
||||||
{
|
|
||||||
case GTK_LIST_TILE_HEADER:
|
|
||||||
case GTK_LIST_TILE_UNMATCHED_HEADER:
|
|
||||||
gtk_list_item_change_clear_header (&change, &tile->widget);
|
|
||||||
gtk_list_tile_set_type (tile, GTK_LIST_TILE_REMOVED);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GTK_LIST_TILE_FOOTER:
|
|
||||||
case GTK_LIST_TILE_UNMATCHED_FOOTER:
|
|
||||||
gtk_list_tile_set_type (tile, GTK_LIST_TILE_REMOVED);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GTK_LIST_TILE_ITEM:
|
|
||||||
n_items -= MIN (n_items, tile->n_items);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GTK_LIST_TILE_REMOVED:
|
|
||||||
default:
|
|
||||||
g_assert_not_reached ();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
tile = gtk_list_tile_get_next_skip (tile);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!gtk_list_tile_is_footer (tile))
|
|
||||||
tile = gtk_list_tile_get_footer (self, tile);
|
|
||||||
|
|
||||||
gtk_list_tile_set_type (tile, GTK_LIST_TILE_UNMATCHED_FOOTER);
|
|
||||||
|
|
||||||
gtk_list_item_manager_ensure_items (self, &change, G_MAXUINT, 0);
|
|
||||||
|
|
||||||
gtk_list_item_change_finish (&change);
|
|
||||||
|
|
||||||
gtk_widget_queue_resize (GTK_WIDGET (self->widget));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_list_item_manager_model_selection_changed_cb (GListModel *model,
|
gtk_list_item_manager_model_selection_changed_cb (GListModel *model,
|
||||||
guint position,
|
guint position,
|
||||||
@@ -1666,6 +1631,7 @@ static void
|
|||||||
gtk_list_item_manager_clear_model (GtkListItemManager *self)
|
gtk_list_item_manager_clear_model (GtkListItemManager *self)
|
||||||
{
|
{
|
||||||
GtkListItemChange change;
|
GtkListItemChange change;
|
||||||
|
GtkListTile *tile;
|
||||||
GSList *l;
|
GSList *l;
|
||||||
|
|
||||||
if (self->model == NULL)
|
if (self->model == NULL)
|
||||||
@@ -1685,13 +1651,15 @@ gtk_list_item_manager_clear_model (GtkListItemManager *self)
|
|||||||
g_signal_handlers_disconnect_by_func (self->model,
|
g_signal_handlers_disconnect_by_func (self->model,
|
||||||
gtk_list_item_manager_model_items_changed_cb,
|
gtk_list_item_manager_model_items_changed_cb,
|
||||||
self);
|
self);
|
||||||
g_signal_handlers_disconnect_by_func (self->model,
|
|
||||||
gtk_list_item_manager_model_sections_changed_cb,
|
|
||||||
self);
|
|
||||||
g_clear_object (&self->model);
|
g_clear_object (&self->model);
|
||||||
|
|
||||||
gtk_list_item_manager_gc_tiles (self);
|
/* really empty the tiles */
|
||||||
|
for (tile = gtk_list_tile_gc (self, gtk_list_item_manager_get_first (self));
|
||||||
|
tile;
|
||||||
|
tile = gtk_list_tile_gc (self, tile))
|
||||||
|
{
|
||||||
|
g_assert (tile->type == GTK_LIST_TILE_FILLER);
|
||||||
|
}
|
||||||
g_assert (gtk_rb_tree_get_root (self->items) == NULL);
|
g_assert (gtk_rb_tree_get_root (self->items) == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1746,11 +1714,6 @@ gtk_list_item_manager_set_model (GtkListItemManager *self,
|
|||||||
"selection-changed",
|
"selection-changed",
|
||||||
G_CALLBACK (gtk_list_item_manager_model_selection_changed_cb),
|
G_CALLBACK (gtk_list_item_manager_model_selection_changed_cb),
|
||||||
self);
|
self);
|
||||||
if (GTK_IS_SECTION_MODEL (model))
|
|
||||||
g_signal_connect (model,
|
|
||||||
"sections-changed",
|
|
||||||
G_CALLBACK (gtk_list_item_manager_model_sections_changed_cb),
|
|
||||||
self);
|
|
||||||
|
|
||||||
gtk_list_item_change_init (&change);
|
gtk_list_item_change_init (&change);
|
||||||
gtk_list_item_manager_add_items (self, &change, 0, g_list_model_get_n_items (G_LIST_MODEL (model)));
|
gtk_list_item_manager_add_items (self, &change, 0, g_list_model_get_n_items (G_LIST_MODEL (model)));
|
||||||
@@ -1809,6 +1772,7 @@ gtk_list_item_manager_set_has_sections (GtkListItemManager *self,
|
|||||||
footer = tile;
|
footer = tile;
|
||||||
break;
|
break;
|
||||||
case GTK_LIST_TILE_ITEM:
|
case GTK_LIST_TILE_ITEM:
|
||||||
|
case GTK_LIST_TILE_FILLER:
|
||||||
case GTK_LIST_TILE_REMOVED:
|
case GTK_LIST_TILE_REMOVED:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ typedef enum
|
|||||||
GTK_LIST_TILE_FOOTER,
|
GTK_LIST_TILE_FOOTER,
|
||||||
GTK_LIST_TILE_UNMATCHED_HEADER,
|
GTK_LIST_TILE_UNMATCHED_HEADER,
|
||||||
GTK_LIST_TILE_UNMATCHED_FOOTER,
|
GTK_LIST_TILE_UNMATCHED_FOOTER,
|
||||||
|
GTK_LIST_TILE_FILLER,
|
||||||
GTK_LIST_TILE_REMOVED,
|
GTK_LIST_TILE_REMOVED,
|
||||||
} GtkListTileType;
|
} GtkListTileType;
|
||||||
|
|
||||||
@@ -59,7 +60,7 @@ struct _GtkListTile
|
|||||||
GtkListTileType type;
|
GtkListTileType type;
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
guint n_items;
|
guint n_items;
|
||||||
/* area occupied by tile. May be empty if tile has no allocation */
|
/* area occupied by tile. May be empty if tile has no allcoation */
|
||||||
cairo_rectangle_int_t area;
|
cairo_rectangle_int_t area;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -94,19 +95,7 @@ gpointer gtk_list_item_manager_get_nth (GtkListItemMana
|
|||||||
GtkListTile * gtk_list_item_manager_get_nearest_tile (GtkListItemManager *self,
|
GtkListTile * gtk_list_item_manager_get_nearest_tile (GtkListItemManager *self,
|
||||||
int x,
|
int x,
|
||||||
int y);
|
int y);
|
||||||
void gtk_list_item_manager_gc_tiles (GtkListItemManager *self);
|
|
||||||
|
|
||||||
static inline gboolean
|
|
||||||
gtk_list_tile_is_header (GtkListTile *tile)
|
|
||||||
{
|
|
||||||
return tile->type == GTK_LIST_TILE_HEADER || tile->type == GTK_LIST_TILE_UNMATCHED_HEADER;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline gboolean
|
|
||||||
gtk_list_tile_is_footer (GtkListTile *tile)
|
|
||||||
{
|
|
||||||
return tile->type == GTK_LIST_TILE_FOOTER || tile->type == GTK_LIST_TILE_UNMATCHED_FOOTER;
|
|
||||||
}
|
|
||||||
|
|
||||||
guint gtk_list_tile_get_position (GtkListItemManager *self,
|
guint gtk_list_tile_get_position (GtkListItemManager *self,
|
||||||
GtkListTile *tile);
|
GtkListTile *tile);
|
||||||
@@ -127,6 +116,10 @@ void gtk_list_tile_set_area_size (GtkListItemMana
|
|||||||
GtkListTile * gtk_list_tile_split (GtkListItemManager *self,
|
GtkListTile * gtk_list_tile_split (GtkListItemManager *self,
|
||||||
GtkListTile *tile,
|
GtkListTile *tile,
|
||||||
guint n_items);
|
guint n_items);
|
||||||
|
GtkListTile * gtk_list_tile_append_filler (GtkListItemManager *self,
|
||||||
|
GtkListTile *previous);
|
||||||
|
GtkListTile * gtk_list_tile_gc (GtkListItemManager *self,
|
||||||
|
GtkListTile *tile);
|
||||||
|
|
||||||
void gtk_list_item_manager_set_model (GtkListItemManager *self,
|
void gtk_list_item_manager_set_model (GtkListItemManager *self,
|
||||||
GtkSelectionModel *model);
|
GtkSelectionModel *model);
|
||||||
|
|||||||
+3
-7
@@ -235,6 +235,7 @@ gtk_list_view_update_factories_with (GtkListView *self,
|
|||||||
case GTK_LIST_TILE_UNMATCHED_HEADER:
|
case GTK_LIST_TILE_UNMATCHED_HEADER:
|
||||||
case GTK_LIST_TILE_FOOTER:
|
case GTK_LIST_TILE_FOOTER:
|
||||||
case GTK_LIST_TILE_UNMATCHED_FOOTER:
|
case GTK_LIST_TILE_UNMATCHED_FOOTER:
|
||||||
|
case GTK_LIST_TILE_FILLER:
|
||||||
case GTK_LIST_TILE_REMOVED:
|
case GTK_LIST_TILE_REMOVED:
|
||||||
g_assert (tile->widget == NULL);
|
g_assert (tile->widget == NULL);
|
||||||
break;
|
break;
|
||||||
@@ -608,10 +609,8 @@ gtk_list_view_size_allocate (GtkWidget *widget,
|
|||||||
opposite_scroll_policy = gtk_list_base_get_scroll_policy (GTK_LIST_BASE (self), opposite_orientation);
|
opposite_scroll_policy = gtk_list_base_get_scroll_policy (GTK_LIST_BASE (self), opposite_orientation);
|
||||||
gtk_list_base_get_border_spacing (GTK_LIST_BASE (self), NULL, &spacing);
|
gtk_list_base_get_border_spacing (GTK_LIST_BASE (self), NULL, &spacing);
|
||||||
|
|
||||||
gtk_list_item_manager_gc_tiles (self->item_manager);
|
|
||||||
|
|
||||||
/* step 0: exit early if list is empty */
|
/* step 0: exit early if list is empty */
|
||||||
tile = gtk_list_item_manager_get_first (self->item_manager);
|
tile = gtk_list_tile_gc (self->item_manager, gtk_list_item_manager_get_first (self->item_manager));
|
||||||
if (tile == NULL)
|
if (tile == NULL)
|
||||||
{
|
{
|
||||||
gtk_list_base_allocate (GTK_LIST_BASE (self));
|
gtk_list_base_allocate (GTK_LIST_BASE (self));
|
||||||
@@ -633,7 +632,7 @@ gtk_list_view_size_allocate (GtkWidget *widget,
|
|||||||
|
|
||||||
for (;
|
for (;
|
||||||
tile != NULL;
|
tile != NULL;
|
||||||
tile = gtk_rb_tree_node_get_next (tile))
|
tile = gtk_list_tile_gc (self->item_manager, gtk_rb_tree_node_get_next (tile)))
|
||||||
{
|
{
|
||||||
if (tile->widget == NULL)
|
if (tile->widget == NULL)
|
||||||
continue;
|
continue;
|
||||||
@@ -727,9 +726,6 @@ gtk_list_view_dispose (GObject *object)
|
|||||||
|
|
||||||
self->item_manager = NULL;
|
self->item_manager = NULL;
|
||||||
|
|
||||||
g_clear_object (&self->factory);
|
|
||||||
g_clear_object (&self->header_factory);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (gtk_list_view_parent_class)->dispose (object);
|
G_OBJECT_CLASS (gtk_list_view_parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,11 +42,12 @@ BOOLEAN:OBJECT,OBJECT,OBJECT
|
|||||||
BOOLEAN:STRING
|
BOOLEAN:STRING
|
||||||
BOOLEAN:UINT,UINT,FLAGS
|
BOOLEAN:UINT,UINT,FLAGS
|
||||||
BOOLEAN:VOID
|
BOOLEAN:VOID
|
||||||
FLAGS:OBJECT,DOUBLE,DOUBLE
|
ENUM:OBJECT,DOUBLE,DOUBLE
|
||||||
FLAGS:DOUBLE,DOUBLE
|
FLAGS:DOUBLE,DOUBLE
|
||||||
INT:INT
|
INT:INT
|
||||||
INT:OBJECT,OBJECT,POINTER
|
INT:OBJECT,OBJECT,POINTER
|
||||||
INT:POINTER
|
INT:POINTER
|
||||||
|
OBJECT:BOOLEAN
|
||||||
OBJECT:DOUBLE,DOUBLE
|
OBJECT:DOUBLE,DOUBLE
|
||||||
OBJECT:OBJECT
|
OBJECT:OBJECT
|
||||||
OBJECT:VOID
|
OBJECT:VOID
|
||||||
|
|||||||
+1
-1
@@ -1554,7 +1554,7 @@ gtk_menu_button_get_child (GtkMenuButton *menu_button)
|
|||||||
* @menu_button: a `GtkMenuButton`
|
* @menu_button: a `GtkMenuButton`
|
||||||
* @active: whether the menu button is active
|
* @active: whether the menu button is active
|
||||||
*
|
*
|
||||||
* Sets whether the menu button is active.
|
* Sets whether menu button acts is active.
|
||||||
*
|
*
|
||||||
* Since: 4.10
|
* Since: 4.10
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -664,7 +664,7 @@ gtk_menu_section_box_new_section (GtkMenuTrackerItem *item,
|
|||||||
gtk_orientable_set_orientation (GTK_ORIENTABLE (box->item_box), GTK_ORIENTATION_HORIZONTAL);
|
gtk_orientable_set_orientation (GTK_ORIENTABLE (box->item_box), GTK_ORIENTATION_HORIZONTAL);
|
||||||
gtk_widget_add_css_class (GTK_WIDGET (box->item_box), "inline-buttons");
|
gtk_widget_add_css_class (GTK_WIDGET (box->item_box), "inline-buttons");
|
||||||
|
|
||||||
spacer = gtk_gizmo_new ("none", NULL, NULL, NULL,NULL, NULL, NULL);
|
spacer = gtk_builtin_icon_new ("none");
|
||||||
gtk_box_append (GTK_BOX (box->item_box), spacer);
|
gtk_box_append (GTK_BOX (box->item_box), spacer);
|
||||||
gtk_size_group_add_widget (box->indicators, spacer);
|
gtk_size_group_add_widget (box->indicators, spacer);
|
||||||
|
|
||||||
|
|||||||
@@ -291,17 +291,6 @@ gtk_multi_selection_items_changed_cb (GListModel *model,
|
|||||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_N_ITEMS]);
|
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_N_ITEMS]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_multi_selection_sections_changed_cb (GtkSectionModel *model,
|
|
||||||
unsigned int position,
|
|
||||||
unsigned int n_items,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
GtkMultiSelection *self = GTK_MULTI_SELECTION (user_data);
|
|
||||||
|
|
||||||
gtk_section_model_sections_changed (GTK_SECTION_MODEL (self), position, n_items);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_multi_selection_clear_model (GtkMultiSelection *self)
|
gtk_multi_selection_clear_model (GtkMultiSelection *self)
|
||||||
{
|
{
|
||||||
@@ -311,9 +300,6 @@ gtk_multi_selection_clear_model (GtkMultiSelection *self)
|
|||||||
g_signal_handlers_disconnect_by_func (self->model,
|
g_signal_handlers_disconnect_by_func (self->model,
|
||||||
gtk_multi_selection_items_changed_cb,
|
gtk_multi_selection_items_changed_cb,
|
||||||
self);
|
self);
|
||||||
g_signal_handlers_disconnect_by_func (self->model,
|
|
||||||
gtk_multi_selection_sections_changed_cb,
|
|
||||||
self);
|
|
||||||
g_clear_object (&self->model);
|
g_clear_object (&self->model);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -504,9 +490,6 @@ gtk_multi_selection_set_model (GtkMultiSelection *self,
|
|||||||
"items-changed",
|
"items-changed",
|
||||||
G_CALLBACK (gtk_multi_selection_items_changed_cb),
|
G_CALLBACK (gtk_multi_selection_items_changed_cb),
|
||||||
self);
|
self);
|
||||||
if (GTK_IS_SECTION_MODEL (self->model))
|
|
||||||
g_signal_connect (self->model, "sections-changed",
|
|
||||||
G_CALLBACK (gtk_multi_selection_sections_changed_cb), self);
|
|
||||||
gtk_multi_selection_items_changed_cb (self->model,
|
gtk_multi_selection_items_changed_cb (self->model,
|
||||||
0,
|
0,
|
||||||
n_items_before,
|
n_items_before,
|
||||||
|
|||||||
+1
-20
@@ -33,8 +33,6 @@
|
|||||||
*
|
*
|
||||||
* This model is meant to be used as a simple wrapper around a `GListModel`
|
* This model is meant to be used as a simple wrapper around a `GListModel`
|
||||||
* when a `GtkSelectionModel` is required.
|
* when a `GtkSelectionModel` is required.
|
||||||
*
|
|
||||||
* `GtkNoSelection` passes through sections from the underlying model.
|
|
||||||
*/
|
*/
|
||||||
struct _GtkNoSelection
|
struct _GtkNoSelection
|
||||||
{
|
{
|
||||||
@@ -154,29 +152,15 @@ gtk_no_selection_items_changed_cb (GListModel *model,
|
|||||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_N_ITEMS]);
|
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_N_ITEMS]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_no_selection_sections_changed_cb (GtkSectionModel *model,
|
|
||||||
unsigned int position,
|
|
||||||
unsigned int n_items,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
GtkNoSelection *self = GTK_NO_SELECTION (user_data);
|
|
||||||
|
|
||||||
gtk_section_model_sections_changed (GTK_SECTION_MODEL (self), position, n_items);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_no_selection_clear_model (GtkNoSelection *self)
|
gtk_no_selection_clear_model (GtkNoSelection *self)
|
||||||
{
|
{
|
||||||
if (self->model == NULL)
|
if (self->model == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_signal_handlers_disconnect_by_func (self->model,
|
g_signal_handlers_disconnect_by_func (self->model,
|
||||||
gtk_no_selection_items_changed_cb,
|
gtk_no_selection_items_changed_cb,
|
||||||
self);
|
self);
|
||||||
g_signal_handlers_disconnect_by_func (self->model,
|
|
||||||
gtk_no_selection_sections_changed_cb,
|
|
||||||
self);
|
|
||||||
g_clear_object (&self->model);
|
g_clear_object (&self->model);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -361,9 +345,6 @@ gtk_no_selection_set_model (GtkNoSelection *self,
|
|||||||
self->model = g_object_ref (model);
|
self->model = g_object_ref (model);
|
||||||
g_signal_connect (self->model, "items-changed",
|
g_signal_connect (self->model, "items-changed",
|
||||||
G_CALLBACK (gtk_no_selection_items_changed_cb), self);
|
G_CALLBACK (gtk_no_selection_items_changed_cb), self);
|
||||||
if (GTK_IS_SECTION_MODEL (self->model))
|
|
||||||
g_signal_connect (self->model, "sections-changed",
|
|
||||||
G_CALLBACK (gtk_no_selection_sections_changed_cb), self);
|
|
||||||
n_items_after = g_list_model_get_n_items (self->model);
|
n_items_after = g_list_model_get_n_items (self->model);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
+5
-49
@@ -46,7 +46,6 @@
|
|||||||
#include "gtkorientable.h"
|
#include "gtkorientable.h"
|
||||||
#include "gtksizerequest.h"
|
#include "gtksizerequest.h"
|
||||||
#include "gtkprivate.h"
|
#include "gtkprivate.h"
|
||||||
#include "gtkselectionmodel.h"
|
|
||||||
#include "gtkstack.h"
|
#include "gtkstack.h"
|
||||||
#include "gtktypebuiltins.h"
|
#include "gtktypebuiltins.h"
|
||||||
#include "gtkwidgetprivate.h"
|
#include "gtkwidgetprivate.h"
|
||||||
@@ -1173,7 +1172,7 @@ gtk_notebook_class_init (GtkNotebookClass *class)
|
|||||||
*
|
*
|
||||||
* A selection model with the pages.
|
* A selection model with the pages.
|
||||||
*/
|
*/
|
||||||
properties[PROP_PAGES] =
|
properties[PROP_PAGES] =
|
||||||
g_param_spec_object ("pages", NULL, NULL,
|
g_param_spec_object ("pages", NULL, NULL,
|
||||||
G_TYPE_LIST_MODEL,
|
G_TYPE_LIST_MODEL,
|
||||||
GTK_PARAM_READABLE);
|
GTK_PARAM_READABLE);
|
||||||
@@ -1359,7 +1358,7 @@ gtk_notebook_class_init (GtkNotebookClass *class)
|
|||||||
/**
|
/**
|
||||||
* GtkNotebook|menu.popup:
|
* GtkNotebook|menu.popup:
|
||||||
*
|
*
|
||||||
* Opens the context menu.
|
* Opens the context menu.
|
||||||
*/
|
*/
|
||||||
gtk_widget_class_install_action (widget_class, "menu.popup", NULL, gtk_notebook_popup_menu);
|
gtk_widget_class_install_action (widget_class, "menu.popup", NULL, gtk_notebook_popup_menu);
|
||||||
|
|
||||||
@@ -1828,7 +1827,7 @@ gtk_notebook_reorder_tab (GtkNotebook *notebook,
|
|||||||
page_num = reorder_tab (notebook, child->next, notebook->focus_tab);
|
page_num = reorder_tab (notebook, child->next, notebook->focus_tab);
|
||||||
else
|
else
|
||||||
page_num = reorder_tab (notebook, child, notebook->focus_tab);
|
page_num = reorder_tab (notebook, child, notebook->focus_tab);
|
||||||
|
|
||||||
gtk_notebook_child_reordered (notebook, notebook->focus_tab->data);
|
gtk_notebook_child_reordered (notebook, notebook->focus_tab->data);
|
||||||
for (element = notebook->children, i = 0; element; element = element->next, i++)
|
for (element = notebook->children, i = 0; element; element = element->next, i++)
|
||||||
{
|
{
|
||||||
@@ -7132,7 +7131,7 @@ gtk_notebook_get_page (GtkNotebook *notebook,
|
|||||||
list = gtk_notebook_find_child (notebook, child);
|
list = gtk_notebook_find_child (notebook, child);
|
||||||
if (list != NULL)
|
if (list != NULL)
|
||||||
page = list->data;
|
page = list->data;
|
||||||
|
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7198,51 +7197,8 @@ gtk_notebook_pages_list_model_init (GListModelInterface *iface)
|
|||||||
iface->get_n_items = gtk_notebook_pages_get_n_items;
|
iface->get_n_items = gtk_notebook_pages_get_n_items;
|
||||||
iface->get_item = gtk_notebook_pages_get_item;
|
iface->get_item = gtk_notebook_pages_get_item;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
gtk_notebook_pages_is_selected (GtkSelectionModel *model,
|
|
||||||
guint position)
|
|
||||||
{
|
|
||||||
GtkNotebookPages *pages = GTK_NOTEBOOK_PAGES (model);
|
|
||||||
GtkNotebookPage *page;
|
|
||||||
|
|
||||||
page = g_list_nth_data (pages->notebook->children, position);
|
|
||||||
if (page == NULL)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
return page == pages->notebook->cur_page;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
gtk_notebook_pages_select_item (GtkSelectionModel *model,
|
|
||||||
guint position,
|
|
||||||
gboolean exclusive)
|
|
||||||
{
|
|
||||||
GtkNotebookPages *pages = GTK_NOTEBOOK_PAGES (model);
|
|
||||||
GtkNotebookPage *page;
|
|
||||||
|
|
||||||
page = g_list_nth_data (pages->notebook->children, position);
|
|
||||||
if (page == NULL)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if (page == pages->notebook->cur_page)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
gtk_notebook_switch_page (pages->notebook, page);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_notebook_pages_selection_model_init (GtkSelectionModelInterface *iface)
|
|
||||||
{
|
|
||||||
iface->is_selected = gtk_notebook_pages_is_selected;
|
|
||||||
iface->select_item = gtk_notebook_pages_select_item;
|
|
||||||
}
|
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (GtkNotebookPages, gtk_notebook_pages, G_TYPE_OBJECT,
|
G_DEFINE_TYPE_WITH_CODE (GtkNotebookPages, gtk_notebook_pages, G_TYPE_OBJECT,
|
||||||
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, gtk_notebook_pages_list_model_init)
|
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, gtk_notebook_pages_list_model_init))
|
||||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_SELECTION_MODEL, gtk_notebook_pages_selection_model_init))
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_notebook_pages_init (GtkNotebookPages *pages)
|
gtk_notebook_pages_init (GtkNotebookPages *pages)
|
||||||
|
|||||||
@@ -334,8 +334,8 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
|||||||
|
|
||||||
static GtkOrdering
|
static GtkOrdering
|
||||||
gtk_numeric_sorter_compare (GtkSorter *sorter,
|
gtk_numeric_sorter_compare (GtkSorter *sorter,
|
||||||
gpointer item1,
|
gpointer item1,
|
||||||
gpointer item2)
|
gpointer item2)
|
||||||
{
|
{
|
||||||
GtkNumericSorter *self = GTK_NUMERIC_SORTER (sorter);
|
GtkNumericSorter *self = GTK_NUMERIC_SORTER (sorter);
|
||||||
GValue value1 = G_VALUE_INIT;
|
GValue value1 = G_VALUE_INIT;
|
||||||
|
|||||||
@@ -108,7 +108,6 @@ enum {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
GtkWindow *parent;
|
GtkWindow *parent;
|
||||||
char *parent_handle;
|
|
||||||
GFile *file;
|
GFile *file;
|
||||||
char *uri;
|
char *uri;
|
||||||
gboolean open_folder;
|
gboolean open_folder;
|
||||||
@@ -129,9 +128,8 @@ open_uri_data_free (OpenUriData *data)
|
|||||||
g_clear_object (&data->connection);
|
g_clear_object (&data->connection);
|
||||||
if (data->cancel_handler)
|
if (data->cancel_handler)
|
||||||
g_signal_handler_disconnect (data->cancellable, data->cancel_handler);
|
g_signal_handler_disconnect (data->cancellable, data->cancel_handler);
|
||||||
if (data->parent && data->parent_handle)
|
if (data->parent)
|
||||||
gtk_window_unexport_handle (data->parent, data->parent_handle);
|
gtk_window_unexport_handle (data->parent);
|
||||||
g_free (data->parent_handle);
|
|
||||||
g_clear_object (&data->parent);
|
g_clear_object (&data->parent);
|
||||||
g_clear_object (&data->file);
|
g_clear_object (&data->file);
|
||||||
g_free (data->uri);
|
g_free (data->uri);
|
||||||
@@ -428,8 +426,6 @@ window_handle_exported (GtkWindow *window,
|
|||||||
GAppLaunchContext *context;
|
GAppLaunchContext *context;
|
||||||
char *activation_token = NULL;
|
char *activation_token = NULL;
|
||||||
|
|
||||||
data->parent_handle = g_strdup (handle);
|
|
||||||
|
|
||||||
if (window)
|
if (window)
|
||||||
display = gtk_widget_get_display (GTK_WIDGET (window));
|
display = gtk_widget_get_display (GTK_WIDGET (window));
|
||||||
else
|
else
|
||||||
|
|||||||
+1
-11
@@ -873,18 +873,8 @@ gtk_path_bar_get_mount_callback (GObject *source,
|
|||||||
{
|
{
|
||||||
GFile *file = G_FILE (source);
|
GFile *file = G_FILE (source);
|
||||||
struct SetFileInfo *file_info = data;
|
struct SetFileInfo *file_info = data;
|
||||||
GError *error = NULL;
|
|
||||||
|
|
||||||
file_info->mount = g_file_find_enclosing_mount_finish (file, result,
|
file_info->mount = g_file_find_enclosing_mount_finish (file, result, NULL);
|
||||||
&error);
|
|
||||||
|
|
||||||
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
|
|
||||||
{
|
|
||||||
gtk_path_bar_set_file_finish (file_info, FALSE);
|
|
||||||
g_clear_error (&error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
g_clear_error (&error);
|
|
||||||
|
|
||||||
if (file_info->mount)
|
if (file_info->mount)
|
||||||
file_info->root_file = g_mount_get_root (file_info->mount);
|
file_info->root_file = g_mount_get_root (file_info->mount);
|
||||||
|
|||||||
+1
-6
@@ -28,7 +28,7 @@
|
|||||||
#include "gtksnapshot.h"
|
#include "gtksnapshot.h"
|
||||||
#include "gtktypebuiltins.h"
|
#include "gtktypebuiltins.h"
|
||||||
#include "gtkwidgetprivate.h"
|
#include "gtkwidgetprivate.h"
|
||||||
#include "gdktextureutilsprivate.h"
|
#include "gdkpixbufutilsprivate.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GtkPicture:
|
* GtkPicture:
|
||||||
@@ -525,9 +525,6 @@ gtk_picture_new_for_paintable (GdkPaintable *paintable)
|
|||||||
* The pixbuf must not be modified after passing it to this function.
|
* The pixbuf must not be modified after passing it to this function.
|
||||||
*
|
*
|
||||||
* Returns: a new `GtkPicture`
|
* Returns: a new `GtkPicture`
|
||||||
*
|
|
||||||
* Deprecated: 4.12: Use [ctor@Gtk.Picture.new_for_paintable] and
|
|
||||||
* [ctor@Gdk.Texture.new_for_pixbuf] instead
|
|
||||||
*/
|
*/
|
||||||
GtkWidget*
|
GtkWidget*
|
||||||
gtk_picture_new_for_pixbuf (GdkPixbuf *pixbuf)
|
gtk_picture_new_for_pixbuf (GdkPixbuf *pixbuf)
|
||||||
@@ -782,8 +779,6 @@ gtk_picture_set_resource (GtkPicture *self,
|
|||||||
* See [ctor@Gtk.Picture.new_for_pixbuf] for details.
|
* See [ctor@Gtk.Picture.new_for_pixbuf] for details.
|
||||||
*
|
*
|
||||||
* This is a utility function that calls [method@Gtk.Picture.set_paintable].
|
* This is a utility function that calls [method@Gtk.Picture.set_paintable].
|
||||||
*
|
|
||||||
* Deprecated: 4.12: Use [method@Gtk.Picture.set_paintable] instead
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gtk_picture_set_pixbuf (GtkPicture *self,
|
gtk_picture_set_pixbuf (GtkPicture *self,
|
||||||
|
|||||||
+2
-2
@@ -39,7 +39,7 @@ GDK_AVAILABLE_IN_ALL
|
|||||||
GtkWidget* gtk_picture_new (void);
|
GtkWidget* gtk_picture_new (void);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GtkWidget* gtk_picture_new_for_paintable (GdkPaintable *paintable);
|
GtkWidget* gtk_picture_new_for_paintable (GdkPaintable *paintable);
|
||||||
GDK_DEPRECATED_IN_4_12_FOR(gtk_pixbuf_new_for_paintable)
|
GDK_AVAILABLE_IN_ALL
|
||||||
GtkWidget* gtk_picture_new_for_pixbuf (GdkPixbuf *pixbuf);
|
GtkWidget* gtk_picture_new_for_pixbuf (GdkPixbuf *pixbuf);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GtkWidget* gtk_picture_new_for_file (GFile *file);
|
GtkWidget* gtk_picture_new_for_file (GFile *file);
|
||||||
@@ -64,7 +64,7 @@ void gtk_picture_set_filename (GtkPicture
|
|||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
void gtk_picture_set_resource (GtkPicture *self,
|
void gtk_picture_set_resource (GtkPicture *self,
|
||||||
const char *resource_path);
|
const char *resource_path);
|
||||||
GDK_DEPRECATED_IN_4_12_FOR(gtk_picture_set_paintable)
|
GDK_AVAILABLE_IN_ALL
|
||||||
void gtk_picture_set_pixbuf (GtkPicture *self,
|
void gtk_picture_set_pixbuf (GtkPicture *self,
|
||||||
GdkPixbuf *pixbuf);
|
GdkPixbuf *pixbuf);
|
||||||
|
|
||||||
|
|||||||
+8
-9
@@ -483,7 +483,6 @@ create_popup_layout (GtkPopover *popover)
|
|||||||
GdkPopupLayout *layout;
|
GdkPopupLayout *layout;
|
||||||
GtkCssStyle *style;
|
GtkCssStyle *style;
|
||||||
GtkBorder shadow_width;
|
GtkBorder shadow_width;
|
||||||
gboolean ltr = gtk_widget_get_direction (GTK_WIDGET (popover)) != GTK_TEXT_DIR_RTL;
|
|
||||||
|
|
||||||
compute_surface_pointing_to (popover, &rect);
|
compute_surface_pointing_to (popover, &rect);
|
||||||
|
|
||||||
@@ -546,13 +545,13 @@ create_popup_layout (GtkPopover *popover)
|
|||||||
switch (gtk_widget_get_halign (GTK_WIDGET (popover)))
|
switch (gtk_widget_get_halign (GTK_WIDGET (popover)))
|
||||||
{
|
{
|
||||||
case GTK_ALIGN_START:
|
case GTK_ALIGN_START:
|
||||||
parent_anchor = ltr ? GDK_GRAVITY_NORTH_WEST : GDK_GRAVITY_NORTH_EAST;
|
parent_anchor = GDK_GRAVITY_NORTH_WEST;
|
||||||
surface_anchor = ltr ? GDK_GRAVITY_SOUTH_WEST : GDK_GRAVITY_SOUTH_EAST;
|
surface_anchor = GDK_GRAVITY_SOUTH_WEST;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GTK_ALIGN_END:
|
case GTK_ALIGN_END:
|
||||||
parent_anchor = ltr ? GDK_GRAVITY_NORTH_EAST : GDK_GRAVITY_NORTH_WEST;
|
parent_anchor = GDK_GRAVITY_NORTH_EAST;
|
||||||
surface_anchor = ltr ? GDK_GRAVITY_SOUTH_EAST : GDK_GRAVITY_SOUTH_WEST;
|
surface_anchor = GDK_GRAVITY_SOUTH_EAST;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GTK_ALIGN_FILL:
|
case GTK_ALIGN_FILL:
|
||||||
@@ -571,13 +570,13 @@ create_popup_layout (GtkPopover *popover)
|
|||||||
switch (gtk_widget_get_halign (GTK_WIDGET (popover)))
|
switch (gtk_widget_get_halign (GTK_WIDGET (popover)))
|
||||||
{
|
{
|
||||||
case GTK_ALIGN_START:
|
case GTK_ALIGN_START:
|
||||||
parent_anchor = ltr ? GDK_GRAVITY_SOUTH_WEST : GDK_GRAVITY_SOUTH_EAST;
|
parent_anchor = GDK_GRAVITY_SOUTH_WEST;
|
||||||
surface_anchor = ltr ? GDK_GRAVITY_NORTH_WEST : GDK_GRAVITY_NORTH_EAST;
|
surface_anchor = GDK_GRAVITY_NORTH_WEST;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GTK_ALIGN_END:
|
case GTK_ALIGN_END:
|
||||||
parent_anchor = ltr ? GDK_GRAVITY_SOUTH_EAST : GDK_GRAVITY_SOUTH_WEST;
|
parent_anchor = GDK_GRAVITY_SOUTH_EAST;
|
||||||
surface_anchor = ltr ? GDK_GRAVITY_NORTH_EAST : GDK_GRAVITY_NORTH_WEST;
|
surface_anchor = GDK_GRAVITY_NORTH_EAST;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GTK_ALIGN_FILL:
|
case GTK_ALIGN_FILL:
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ typedef struct {
|
|||||||
GtkPrintOperationResult result;
|
GtkPrintOperationResult result;
|
||||||
GtkPrintOperationPrintFunc print_cb;
|
GtkPrintOperationPrintFunc print_cb;
|
||||||
GtkWindow *parent;
|
GtkWindow *parent;
|
||||||
char *handle;
|
|
||||||
GMainLoop *loop;
|
GMainLoop *loop;
|
||||||
guint32 token;
|
guint32 token;
|
||||||
GDestroyNotify destroy;
|
GDestroyNotify destroy;
|
||||||
@@ -63,9 +62,8 @@ portal_data_free (gpointer data)
|
|||||||
{
|
{
|
||||||
PortalData *portal = data;
|
PortalData *portal = data;
|
||||||
|
|
||||||
if (portal->parent && portal->handle)
|
if (portal->parent)
|
||||||
gtk_window_unexport_handle (portal->parent, portal->handle);
|
gtk_window_unexport_handle (portal->parent);
|
||||||
g_free (portal->handle);
|
|
||||||
g_object_unref (portal->op);
|
g_object_unref (portal->op);
|
||||||
g_object_unref (portal->proxy);
|
g_object_unref (portal->proxy);
|
||||||
if (portal->loop)
|
if (portal->loop)
|
||||||
@@ -549,8 +547,6 @@ window_handle_exported (GtkWindow *window,
|
|||||||
{
|
{
|
||||||
PortalData *portal = user_data;
|
PortalData *portal = user_data;
|
||||||
|
|
||||||
portal->handle = g_strdup (handle_str);
|
|
||||||
|
|
||||||
g_dbus_proxy_call (portal->proxy,
|
g_dbus_proxy_call (portal->proxy,
|
||||||
"PreparePrint",
|
"PreparePrint",
|
||||||
g_variant_new ("(ss@a{sv}@a{sv}@a{sv})",
|
g_variant_new ("(ss@a{sv}@a{sv}@a{sv})",
|
||||||
|
|||||||
@@ -329,7 +329,7 @@ gtk_property_lookup_list_model_get_property (GObject *object,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_PROPERTY:
|
case PROP_PROPERTY:
|
||||||
g_value_set_string (value, self->property);
|
g_value_set_object (value, self->property);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -408,7 +408,7 @@ gtk_property_lookup_list_model_class_init (GtkPropertyLookupListModelClass *klas
|
|||||||
*/
|
*/
|
||||||
properties[PROP_OBJECT] =
|
properties[PROP_OBJECT] =
|
||||||
g_param_spec_object ("object", NULL, NULL,
|
g_param_spec_object ("object", NULL, NULL,
|
||||||
G_TYPE_OBJECT,
|
G_TYPE_LIST_MODEL,
|
||||||
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
||||||
|
|
||||||
g_object_class_install_properties (object_class, NUM_PROPERTIES, properties);
|
g_object_class_install_properties (object_class, NUM_PROPERTIES, properties);
|
||||||
@@ -417,7 +417,6 @@ gtk_property_lookup_list_model_class_init (GtkPropertyLookupListModelClass *klas
|
|||||||
static void
|
static void
|
||||||
gtk_property_lookup_list_model_init (GtkPropertyLookupListModel *self)
|
gtk_property_lookup_list_model_init (GtkPropertyLookupListModel *self)
|
||||||
{
|
{
|
||||||
self->item_type = G_TYPE_OBJECT;
|
|
||||||
self->items = g_ptr_array_new ();
|
self->items = g_ptr_array_new ();
|
||||||
/* add sentinel */
|
/* add sentinel */
|
||||||
g_ptr_array_add (self->items, NULL);
|
g_ptr_array_add (self->items, NULL);
|
||||||
|
|||||||
@@ -1431,7 +1431,6 @@ gtk_recent_manager_clamp_to_age (GtkRecentManager *manager,
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_strfreev (uris);
|
g_strfreev (uris);
|
||||||
g_date_time_unref (now);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -2181,16 +2180,13 @@ gtk_recent_info_get_uri_display (GtkRecentInfo *info)
|
|||||||
int
|
int
|
||||||
gtk_recent_info_get_age (GtkRecentInfo *info)
|
gtk_recent_info_get_age (GtkRecentInfo *info)
|
||||||
{
|
{
|
||||||
int diff;
|
|
||||||
GDateTime *now;
|
GDateTime *now;
|
||||||
|
|
||||||
g_return_val_if_fail (info != NULL, -1);
|
g_return_val_if_fail (info != NULL, -1);
|
||||||
|
|
||||||
now = g_date_time_new_now_utc ();
|
now = g_date_time_new_now_utc ();
|
||||||
diff = (int) (g_date_time_difference (now, info->modified) / (double)G_TIME_SPAN_DAY);
|
|
||||||
|
|
||||||
g_date_time_unref (now);
|
return (int) (g_date_time_difference (now, info->modified) / (double)G_TIME_SPAN_DAY);
|
||||||
return diff;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+1
-31
@@ -1750,38 +1750,8 @@ gtk_scrolled_window_measure (GtkWidget *widget,
|
|||||||
if (priv->child && gtk_widget_get_visible (priv->child))
|
if (priv->child && gtk_widget_get_visible (priv->child))
|
||||||
{
|
{
|
||||||
int min_child_size, nat_child_size;
|
int min_child_size, nat_child_size;
|
||||||
int child_for_size = -1;
|
|
||||||
|
|
||||||
/* We can pass on the requested size if we have a scrollbar policy that prevents scrolling in that direction */
|
gtk_widget_measure (priv->child, orientation, -1,
|
||||||
if ((orientation == GTK_ORIENTATION_VERTICAL && priv->hscrollbar_policy == GTK_POLICY_NEVER)
|
|
||||||
|| (orientation == GTK_ORIENTATION_HORIZONTAL && priv->vscrollbar_policy == GTK_POLICY_NEVER))
|
|
||||||
{
|
|
||||||
child_for_size = for_size;
|
|
||||||
|
|
||||||
/* If the other scrollbar is always visible and not an overlay scrollbar we must subtract it from the measure */
|
|
||||||
if (orientation == GTK_ORIENTATION_VERTICAL && !priv->use_indicators && priv->vscrollbar_policy == GTK_POLICY_ALWAYS)
|
|
||||||
{
|
|
||||||
int min_scrollbar_width;
|
|
||||||
|
|
||||||
gtk_widget_measure (priv->vscrollbar, GTK_ORIENTATION_HORIZONTAL, -1,
|
|
||||||
&min_scrollbar_width, NULL,
|
|
||||||
NULL, NULL);
|
|
||||||
|
|
||||||
child_for_size = MAX (0, child_for_size - min_scrollbar_width);
|
|
||||||
}
|
|
||||||
if (orientation == GTK_ORIENTATION_HORIZONTAL && !priv->use_indicators && priv->hscrollbar_policy == GTK_POLICY_ALWAYS)
|
|
||||||
{
|
|
||||||
int min_scrollbar_height;
|
|
||||||
|
|
||||||
gtk_widget_measure (priv->hscrollbar, GTK_ORIENTATION_VERTICAL, -1,
|
|
||||||
&min_scrollbar_height, NULL,
|
|
||||||
NULL, NULL);
|
|
||||||
|
|
||||||
child_for_size = MAX (0, child_for_size - min_scrollbar_height);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_widget_measure (priv->child, orientation, child_for_size,
|
|
||||||
&min_child_size, &nat_child_size,
|
&min_child_size, &nat_child_size,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
|
|
||||||
|
|||||||
+12
-11
@@ -26,19 +26,21 @@
|
|||||||
/**
|
/**
|
||||||
* GtkSectionModel:
|
* GtkSectionModel:
|
||||||
*
|
*
|
||||||
* `GtkSectionModel` is an interface that adds support for sections to list models.
|
* `GtkSectionModel` is an interface that adds support for section to list models.
|
||||||
*
|
*
|
||||||
* A `GtkSectionModel` groups successive items into so-called sections. List widgets
|
* This support is then used by widgets using list models to be able to group their
|
||||||
* like `GtkListView` and `GtkGridView` then allow displaying section headers for
|
* items into sections.
|
||||||
* these sections by installing a header factory.
|
|
||||||
*
|
*
|
||||||
* Many GTK list models support sections inherently, or they pass through the sections
|
* Many GTK list models support sections inherently, or they pass through the sections
|
||||||
* of a model they are wrapping.
|
* of a model they are wrapping.
|
||||||
*
|
*
|
||||||
* When the section groupings of a model change, the model will emit the
|
* A `GtkSectionModel` groups successive items into so-called sections. List widgets
|
||||||
|
* like `GtkListView` then allow displaying section headers for these sections.
|
||||||
|
*
|
||||||
|
* When the section groupings of a model changes, the model will emit the
|
||||||
* [signal@Gtk.SectionModel::sections-changed] signal by calling the
|
* [signal@Gtk.SectionModel::sections-changed] signal by calling the
|
||||||
* [method@Gtk.SectionModel.sections_changed] function. All sections in the given range
|
* [method@Gtk.SectionModel.sections_changed] function. All sections in the given range
|
||||||
* then need to be queried again.
|
* now need to be queried again.
|
||||||
* The [signal@Gio.ListModel::items-changed] signal has the same effect, all sections in
|
* The [signal@Gio.ListModel::items-changed] signal has the same effect, all sections in
|
||||||
* that range are invalidated, too.
|
* that range are invalidated, too.
|
||||||
*
|
*
|
||||||
@@ -194,11 +196,10 @@ gtk_list_model_get_section (GListModel *self,
|
|||||||
* @n_items: the number of changed items
|
* @n_items: the number of changed items
|
||||||
*
|
*
|
||||||
* This function emits the [signal@Gtk.SectionModel::section-changed]
|
* This function emits the [signal@Gtk.SectionModel::section-changed]
|
||||||
* signal to notify about changes to sections.
|
* signal to notify about changes to sections. It must cover all
|
||||||
*
|
* positions that used to be a section start or that are now a section
|
||||||
* It must cover all positions that used to be a section start or that
|
* start. It does not have to cover all positions for which the section
|
||||||
* are now a section start. It does not have to cover all positions for
|
* has changed.
|
||||||
* which the section has changed.
|
|
||||||
*
|
*
|
||||||
* The [signal@Gio.ListModel::items-changed] implies the effect of the
|
* The [signal@Gio.ListModel::items-changed] implies the effect of the
|
||||||
* [signal@Gtk.SectionModel::section-changed] signal for all the items
|
* [signal@Gtk.SectionModel::section-changed] signal for all the items
|
||||||
|
|||||||
@@ -300,29 +300,15 @@ gtk_single_selection_items_changed_cb (GListModel *model,
|
|||||||
g_object_thaw_notify (G_OBJECT (self));
|
g_object_thaw_notify (G_OBJECT (self));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_single_selection_sections_changed_cb (GtkSectionModel *model,
|
|
||||||
unsigned int position,
|
|
||||||
unsigned int n_items,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
GtkSingleSelection *self = GTK_SINGLE_SELECTION (user_data);
|
|
||||||
|
|
||||||
gtk_section_model_sections_changed (GTK_SECTION_MODEL (self), position, n_items);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_single_selection_clear_model (GtkSingleSelection *self)
|
gtk_single_selection_clear_model (GtkSingleSelection *self)
|
||||||
{
|
{
|
||||||
if (self->model == NULL)
|
if (self->model == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_signal_handlers_disconnect_by_func (self->model,
|
g_signal_handlers_disconnect_by_func (self->model,
|
||||||
gtk_single_selection_items_changed_cb,
|
gtk_single_selection_items_changed_cb,
|
||||||
self);
|
self);
|
||||||
g_signal_handlers_disconnect_by_func (self->model,
|
|
||||||
gtk_single_selection_sections_changed_cb,
|
|
||||||
self);
|
|
||||||
g_clear_object (&self->model);
|
g_clear_object (&self->model);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -572,7 +558,7 @@ gtk_single_selection_set_model (GtkSingleSelection *self,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
g_object_freeze_notify (G_OBJECT (self));
|
g_object_freeze_notify (G_OBJECT (self));
|
||||||
|
|
||||||
n_items_before = self->model ? g_list_model_get_n_items (self->model) : 0;
|
n_items_before = self->model ? g_list_model_get_n_items (self->model) : 0;
|
||||||
gtk_single_selection_clear_model (self);
|
gtk_single_selection_clear_model (self);
|
||||||
|
|
||||||
@@ -581,9 +567,6 @@ gtk_single_selection_set_model (GtkSingleSelection *self,
|
|||||||
self->model = g_object_ref (model);
|
self->model = g_object_ref (model);
|
||||||
g_signal_connect (self->model, "items-changed",
|
g_signal_connect (self->model, "items-changed",
|
||||||
G_CALLBACK (gtk_single_selection_items_changed_cb), self);
|
G_CALLBACK (gtk_single_selection_items_changed_cb), self);
|
||||||
if (GTK_IS_SECTION_MODEL (self->model))
|
|
||||||
g_signal_connect (self->model, "sections-changed",
|
|
||||||
G_CALLBACK (gtk_single_selection_sections_changed_cb), self);
|
|
||||||
gtk_single_selection_items_changed_cb (self->model,
|
gtk_single_selection_items_changed_cb (self->model,
|
||||||
0,
|
0,
|
||||||
n_items_before,
|
n_items_before,
|
||||||
|
|||||||
+3
-69
@@ -20,7 +20,6 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include "gtkslicelistmodel.h"
|
#include "gtkslicelistmodel.h"
|
||||||
#include "gtksectionmodelprivate.h"
|
|
||||||
|
|
||||||
#include "gtkprivate.h"
|
#include "gtkprivate.h"
|
||||||
|
|
||||||
@@ -32,8 +31,6 @@
|
|||||||
* This is useful when implementing paging by setting the size to the number
|
* This is useful when implementing paging by setting the size to the number
|
||||||
* of elements per page and updating the offset whenever a different page is
|
* of elements per page and updating the offset whenever a different page is
|
||||||
* opened.
|
* opened.
|
||||||
*
|
|
||||||
* `GtkSliceListModel` passes through sections from the underlying model.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define DEFAULT_SIZE 10
|
#define DEFAULT_SIZE 10
|
||||||
@@ -55,6 +52,8 @@ struct _GtkSliceListModel
|
|||||||
GListModel *model;
|
GListModel *model;
|
||||||
guint offset;
|
guint offset;
|
||||||
guint size;
|
guint size;
|
||||||
|
|
||||||
|
guint n_items;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GtkSliceListModelClass
|
struct _GtkSliceListModelClass
|
||||||
@@ -112,69 +111,8 @@ gtk_slice_list_model_model_init (GListModelInterface *iface)
|
|||||||
iface->get_item = gtk_slice_list_model_get_item;
|
iface->get_item = gtk_slice_list_model_get_item;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_slice_list_model_get_section (GtkSectionModel *model,
|
|
||||||
guint position,
|
|
||||||
guint *start,
|
|
||||||
guint *end)
|
|
||||||
{
|
|
||||||
GtkSliceListModel *self = GTK_SLICE_LIST_MODEL (model);
|
|
||||||
unsigned int n_items;
|
|
||||||
|
|
||||||
n_items = g_list_model_get_n_items (G_LIST_MODEL (self));
|
|
||||||
if (position >= n_items)
|
|
||||||
{
|
|
||||||
*start = n_items;
|
|
||||||
*end = G_MAXUINT;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gtk_list_model_get_section (self->model, position + self->offset, start, end);
|
|
||||||
|
|
||||||
*start = MAX (*start, self->offset) - self->offset;
|
|
||||||
*end = MIN (*end - self->offset, n_items);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_slice_list_model_sections_changed_cb (GtkSectionModel *model,
|
|
||||||
unsigned int position,
|
|
||||||
unsigned int n_items,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
GtkSliceListModel *self = GTK_SLICE_LIST_MODEL (user_data);
|
|
||||||
unsigned int start = position;
|
|
||||||
unsigned int end = position + n_items;
|
|
||||||
unsigned int size;
|
|
||||||
|
|
||||||
if (end <= self->offset)
|
|
||||||
return;
|
|
||||||
|
|
||||||
size = g_list_model_get_n_items (G_LIST_MODEL (self));
|
|
||||||
|
|
||||||
end = MIN (end - self->offset, size);
|
|
||||||
|
|
||||||
if (start <= self->offset)
|
|
||||||
start = 0;
|
|
||||||
else
|
|
||||||
start = start - self->offset;
|
|
||||||
|
|
||||||
if (start >= size)
|
|
||||||
return;
|
|
||||||
|
|
||||||
gtk_section_model_sections_changed (GTK_SECTION_MODEL (self), start, end - start);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_slice_list_model_section_model_init (GtkSectionModelInterface *iface)
|
|
||||||
{
|
|
||||||
iface->get_section = gtk_slice_list_model_get_section;
|
|
||||||
}
|
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (GtkSliceListModel, gtk_slice_list_model, G_TYPE_OBJECT,
|
G_DEFINE_TYPE_WITH_CODE (GtkSliceListModel, gtk_slice_list_model, G_TYPE_OBJECT,
|
||||||
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, gtk_slice_list_model_model_init)
|
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, gtk_slice_list_model_model_init))
|
||||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_SECTION_MODEL, gtk_slice_list_model_section_model_init))
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_slice_list_model_items_changed_cb (GListModel *model,
|
gtk_slice_list_model_items_changed_cb (GListModel *model,
|
||||||
@@ -300,7 +238,6 @@ gtk_slice_list_model_clear_model (GtkSliceListModel *self)
|
|||||||
if (self->model == NULL)
|
if (self->model == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_signal_handlers_disconnect_by_func (self->model, gtk_slice_list_model_sections_changed_cb, self);
|
|
||||||
g_signal_handlers_disconnect_by_func (self->model, gtk_slice_list_model_items_changed_cb, self);
|
g_signal_handlers_disconnect_by_func (self->model, gtk_slice_list_model_items_changed_cb, self);
|
||||||
g_clear_object (&self->model);
|
g_clear_object (&self->model);
|
||||||
}
|
}
|
||||||
@@ -450,9 +387,6 @@ gtk_slice_list_model_set_model (GtkSliceListModel *self,
|
|||||||
self->model = g_object_ref (model);
|
self->model = g_object_ref (model);
|
||||||
g_signal_connect (model, "items-changed", G_CALLBACK (gtk_slice_list_model_items_changed_cb), self);
|
g_signal_connect (model, "items-changed", G_CALLBACK (gtk_slice_list_model_items_changed_cb), self);
|
||||||
added = g_list_model_get_n_items (G_LIST_MODEL (self));
|
added = g_list_model_get_n_items (G_LIST_MODEL (self));
|
||||||
|
|
||||||
if (GTK_IS_SECTION_MODEL (model))
|
|
||||||
g_signal_connect (model, "sections-changed", G_CALLBACK (gtk_slice_list_model_sections_changed_cb), self);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+19
-36
@@ -873,10 +873,9 @@ gtk_sort_list_model_get_property (GObject *object,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_sort_list_model_sorter_changed (GtkSorter *sorter,
|
gtk_sort_list_model_sorter_changed_cb (GtkSorter *sorter,
|
||||||
int change,
|
int change,
|
||||||
GtkSortListModel *self,
|
GtkSortListModel *self)
|
||||||
gboolean sections_changed)
|
|
||||||
{
|
{
|
||||||
guint pos, n_items;
|
guint pos, n_items;
|
||||||
|
|
||||||
@@ -913,12 +912,6 @@ gtk_sort_list_model_sorter_changed (GtkSorter *sorter,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self->section_sorter)
|
|
||||||
{
|
|
||||||
gtk_sort_keys_unref (self->section_sort_keys);
|
|
||||||
self->section_sort_keys = gtk_sorter_get_keys (self->section_sorter);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gtk_sort_list_model_start_sorting (self, NULL))
|
if (gtk_sort_list_model_start_sorting (self, NULL))
|
||||||
pos = n_items = 0;
|
pos = n_items = 0;
|
||||||
else
|
else
|
||||||
@@ -929,25 +922,8 @@ gtk_sort_list_model_sorter_changed (GtkSorter *sorter,
|
|||||||
gtk_sort_list_model_clear_items (self, &pos, &n_items);
|
gtk_sort_list_model_clear_items (self, &pos, &n_items);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sections_changed && self->n_items > 0)
|
if (n_items > 0)
|
||||||
{
|
g_list_model_items_changed (G_LIST_MODEL (self), pos, n_items, n_items);
|
||||||
if (n_items > 0)
|
|
||||||
g_list_model_items_changed (G_LIST_MODEL (self), 0, self->n_items, self->n_items);
|
|
||||||
else
|
|
||||||
gtk_section_model_sections_changed (GTK_SECTION_MODEL (self), 0, self->n_items);
|
|
||||||
}
|
|
||||||
else if (n_items > 0)
|
|
||||||
{
|
|
||||||
g_list_model_items_changed (G_LIST_MODEL (self), pos, n_items, n_items);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_sort_list_model_sorter_changed_cb (GtkSorter *sorter,
|
|
||||||
int change,
|
|
||||||
GtkSortListModel *self)
|
|
||||||
{
|
|
||||||
gtk_sort_list_model_sorter_changed (sorter, change, self, FALSE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -973,8 +949,7 @@ gtk_sort_list_model_clear_real_sorter (GtkSortListModel *self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_sort_list_model_ensure_real_sorter (GtkSortListModel *self,
|
gtk_sort_list_model_ensure_real_sorter (GtkSortListModel *self)
|
||||||
gboolean sections_changed)
|
|
||||||
{
|
{
|
||||||
if (self->sorter)
|
if (self->sorter)
|
||||||
{
|
{
|
||||||
@@ -999,7 +974,7 @@ gtk_sort_list_model_ensure_real_sorter (GtkSortListModel *self,
|
|||||||
if (self->real_sorter)
|
if (self->real_sorter)
|
||||||
g_signal_connect (self->real_sorter, "changed", G_CALLBACK (gtk_sort_list_model_sorter_changed_cb), self);
|
g_signal_connect (self->real_sorter, "changed", G_CALLBACK (gtk_sort_list_model_sorter_changed_cb), self);
|
||||||
|
|
||||||
gtk_sort_list_model_sorter_changed (self->real_sorter, GTK_SORTER_CHANGE_DIFFERENT, self, sections_changed);
|
gtk_sort_list_model_sorter_changed_cb (self->real_sorter, GTK_SORTER_CHANGE_DIFFERENT, self);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1220,8 +1195,12 @@ gtk_sort_list_model_set_sorter (GtkSortListModel *self,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
gtk_sort_list_model_clear_real_sorter (self);
|
gtk_sort_list_model_clear_real_sorter (self);
|
||||||
g_set_object (&self->sorter, sorter);
|
g_clear_object (&self->sorter);
|
||||||
gtk_sort_list_model_ensure_real_sorter (self, FALSE);
|
|
||||||
|
if (sorter)
|
||||||
|
self->sorter = g_object_ref (sorter);
|
||||||
|
|
||||||
|
gtk_sort_list_model_ensure_real_sorter (self);
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SORTER]);
|
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SORTER]);
|
||||||
}
|
}
|
||||||
@@ -1262,8 +1241,12 @@ gtk_sort_list_model_set_section_sorter (GtkSortListModel *self,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
gtk_sort_list_model_clear_real_sorter (self);
|
gtk_sort_list_model_clear_real_sorter (self);
|
||||||
g_set_object (&self->section_sorter, sorter);
|
g_clear_object (&self->section_sorter);
|
||||||
gtk_sort_list_model_ensure_real_sorter (self, TRUE);
|
|
||||||
|
if (sorter)
|
||||||
|
self->section_sorter = g_object_ref (sorter);
|
||||||
|
|
||||||
|
gtk_sort_list_model_ensure_real_sorter (self);
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SECTION_SORTER]);
|
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SECTION_SORTER]);
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user