Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f2e45bbc87 | |||
| 9965cfbc3b |
@@ -1,2 +1 @@
|
||||
/subprojects/*/
|
||||
.flatpak-builder/
|
||||
|
||||
+1
-21
@@ -24,7 +24,7 @@ stages:
|
||||
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"
|
||||
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
|
||||
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
|
||||
- .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:
|
||||
extends: .build-fedora-default
|
||||
stage: build
|
||||
|
||||
@@ -1,56 +1,6 @@
|
||||
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
|
||||
=========================================
|
||||
|
||||
|
||||
@@ -43,7 +43,6 @@ update_image (void)
|
||||
cairo_t *cr;
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkPixbuf *pixbuf2;
|
||||
GdkTexture *texture;
|
||||
cairo_font_options_t *fopt;
|
||||
cairo_hint_style_t hintstyle;
|
||||
cairo_hint_metrics_t hintmetrics;
|
||||
@@ -121,17 +120,8 @@ update_image (void)
|
||||
cairo_destroy (cr);
|
||||
g_object_unref (layout);
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_data (cairo_image_surface_get_data (surface),
|
||||
GDK_COLORSPACE_RGB, TRUE, 8,
|
||||
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);
|
||||
pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, cairo_image_surface_get_width (surface), cairo_image_surface_get_height (surface));
|
||||
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);
|
||||
cairo_surface_destroy (surface);
|
||||
@@ -288,24 +278,14 @@ retry:
|
||||
pango_layout_iter_free (iter);
|
||||
g_object_unref (layout);
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_data (cairo_image_surface_get_data (surface),
|
||||
GDK_COLORSPACE_RGB, TRUE, 8,
|
||||
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);
|
||||
pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, cairo_image_surface_get_width (surface), cairo_image_surface_get_height (surface));
|
||||
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);
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
|
||||
texture = gdk_texture_new_for_pixbuf (pixbuf2);
|
||||
gtk_picture_set_paintable (GTK_PICTURE (image), GDK_PAINTABLE (texture));
|
||||
g_object_unref (pixbuf2);
|
||||
gtk_picture_set_pixbuf (GTK_PICTURE (image), pixbuf2);
|
||||
|
||||
g_object_unref (pixbuf2);
|
||||
}
|
||||
|
||||
|
||||
+11
-10
@@ -30,7 +30,6 @@ progressive_prepared_callback (GdkPixbufLoader *loader,
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
GtkWidget *picture;
|
||||
GdkTexture *texture;
|
||||
|
||||
picture = GTK_WIDGET (data);
|
||||
|
||||
@@ -41,9 +40,7 @@ progressive_prepared_callback (GdkPixbufLoader *loader,
|
||||
*/
|
||||
gdk_pixbuf_fill (pixbuf, 0xaaaaaaff);
|
||||
|
||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
||||
gtk_picture_set_paintable (GTK_PICTURE (picture), GDK_PAINTABLE (texture));
|
||||
g_object_unref (texture);
|
||||
gtk_picture_set_pixbuf (GTK_PICTURE (picture), pixbuf);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -54,18 +51,22 @@ progressive_updated_callback (GdkPixbufLoader *loader,
|
||||
int height,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *picture = GTK_WIDGET (data);
|
||||
GdkTexture *texture;
|
||||
GtkWidget *picture;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
texture = gdk_texture_new_for_pixbuf (gdk_pixbuf_loader_get_pixbuf (loader));
|
||||
gtk_picture_set_paintable (GTK_PICTURE (picture), GDK_PAINTABLE (texture));
|
||||
g_object_unref (texture);
|
||||
picture = GTK_WIDGET (data);
|
||||
|
||||
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
|
||||
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.
|
||||
* You could factor out the error handling code into a nice separate
|
||||
|
||||
@@ -1701,13 +1701,6 @@ node_editor_window_init (NodeEditorWindow *self)
|
||||
" }\n"
|
||||
" transform: translate(0, 140);\n"
|
||||
"}", -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 *
|
||||
|
||||
@@ -1210,12 +1210,12 @@ typedef struct {
|
||||
static void
|
||||
add_background (GtkWidget *flowbox,
|
||||
const char *filename,
|
||||
GdkTexture *texture,
|
||||
GdkPixbuf *pixbuf,
|
||||
gboolean is_resource)
|
||||
{
|
||||
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_flow_box_insert (GTK_FLOW_BOX (flowbox), child, -1);
|
||||
child = gtk_widget_get_parent (child);
|
||||
@@ -1231,7 +1231,6 @@ background_loaded_cb (GObject *source,
|
||||
{
|
||||
BackgroundData *bd = data;
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkTexture *texture;
|
||||
GError *error = NULL;
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_stream_finish (res, &error);
|
||||
@@ -1242,11 +1241,8 @@ background_loaded_cb (GObject *source,
|
||||
return;
|
||||
}
|
||||
|
||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
||||
add_background (bd->flowbox, bd->filename, texture, FALSE);
|
||||
add_background (bd->flowbox, bd->filename, pixbuf, FALSE);
|
||||
|
||||
g_object_unref (texture);
|
||||
g_object_unref (pixbuf);
|
||||
g_free (bd->filename);
|
||||
g_free (bd);
|
||||
}
|
||||
@@ -1263,10 +1259,7 @@ populate_flowbox (GtkWidget *flowbox)
|
||||
GInputStream *stream;
|
||||
BackgroundData *bd;
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkTexture *texture;
|
||||
GtkWidget *child;
|
||||
guchar *data;
|
||||
GBytes *bytes;
|
||||
int i;
|
||||
const char *resources[] = {
|
||||
"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));
|
||||
|
||||
data = g_malloc (4 * 110 * 70);
|
||||
memset (data, 0xff, 4 * 110 * 70);
|
||||
bytes = g_bytes_new_take (data, 4 * 110 * 70);
|
||||
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);
|
||||
|
||||
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, 110, 70);
|
||||
gdk_pixbuf_fill (pixbuf, 0xffffffff);
|
||||
child = gtk_picture_new_for_pixbuf (pixbuf);
|
||||
gtk_widget_add_css_class (child, "frame");
|
||||
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);
|
||||
pixbuf = gdk_pixbuf_new_from_resource_at_scale (filename, 110, 110, TRUE, NULL);
|
||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
||||
add_background (flowbox, filename, texture, TRUE);
|
||||
g_object_unref (texture);
|
||||
g_object_unref (pixbuf);
|
||||
add_background (flowbox, filename, pixbuf, TRUE);
|
||||
}
|
||||
|
||||
location = "/usr/share/backgrounds/gnome";
|
||||
|
||||
@@ -2244,24 +2244,20 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="spacing">6</property>
|
||||
<property name="valign">center</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="lockbox">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="spacing">6</property>
|
||||
<property name="valign">center</property>
|
||||
<child>
|
||||
<object class="GtkMenuButton" id="open_menubutton">
|
||||
<property name="halign">3</property>
|
||||
<property name="popover">open_popover</property>
|
||||
<property name="label">Open</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="record_button">
|
||||
<property name="halign">3</property>
|
||||
<property name="valign">center</property>
|
||||
<signal name="toggled" handler="on_record_button_toggled"/>
|
||||
<style>
|
||||
<class name="text-button"/>
|
||||
@@ -2271,19 +2267,16 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="spacing">6</property>
|
||||
<property name="valign">center</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="valign">4</property>
|
||||
<property name="icon-name">media-record-symbolic</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="valign">4</property>
|
||||
<property name="label">Record</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@@ -2292,7 +2285,6 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="valign">center</property>
|
||||
<style>
|
||||
<class name="linked"/>
|
||||
</style>
|
||||
@@ -2300,14 +2292,12 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<object class="GtkToggleButton" id="grid_button">
|
||||
<property name="active">1</property>
|
||||
<property name="icon-name">view-grid-symbolic</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="list_button">
|
||||
<property name="group">grid_button</property>
|
||||
<property name="icon-name">view-list-symbolic</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@@ -2315,7 +2305,6 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="circular_button">
|
||||
<property name="icon-name">emblem-system-symbolic</property>
|
||||
<property name="valign">center</property>
|
||||
<style>
|
||||
<class name="circular"/>
|
||||
</style>
|
||||
@@ -2324,15 +2313,12 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLockButton" id="lockbutton">
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
<object class="GtkLockButton" id="lockbutton"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuButton">
|
||||
<property name="icon-name">view-more-symbolic</property>
|
||||
<property name="menu-model">new_style_menu_model</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
@@ -220,6 +220,6 @@ clipboard.cut, clipboard.copy, clipboard.paste
|
||||
selection.delete, selection.select-all
|
||||
: 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
|
||||
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-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: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: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) | |
|
||||
|
||||
@@ -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
|
||||
can also be moved around with certain key events (this is known as
|
||||
“keyboard navigation”).
|
||||
GTK reserves the <kbd>Tab</kbd> key to move the focus to the next location,
|
||||
and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move it back to the previous one.
|
||||
In addition many containers allow “directional navigation” with the arrow keys.
|
||||
“keyboard navigation”). GTK reserves the <kbd>Tab</kbd> key to move the focus
|
||||
to the next location, and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move it back to the previous
|
||||
one. In addition many containers allow “directional navigation” with
|
||||
the arrow keys.
|
||||
|
||||
Many widgets can be “activated” to trigger and action.
|
||||
E.g., you can activate a button or switch by clicking on them,
|
||||
but you can also activate them with the keyboard,
|
||||
by using the <kbd>Enter</kbd> or <kbd>Space</kbd> keys.
|
||||
Many widgets can be “activated” to trigger and action. E.g., you can
|
||||
activate a button or switch by clicking on them, but you can also
|
||||
activate them with the keyboard, by using the <kbd>Enter</kbd> or <kbd>␣</kbd> keys.
|
||||
|
||||
Apart from keyboard navigation, activation and directly typing into
|
||||
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
|
||||
of where the focus is, and typically trigger global actions, such as
|
||||
<kbd>Ctrl</kbd>+<kbd>Q</kbd> to quit an application.
|
||||
- Mnemonics are usually triggered using <kbd>Alt</kbd>
|
||||
as a modifier for a letter.
|
||||
Ctrl-Q to quit an application.
|
||||
- Mnemonics are usually triggered using Alt as a modifier for a letter.
|
||||
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
|
||||
case, inside menus (i.e. inside `GtkPopoverMenu`), mnemonics can be
|
||||
triggered without the modifier.
|
||||
- Key bindings are specific to individual widgets,
|
||||
such as <kbd>Ctrl</kbd>+<kbd>C</kbd> or <kbd>Ctrl</kbd>+<kbd>V</kbd>
|
||||
in an entry copy to or paste from the clipboard.
|
||||
They are only triggered when the widget has focus.
|
||||
- Key bindings are specific to individual widgets, such as Ctrl-C or
|
||||
Ctrl-V in an entry copy to or paste from the clipboard. They are only
|
||||
triggered when the widget has focus.
|
||||
|
||||
GTK handles accelerators and mnemonics in a global scope, during the
|
||||
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
|
||||
where may be only one gesture group claiming a given sequence.
|
||||
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.
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
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);
|
||||
GtkTextView *text = g_object_get_data ((GObject*)window, "plugman-text");
|
||||
|
||||
|
||||
gtk_text_buffer_paste_clipboard (gtk_text_view_get_buffer (text),
|
||||
gtk_widget_get_clipboard (GTK_WIDGET (text)),
|
||||
NULL,
|
||||
@@ -221,7 +221,7 @@ plugin_action (GAction *action,
|
||||
g_message ("Color: %s", g_action_get_name (action));
|
||||
|
||||
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_PROVIDER (css_provider),
|
||||
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/gdkpaintable.h>
|
||||
#include <gdk/gdkpango.h>
|
||||
#include <gdk/deprecated/gdkpixbuf.h>
|
||||
#include <gdk/gdkpixbuf.h>
|
||||
#include <gdk/gdkpopup.h>
|
||||
#include <gdk/gdkpopuplayout.h>
|
||||
#include <gdk/gdkrectangle.h>
|
||||
|
||||
+38
-3
@@ -17,7 +17,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkcairo.h"
|
||||
#include "gdkcairoprivate.h"
|
||||
|
||||
#include "gdkrgba.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,
|
||||
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
|
||||
*/
|
||||
static gboolean
|
||||
gboolean
|
||||
_gdk_cairo_surface_extents (cairo_surface_t *surface,
|
||||
GdkRectangle *extents)
|
||||
{
|
||||
@@ -303,3 +303,38 @@ gdk_cairo_region_create_from_surface (cairo_surface_t *surface)
|
||||
|
||||
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
|
||||
|
||||
#include <gdk/gdktypes.h>
|
||||
#include <gdk/deprecated/gdkpixbuf.h>
|
||||
#include <gdk/gdkpixbuf.h>
|
||||
#include <pango/pangocairo.h>
|
||||
|
||||
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 "gdkcontentformats.h"
|
||||
#include "deprecated/gdkpixbuf.h"
|
||||
#include "gdkpixbuf.h"
|
||||
#include "filetransferportalprivate.h"
|
||||
#include "gdktextureprivate.h"
|
||||
#include "gdkrgba.h"
|
||||
@@ -642,9 +642,7 @@ pixbuf_serializer (GdkContentSerializer *serializer)
|
||||
else if (G_VALUE_HOLDS (value, GDK_TYPE_TEXTURE))
|
||||
{
|
||||
GdkTexture *texture = g_value_get_object (value);
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
pixbuf = gdk_pixbuf_get_from_texture (texture);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -371,12 +371,6 @@ gdk_draw_context_begin_frame_full (GdkDrawContext *context,
|
||||
priv->surface->paint_context = g_object_ref (context);
|
||||
|
||||
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
|
||||
|
||||
+23
-23
@@ -466,26 +466,29 @@ gdk_gl_context_real_get_damage (GdkGLContext *context)
|
||||
eglQuerySurface (gdk_display_get_egl_display (display), egl_surface,
|
||||
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 ();
|
||||
int i;
|
||||
case 1:
|
||||
return cairo_region_create ();
|
||||
break;
|
||||
|
||||
for (i = 0; i < buffer_age - 1; i++)
|
||||
{
|
||||
if (context->old_updated_area[i] == NULL)
|
||||
{
|
||||
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]);
|
||||
}
|
||||
case 2:
|
||||
if (context->old_updated_area[0])
|
||||
return cairo_region_copy (context->old_updated_area[0]);
|
||||
break;
|
||||
|
||||
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
|
||||
@@ -594,7 +597,6 @@ gdk_gl_context_real_begin_frame (GdkDrawContext *draw_context,
|
||||
cairo_region_t *damage;
|
||||
double scale;
|
||||
int ww, wh;
|
||||
int i;
|
||||
|
||||
surface = gdk_draw_context_get_surface (draw_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);
|
||||
|
||||
g_clear_pointer (&context->old_updated_area[GDK_GL_MAX_TRACKED_BUFFERS - 1], cairo_region_destroy);
|
||||
for (i = GDK_GL_MAX_TRACKED_BUFFERS - 1; i > 0; i--)
|
||||
{
|
||||
context->old_updated_area[i] = context->old_updated_area[i - 1];
|
||||
}
|
||||
if (context->old_updated_area[1])
|
||||
cairo_region_destroy (context->old_updated_area[1]);
|
||||
context->old_updated_area[1] = context->old_updated_area[0];
|
||||
context->old_updated_area[0] = cairo_region_copy (region);
|
||||
|
||||
cairo_region_union (region, damage);
|
||||
|
||||
@@ -34,11 +34,6 @@ typedef enum {
|
||||
GDK_GL_CGL
|
||||
} 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_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))
|
||||
@@ -50,7 +45,7 @@ struct _GdkGLContext
|
||||
GdkDrawContext parent_instance;
|
||||
|
||||
/* 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
|
||||
|
||||
@@ -157,9 +157,6 @@ convert_no_alpha (guchar *dest_data,
|
||||
*
|
||||
* Returns: (nullable) (transfer full): A newly-created pixbuf with a
|
||||
* reference count of 1
|
||||
*
|
||||
* Deprecated: 4.12: Use [class@Gdk.Texture] and subclasses instead
|
||||
* cairo surfaces and pixbufs
|
||||
*/
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf_get_from_surface (cairo_surface_t *surface,
|
||||
@@ -237,9 +234,6 @@ pixbuf_texture_unref_cb (guchar *pixels,
|
||||
* to draw it on screen.
|
||||
*
|
||||
* Returns: (transfer full) (nullable): a new `GdkPixbuf`
|
||||
*
|
||||
* Deprecated: 4.12: Use [class@Gdk.Texture] and subclasses instead
|
||||
* cairo surfaces and pixbufs
|
||||
*/
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf_get_from_texture (GdkTexture *texture)
|
||||
@@ -33,13 +33,13 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GDK_DEPRECATED_IN_4_12
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkPixbuf *gdk_pixbuf_get_from_surface (cairo_surface_t *surface,
|
||||
int src_x,
|
||||
int src_y,
|
||||
int width,
|
||||
int height);
|
||||
GDK_DEPRECATED_IN_4_12
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkPixbuf *gdk_pixbuf_get_from_texture (GdkTexture *texture);
|
||||
|
||||
G_END_DECLS
|
||||
+1
-3
@@ -170,7 +170,7 @@ parse_rgb_value (const char *str,
|
||||
*
|
||||
* 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”,
|
||||
* “\#rrrgggbbb” or ”\#rrrrggggbbbb”
|
||||
* - 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
|
||||
* will have full opacity)
|
||||
* - 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,
|
||||
* 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:
|
||||
* @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
|
||||
* be stored in the stride value.
|
||||
*
|
||||
* 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
|
||||
* memory allocation yourself and use [method@Gdk.TextureDownloader.download_into]
|
||||
* once allocation succeeded.
|
||||
* fails to allocate memory. If you think that may happen, you should
|
||||
* handle memory allocation yourself and use
|
||||
* gdk_texture_downloader_download_into() once allocation succeeded.
|
||||
*
|
||||
* Returns: The downloaded pixels
|
||||
* Returns: The downloaded pixels.
|
||||
*
|
||||
* Since: 4.10
|
||||
**/
|
||||
|
||||
+4
-7
@@ -135,8 +135,7 @@ gdk_toplevel_default_export_handle_finish (GdkToplevel *toplevel,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_toplevel_default_unexport_handle (GdkToplevel *toplevel,
|
||||
const char *handle)
|
||||
gdk_toplevel_default_unexport_handle (GdkToplevel *toplevel)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -792,7 +791,7 @@ gdk_toplevel_export_handle (GdkToplevel *toplevel,
|
||||
* @result: the `GAsyncResult`
|
||||
* @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: (nullable) (transfer full): the exported handle,
|
||||
@@ -811,7 +810,6 @@ gdk_toplevel_export_handle_finish (GdkToplevel *toplevel,
|
||||
/*< private >
|
||||
* gdk_toplevel_unexport_handle:
|
||||
* @toplevel: a `GdkToplevel`
|
||||
* @handle: the handle to unexport
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
void
|
||||
gdk_toplevel_unexport_handle (GdkToplevel *toplevel,
|
||||
const char *handle)
|
||||
gdk_toplevel_unexport_handle (GdkToplevel *toplevel)
|
||||
{
|
||||
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,
|
||||
GError **error);
|
||||
|
||||
void (* unexport_handle) (GdkToplevel *toplevel,
|
||||
const char *handle);
|
||||
void (* unexport_handle) (GdkToplevel *toplevel);
|
||||
};
|
||||
|
||||
typedef enum
|
||||
@@ -83,8 +82,7 @@ char *gdk_toplevel_export_handle_finish (GdkToplevel *toplevel,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
void gdk_toplevel_unexport_handle (GdkToplevel *toplevel,
|
||||
const char *handle);
|
||||
void gdk_toplevel_unexport_handle (GdkToplevel *toplevel);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
+3
-4
@@ -1,5 +1,3 @@
|
||||
subdir('deprecated')
|
||||
|
||||
gdk_public_sources = files([
|
||||
'gdk.c',
|
||||
'gdkapplaunchcontext.c',
|
||||
@@ -40,6 +38,7 @@ gdk_public_sources = files([
|
||||
'gdkmonitor.c',
|
||||
'gdkpaintable.c',
|
||||
'gdkpango.c',
|
||||
'gdkpixbuf.c',
|
||||
'gdkpipeiostream.c',
|
||||
'gdkrectangle.c',
|
||||
'gdkrgba.c',
|
||||
@@ -95,6 +94,7 @@ gdk_public_headers = files([
|
||||
'gdkmonitor.h',
|
||||
'gdkpaintable.h',
|
||||
'gdkpango.h',
|
||||
'gdkpixbuf.h',
|
||||
'gdkrectangle.h',
|
||||
'gdkrgba.h',
|
||||
'gdkseat.h',
|
||||
@@ -112,9 +112,8 @@ gdk_public_headers = files([
|
||||
'gdkdragsurface.h',
|
||||
])
|
||||
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([
|
||||
'gdkeventsprivate.h',
|
||||
|
||||
@@ -1148,10 +1148,7 @@ gdk_wayland_surface_destroy (GdkSurface *surface,
|
||||
|
||||
gdk_wayland_surface_hide_surface (surface);
|
||||
|
||||
if (GDK_IS_TOPLEVEL (surface))
|
||||
gdk_wayland_toplevel_destroy (GDK_TOPLEVEL (surface));
|
||||
|
||||
gdk_wayland_surface_destroy_wl_surface (GDK_WAYLAND_SURFACE (surface));
|
||||
gdk_wayland_surface_destroy_wl_surface (GDK_WAYLAND_SURFACE(surface));
|
||||
|
||||
frame_clock = gdk_surface_get_frame_clock (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);
|
||||
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_surface_create_xdg_toplevel (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);
|
||||
|
||||
/* {{{ GdkWaylandToplevel definition */
|
||||
|
||||
typedef struct {
|
||||
struct zxdg_exported_v1 *xdg_exported;
|
||||
struct zxdg_exported_v2 *xdg_exported_v2;
|
||||
char *handle;
|
||||
} GdkWaylandExported;
|
||||
|
||||
/**
|
||||
* GdkWaylandToplevel:
|
||||
*
|
||||
@@ -88,7 +83,8 @@ struct _GdkWaylandToplevel
|
||||
GdkWaylandToplevel *transient_for;
|
||||
|
||||
struct org_kde_kwin_server_decoration *server_decoration;
|
||||
GList *exported;
|
||||
struct zxdg_exported_v1 *xdg_exported;
|
||||
struct zxdg_exported_v2 *xdg_exported_v2;
|
||||
|
||||
struct {
|
||||
int width;
|
||||
@@ -106,6 +102,12 @@ struct _GdkWaylandToplevel
|
||||
gboolean size_is_fixed;
|
||||
} next_layout;
|
||||
|
||||
struct {
|
||||
GdkWaylandToplevelExported callback;
|
||||
gpointer user_data;
|
||||
GDestroyNotify destroy_func;
|
||||
} exported;
|
||||
|
||||
struct {
|
||||
gboolean was_set;
|
||||
|
||||
@@ -1278,6 +1280,9 @@ gdk_wayland_toplevel_finalize (GObject *object)
|
||||
|
||||
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.app_menu_path);
|
||||
g_free (self->application.menubar_path);
|
||||
@@ -1742,12 +1747,8 @@ xdg_exported_handle_v1 (void *data,
|
||||
struct zxdg_exported_v1 *zxdg_exported_v1,
|
||||
const char *handle)
|
||||
{
|
||||
GTask *task = G_TASK (data);
|
||||
GdkWaylandExported *exported = (GdkWaylandExported *)g_task_get_task_data (task);
|
||||
|
||||
exported->handle = g_strdup (handle);
|
||||
g_task_return_pointer (task, g_strdup (handle), g_free);
|
||||
g_object_unref (task);
|
||||
g_task_return_pointer (G_TASK (data), g_strdup (handle), g_free);
|
||||
g_object_unref (data);
|
||||
}
|
||||
|
||||
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,
|
||||
const char *handle)
|
||||
{
|
||||
GTask *task = G_TASK (data);
|
||||
GdkWaylandExported *exported = (GdkWaylandExported *)g_task_get_task_data (task);
|
||||
|
||||
exported->handle = g_strdup (handle);
|
||||
g_task_return_pointer (task, g_strdup (handle), g_free);
|
||||
g_object_unref (task);
|
||||
g_task_return_pointer (G_TASK (data), g_strdup (handle), g_free);
|
||||
g_object_unref (data);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
GdkWaylandExported *exported = g_new0 (GdkWaylandExported, 1);
|
||||
exported->xdg_exported_v2 =
|
||||
wayland_toplevel->xdg_exported_v2 =
|
||||
zxdg_exporter_v2_export_toplevel (display_wayland->xdg_exporter_v2,
|
||||
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);
|
||||
|
||||
wayland_toplevel->exported = g_list_prepend (wayland_toplevel->exported, exported);
|
||||
g_task_set_task_data (task, exported, NULL);
|
||||
}
|
||||
else if (display_wayland->xdg_exporter)
|
||||
{
|
||||
GdkWaylandExported *exported = g_new0 (GdkWaylandExported, 1);
|
||||
exported->xdg_exported =
|
||||
wayland_toplevel->xdg_exported =
|
||||
zxdg_exporter_v1_export (display_wayland->xdg_exporter,
|
||||
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);
|
||||
|
||||
wayland_toplevel->exported = g_list_prepend (wayland_toplevel->exported, exported);
|
||||
g_task_set_task_data (task, exported, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1826,36 +1815,15 @@ gdk_wayland_toplevel_real_export_handle_finish (GdkToplevel *toplevel,
|
||||
}
|
||||
|
||||
static void
|
||||
destroy_exported (GdkWaylandExported *exported)
|
||||
{
|
||||
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)
|
||||
gdk_wayland_toplevel_real_unexport_handle (GdkToplevel *toplevel)
|
||||
{
|
||||
GdkWaylandToplevel *wayland_toplevel = GDK_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)
|
||||
{
|
||||
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 ();
|
||||
g_clear_pointer (&wayland_toplevel->xdg_exported_v2, zxdg_exported_v2_destroy);
|
||||
g_clear_pointer (&wayland_toplevel->xdg_exported, zxdg_exported_v1_destroy);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -2287,32 +2255,6 @@ gdk_wayland_toplevel_set_dbus_properties (GdkToplevel *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 */
|
||||
|
||||
@@ -2455,6 +2397,12 @@ gdk_wayland_toplevel_uninhibit_idle (GdkToplevel *toplevel)
|
||||
* 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 {
|
||||
GdkWaylandToplevelExported callback;
|
||||
gpointer user_data;
|
||||
@@ -2502,12 +2450,6 @@ export_handle_done (GObject *source,
|
||||
* from another surface as transient for this one, see
|
||||
* [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,
|
||||
* 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
|
||||
* 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,
|
||||
* and thus may require changes in the future.
|
||||
*
|
||||
* Deprecated: 4.12: Use [method@GdkWayland.WaylandToplevel.drop_exported_handle]
|
||||
* instead, this function does nothing
|
||||
*/
|
||||
void
|
||||
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 &&
|
||||
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);
|
||||
gdk_toplevel_unexport_handle (toplevel);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -52,13 +52,9 @@ gboolean gdk_wayland_toplevel_export_handle (GdkToplevel
|
||||
gpointer user_data,
|
||||
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);
|
||||
|
||||
GDK_AVAILABLE_IN_4_12
|
||||
void gdk_wayland_toplevel_drop_exported_handle (GdkToplevel *toplevel,
|
||||
const char *handle);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_wayland_toplevel_set_transient_for_exported (GdkToplevel *toplevel,
|
||||
const char *parent_handle_str);
|
||||
|
||||
@@ -144,8 +144,7 @@ struct _GdkX11Display
|
||||
guint server_time_is_monotonic_time : 1;
|
||||
|
||||
/* GLX extensions we check */
|
||||
guint has_glx_sgi_swap_control : 1;
|
||||
guint has_glx_swap_control : 1;
|
||||
guint has_glx_swap_interval : 1;
|
||||
guint has_glx_create_context : 1;
|
||||
guint has_glx_texture_from_pixmap : 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)
|
||||
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 ();
|
||||
|
||||
@@ -249,7 +249,7 @@ gdk_x11_gl_context_glx_make_current (GdkGLContext *context,
|
||||
if (!glXMakeContextCurrent (dpy, drawable, drawable, self->glx_context))
|
||||
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
|
||||
* 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. */
|
||||
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)
|
||||
glXSwapIntervalEXT (dpy, drawable, 1);
|
||||
else
|
||||
glXSwapIntervalEXT (dpy, drawable, 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);
|
||||
}
|
||||
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),
|
||||
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 ();
|
||||
int i;
|
||||
case 1:
|
||||
return cairo_region_create ();
|
||||
break;
|
||||
|
||||
for (i = 0; i < buffer_age - 1; i++)
|
||||
{
|
||||
if (context->old_updated_area[i] == NULL)
|
||||
return GDK_GL_CONTEXT_CLASS (gdk_x11_gl_context_glx_parent_class)->get_damage (context);
|
||||
case 2:
|
||||
if (context->old_updated_area[0])
|
||||
return cairo_region_copy (context->old_updated_area[0]);
|
||||
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");
|
||||
display_x11->has_glx_create_es2_context =
|
||||
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");
|
||||
display_x11->has_glx_swap_control =
|
||||
epoxy_has_glx_extension (dpy, screen_num, "GLX_EXT_swap_control");
|
||||
display_x11->has_glx_texture_from_pixmap =
|
||||
epoxy_has_glx_extension (dpy, screen_num, "GLX_EXT_texture_from_pixmap");
|
||||
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_EXT_create_context_es2_profile: %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_SGI_video_sync: %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),
|
||||
display_x11->has_glx_create_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_control ? "yes" : "no",
|
||||
display_x11->has_glx_swap_interval ? "yes" : "no",
|
||||
display_x11->has_glx_texture_from_pixmap ? "yes" : "no",
|
||||
display_x11->has_glx_video_sync ? "yes" : "no",
|
||||
display_x11->has_glx_buffer_age ? "yes" : "no",
|
||||
|
||||
@@ -5318,8 +5318,7 @@ gdk_x11_toplevel_export_handle_finish (GdkToplevel *toplevel,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_x11_toplevel_unexport_handle (GdkToplevel *toplevel,
|
||||
const char *handle)
|
||||
gdk_x11_toplevel_unexport_handle (GdkToplevel *toplevel)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -579,7 +579,7 @@ discard_batch (GskGLCommandQueue *self)
|
||||
self->batches.len--;
|
||||
}
|
||||
|
||||
gboolean
|
||||
void
|
||||
gsk_gl_command_queue_begin_draw (GskGLCommandQueue *self,
|
||||
GskGLUniformProgram *program,
|
||||
guint width,
|
||||
@@ -596,7 +596,7 @@ gsk_gl_command_queue_begin_draw (GskGLCommandQueue *self,
|
||||
* of batches we can have in one frame.
|
||||
*/
|
||||
if (will_ignore_batch (self))
|
||||
return FALSE;
|
||||
return;
|
||||
|
||||
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->in_draw = TRUE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -723,10 +721,6 @@ gsk_gl_command_queue_split_draw (GskGLCommandQueue *self)
|
||||
|
||||
g_assert (GSK_IS_GL_COMMAND_QUEUE (self));
|
||||
g_assert (self->batches.len > 0);
|
||||
|
||||
if (will_ignore_batch (self))
|
||||
return;
|
||||
|
||||
g_assert (self->in_draw == TRUE);
|
||||
|
||||
program = self->program_info;
|
||||
|
||||
@@ -331,7 +331,7 @@ void gsk_gl_command_queue_delete_program (GskGLCommandQueue
|
||||
void gsk_gl_command_queue_clear (GskGLCommandQueue *self,
|
||||
guint clear_bits,
|
||||
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,
|
||||
guint width,
|
||||
guint height);
|
||||
|
||||
@@ -124,7 +124,7 @@ gsk_gl_compiler_new (GskGLDriver *driver,
|
||||
self->driver = g_object_ref (driver);
|
||||
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))
|
||||
{
|
||||
|
||||
@@ -1131,7 +1131,7 @@ gsk_gl_driver_lookup_shader (GskGLDriver *self,
|
||||
return program;
|
||||
}
|
||||
|
||||
#if 0
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
void
|
||||
gsk_gl_driver_save_texture_to_png (GskGLDriver *driver,
|
||||
int texture_id,
|
||||
|
||||
@@ -175,7 +175,7 @@ GskGLProgram * gsk_gl_driver_lookup_shader (GskGLDriver *s
|
||||
GskGLShader *shader,
|
||||
GError **error);
|
||||
|
||||
#if 0
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
void gsk_gl_driver_save_texture_to_png (GskGLDriver *self,
|
||||
int texture_id,
|
||||
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;
|
||||
GHashTableIter iter;
|
||||
guint dropped = 0;
|
||||
G_GNUC_UNUSED guint atlased = 0;
|
||||
guint atlased = 0;
|
||||
|
||||
g_hash_table_iter_init (&iter, self->hash_table);
|
||||
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);
|
||||
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++)
|
||||
{
|
||||
GskShadow *shadow = &self->shadows[i];
|
||||
@@ -4439,7 +4434,6 @@ gsk_shadow_node_draw (GskRenderNode *node,
|
||||
|
||||
cairo_set_source (cr, pattern);
|
||||
cairo_paint (cr);
|
||||
cairo_restore (cr);
|
||||
|
||||
cairo_pattern_destroy (pattern);
|
||||
}
|
||||
|
||||
@@ -1081,21 +1081,20 @@ parse_declarations (GtkCssParser *parser,
|
||||
{
|
||||
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))
|
||||
{
|
||||
gtk_css_parser_error_syntax (parser, "Expected ':' after variable declaration");
|
||||
}
|
||||
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))
|
||||
{
|
||||
/* nothing to do */
|
||||
|
||||
@@ -689,6 +689,230 @@ gsk_rounded_rect_intersect_with_rect (const GskRoundedRect *self,
|
||||
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
|
||||
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 {
|
||||
GSK_INTERSECTION_EMPTY,
|
||||
GSK_INTERSECTION_NONEMPTY,
|
||||
GSK_INTERSECTION_NOT_REPRESENTABLE
|
||||
GSK_INTERSECTION_NOT_REPRESENTABLE,
|
||||
GSK_INTERSECTION_NEEDS_QUARTIC
|
||||
} GskRoundedRectIntersection;
|
||||
|
||||
GskRoundedRectIntersection gsk_rounded_rect_intersect_with_rect (const GskRoundedRect *self,
|
||||
const graphene_rect_t *rect,
|
||||
GskRoundedRect *result) G_GNUC_PURE;
|
||||
|
||||
GskRoundedRectIntersection gsk_rounded_rect_intersect (const GskRoundedRect *self,
|
||||
const GskRoundedRect *other,
|
||||
GskRoundedRect *result) G_GNUC_PURE;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ gsk_vulkan_clip_intersect_rounded_rect (GskVulkanClip *dest,
|
||||
break;
|
||||
|
||||
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);
|
||||
break;
|
||||
|
||||
|
||||
@@ -450,7 +450,7 @@ gsk_vulkan_glyph_cache_begin_frame (GskVulkanGlyphCache *cache)
|
||||
GHashTableIter iter;
|
||||
GlyphCacheKey *key;
|
||||
GskVulkanCachedGlyph *value;
|
||||
G_GNUC_UNUSED guint dropped = 0;
|
||||
guint dropped = 0;
|
||||
|
||||
cache->timestamp++;
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ gsk_vulkan_render_pass_new (GdkVulkanContext *context,
|
||||
graphene_matrix_init_ortho (&self->p,
|
||||
viewport->origin.x, viewport->origin.x + viewport->size.width,
|
||||
viewport->origin.y, viewport->origin.y + viewport->size.height,
|
||||
2 * ORTHO_NEAR_PLANE - ORTHO_FAR_PLANE,
|
||||
ORTHO_NEAR_PLANE,
|
||||
ORTHO_FAR_PLANE);
|
||||
|
||||
if (signal_semaphore != VK_NULL_HANDLE) // this is a dependent pass
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
gsk_private_vulkan_include_shaders = [
|
||||
'clip.frag.glsl',
|
||||
'clip.vert.glsl',
|
||||
'constants.glsl',
|
||||
'rounded-rect.glsl',
|
||||
]
|
||||
# FIXME: what's up with these?
|
||||
#gsk_private_vulkan_include_shaders = [
|
||||
# 'clip.frag.glsl',
|
||||
# 'clip.vert.glsl',
|
||||
# 'constants.glsl',
|
||||
# 'rounded-rect.glsl',
|
||||
#]
|
||||
|
||||
gsk_private_vulkan_fragment_shaders = [
|
||||
'blendmode.frag',
|
||||
@@ -50,7 +51,6 @@ foreach shader: gsk_private_vulkan_shaders
|
||||
compiled_shader = custom_target(spv_shader,
|
||||
input: shader,
|
||||
output: spv_shader,
|
||||
depend_files: gsk_private_vulkan_include_shaders,
|
||||
command: [
|
||||
glslc,
|
||||
stage_arg,
|
||||
@@ -61,7 +61,6 @@ foreach shader: gsk_private_vulkan_shaders
|
||||
compiled_clip_shader = custom_target(clip_spv_shader,
|
||||
input: shader,
|
||||
output: clip_spv_shader,
|
||||
depend_files: gsk_private_vulkan_include_shaders,
|
||||
command: [
|
||||
glslc,
|
||||
stage_arg,
|
||||
@@ -72,7 +71,6 @@ foreach shader: gsk_private_vulkan_shaders
|
||||
compiled_clip_rounded_shader = custom_target(clip_rounded_spv_shader,
|
||||
input: shader,
|
||||
output: clip_rounded_spv_shader,
|
||||
depend_files: gsk_private_vulkan_include_shaders,
|
||||
command: [
|
||||
glslc,
|
||||
stage_arg,
|
||||
|
||||
@@ -31,7 +31,6 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
typedef struct {
|
||||
GtkWindow *parent;
|
||||
char *handle;
|
||||
GAppLaunchContext *context;
|
||||
char *uri;
|
||||
GTask *task;
|
||||
@@ -40,10 +39,9 @@ typedef struct {
|
||||
static void
|
||||
gtk_show_uri_data_free (GtkShowUriData *data)
|
||||
{
|
||||
if (data->parent && data->handle)
|
||||
gtk_window_unexport_handle (data->parent, data->handle);
|
||||
if (data->parent)
|
||||
gtk_window_unexport_handle (data->parent);
|
||||
g_clear_object (&data->parent);
|
||||
g_free (data->handle);
|
||||
g_clear_object (&data->context);
|
||||
g_free (data->uri);
|
||||
g_clear_object (&data->task);
|
||||
@@ -74,10 +72,7 @@ window_handle_exported (GtkWindow *window,
|
||||
GtkShowUriData *data = user_data;
|
||||
|
||||
if (handle)
|
||||
{
|
||||
g_app_launch_context_setenv (data->context, "PARENT_WINDOW_ID", handle);
|
||||
data->handle = g_strdup (handle);
|
||||
}
|
||||
g_app_launch_context_setenv (data->context, "PARENT_WINDOW_ID", handle);
|
||||
|
||||
g_app_info_launch_default_for_uri_async (data->uri,
|
||||
data->context,
|
||||
|
||||
@@ -17,13 +17,11 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#include "gdktextureutilsprivate.h"
|
||||
#include "gdkpixbufutilsprivate.h"
|
||||
#include "gtkscalerprivate.h"
|
||||
|
||||
#include "gdk/gdktextureprivate.h"
|
||||
|
||||
/* {{{ Pixbuf helpers */
|
||||
|
||||
static GdkPixbuf *
|
||||
load_from_stream (GdkPixbufLoader *loader,
|
||||
GInputStream *stream,
|
||||
@@ -93,7 +91,7 @@ size_prepared_cb (GdkPixbufLoader *loader,
|
||||
* load the image at its original size times the
|
||||
* given scale.
|
||||
*/
|
||||
static GdkPixbuf *
|
||||
GdkPixbuf *
|
||||
_gdk_pixbuf_new_from_stream_scaled (GInputStream *stream,
|
||||
double scale,
|
||||
GCancellable *cancellable,
|
||||
@@ -147,7 +145,7 @@ size_prepared_cb2 (GdkPixbufLoader *loader,
|
||||
gdk_pixbuf_loader_set_size (loader, width, height);
|
||||
}
|
||||
|
||||
static GdkPixbuf *
|
||||
GdkPixbuf *
|
||||
_gdk_pixbuf_new_from_stream_at_scale (GInputStream *stream,
|
||||
int width,
|
||||
int height,
|
||||
@@ -174,7 +172,44 @@ _gdk_pixbuf_new_from_stream_at_scale (GInputStream *stream,
|
||||
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,
|
||||
int width,
|
||||
int height,
|
||||
@@ -192,10 +227,8 @@ _gdk_pixbuf_new_from_resource_at_scale (const char *resource_path,
|
||||
g_object_unref (stream);
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ Symbolic processing */
|
||||
}
|
||||
|
||||
static GdkPixbuf *
|
||||
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;
|
||||
|
||||
/* 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)
|
||||
return NULL;
|
||||
if (!reference)
|
||||
return NULL;
|
||||
|
||||
icon_width = gdk_pixbuf_get_width (reference);
|
||||
icon_height = gdk_pixbuf_get_height (reference);
|
||||
g_object_unref (reference);
|
||||
icon_width = gdk_pixbuf_get_width (reference);
|
||||
icon_height = gdk_pixbuf_get_height (reference);
|
||||
g_object_unref (reference);
|
||||
}
|
||||
|
||||
escaped_file_data = g_base64_encode ((guchar *) file_data, file_len);
|
||||
icon_width_str = g_strdup_printf ("%d", icon_width);
|
||||
@@ -383,12 +418,12 @@ out:
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
static GdkPixbuf *
|
||||
make_symbolic_pixbuf_from_resource (const char *path,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error)
|
||||
GdkPixbuf *
|
||||
gtk_make_symbolic_pixbuf_from_resource (const char *path,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error)
|
||||
{
|
||||
GBytes *bytes;
|
||||
const char *data;
|
||||
@@ -408,12 +443,12 @@ make_symbolic_pixbuf_from_resource (const char *path,
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
static GdkPixbuf *
|
||||
make_symbolic_pixbuf_from_path (const char *path,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error)
|
||||
GdkPixbuf *
|
||||
gtk_make_symbolic_pixbuf_from_path (const char *path,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error)
|
||||
{
|
||||
char *data;
|
||||
gsize size;
|
||||
@@ -429,12 +464,12 @@ make_symbolic_pixbuf_from_path (const char *path,
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
static GdkPixbuf *
|
||||
make_symbolic_pixbuf_from_file (GFile *file,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error)
|
||||
GdkPixbuf *
|
||||
gtk_make_symbolic_pixbuf_from_file (GFile *file,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error)
|
||||
{
|
||||
char *data;
|
||||
gsize size;
|
||||
@@ -450,91 +485,6 @@ make_symbolic_pixbuf_from_file (GFile *file,
|
||||
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 *
|
||||
gtk_load_symbolic_texture_from_resource (const char *path)
|
||||
{
|
||||
@@ -542,16 +492,16 @@ gtk_load_symbolic_texture_from_resource (const char *path)
|
||||
}
|
||||
|
||||
GdkTexture *
|
||||
gdk_texture_new_from_resource_symbolic (const char *path,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error)
|
||||
gtk_make_symbolic_texture_from_resource (const char *path,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
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)
|
||||
{
|
||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
||||
@@ -572,7 +522,7 @@ gtk_load_symbolic_texture_from_file (GFile *file)
|
||||
if (stream == 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);
|
||||
if (pixbuf == NULL)
|
||||
return NULL;
|
||||
@@ -584,25 +534,22 @@ gtk_load_symbolic_texture_from_file (GFile *file)
|
||||
}
|
||||
|
||||
GdkTexture *
|
||||
gdk_texture_new_from_file_symbolic (GFile *file,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error)
|
||||
gtk_make_symbolic_texture_from_file (GFile *file,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
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);
|
||||
g_object_unref (pixbuf);
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ Scaled paintable API */
|
||||
|
||||
typedef struct {
|
||||
int scale_factor;
|
||||
} LoaderData;
|
||||
@@ -629,7 +576,7 @@ on_loader_size_prepared (GdkPixbufLoader *loader,
|
||||
height * loader_data->scale_factor);
|
||||
}
|
||||
|
||||
static GdkPaintable *
|
||||
GdkPaintable *
|
||||
gdk_paintable_new_from_bytes_scaled (GBytes *bytes,
|
||||
int scale_factor)
|
||||
{
|
||||
@@ -733,7 +680,3 @@ gdk_paintable_new_from_file_scaled (GFile *file,
|
||||
|
||||
return paintable;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* vim:set foldmethod=marker expandtab: */
|
||||
@@ -21,6 +21,30 @@
|
||||
|
||||
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,
|
||||
gsize len,
|
||||
int width,
|
||||
@@ -28,41 +52,36 @@ GdkPixbuf *gtk_make_symbolic_pixbuf_from_data (const char *data,
|
||||
double scale,
|
||||
const char *debug_output_to,
|
||||
GError **error);
|
||||
|
||||
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,
|
||||
GdkPixbuf *gtk_make_symbolic_pixbuf_from_file (GFile *file,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
GError **error);
|
||||
GdkTexture *gdk_texture_new_from_file_symbolic (GFile *file,
|
||||
GdkPixbuf *gtk_make_symbolic_pixbuf_from_path (const char *path,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
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 height,
|
||||
double scale,
|
||||
GError **error);
|
||||
|
||||
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_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,
|
||||
int scale_factor);
|
||||
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);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -220,7 +220,6 @@ enum
|
||||
PROP_COLUMNS,
|
||||
PROP_ENABLE_RUBBERBAND,
|
||||
PROP_HADJUSTMENT,
|
||||
PROP_HEADER_FACTORY,
|
||||
PROP_HSCROLL_POLICY,
|
||||
PROP_MODEL,
|
||||
PROP_REORDERABLE,
|
||||
@@ -630,10 +629,6 @@ gtk_column_view_get_property (GObject *object,
|
||||
g_value_set_object (value, self->hadjustment);
|
||||
break;
|
||||
|
||||
case PROP_HEADER_FACTORY:
|
||||
g_value_set_object (value, gtk_column_view_get_header_factory (self));
|
||||
break;
|
||||
|
||||
case PROP_HSCROLL_POLICY:
|
||||
g_value_set_enum (value, gtk_scrollable_get_hscroll_policy (GTK_SCROLLABLE (self->listview)));
|
||||
break;
|
||||
@@ -717,10 +712,6 @@ gtk_column_view_set_property (GObject *object,
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_HEADER_FACTORY:
|
||||
gtk_column_view_set_header_factory (self, g_value_get_object (value));
|
||||
break;
|
||||
|
||||
case PROP_HSCROLL_POLICY:
|
||||
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,
|
||||
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);
|
||||
|
||||
/**
|
||||
@@ -2128,49 +2107,3 @@ gtk_column_view_get_tab_behavior (GtkColumnView *self)
|
||||
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 *
|
||||
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
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "gtkcssimageprivate.h"
|
||||
#include "gtkcsspalettevalueprivate.h"
|
||||
#include "gtkcsscolorvalueprivate.h"
|
||||
#include "gdktextureutilsprivate.h"
|
||||
#include "gdkpixbufutilsprivate.h"
|
||||
|
||||
#include "gtkstyleproviderprivate.h"
|
||||
|
||||
@@ -110,7 +110,7 @@ gtk_css_image_recolor_load_texture (GtkCssImageRecolor *recolor,
|
||||
if (g_str_has_suffix (uri, ".symbolic.png"))
|
||||
recolor->texture = gtk_load_symbolic_texture_from_resource (resource_path);
|
||||
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);
|
||||
}
|
||||
@@ -119,7 +119,7 @@ gtk_css_image_recolor_load_texture (GtkCssImageRecolor *recolor,
|
||||
if (g_str_has_suffix (uri, ".symbolic.png"))
|
||||
recolor->texture = gtk_load_symbolic_texture_from_file (recolor->file);
|
||||
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);
|
||||
|
||||
+15
-1
@@ -47,7 +47,21 @@ gtk_css_image_url_load_image (GtkCssImageUrl *url,
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "gtkborder.h"
|
||||
#include "gtktypes.h"
|
||||
#include "gtkcssvalueprivate.h"
|
||||
#include "gtkroundedboxprivate.h"
|
||||
#include "gtksnapshot.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
+4
-4
@@ -19,7 +19,7 @@
|
||||
* 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
|
||||
* 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"
|
||||
@@ -207,7 +207,7 @@ gtk_drag_source_set_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkDragSource *source = GTK_DRAG_SOURCE (object);
|
||||
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_CONTENT:
|
||||
@@ -424,13 +424,13 @@ gtk_drag_source_class_init (GtkDragSourceClass *class)
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
NULL, NULL,
|
||||
_gtk_marshal_VOID__OBJECT_BOOLEAN,
|
||||
_gtk_marshal_OBJECT__BOOLEAN,
|
||||
G_TYPE_NONE, 2,
|
||||
GDK_TYPE_DRAG,
|
||||
G_TYPE_BOOLEAN);
|
||||
g_signal_set_va_marshaller (signals[DRAG_END],
|
||||
GTK_TYPE_DRAG_SOURCE,
|
||||
_gtk_marshal_VOID__OBJECT_BOOLEANv);
|
||||
_gtk_marshal_OBJECT__BOOLEANv);
|
||||
|
||||
/**
|
||||
* GtkDragSource::drag-cancel:
|
||||
|
||||
@@ -150,13 +150,13 @@ make_action_unique (GdkDragAction actions)
|
||||
|
||||
if (actions & GDK_ACTION_MOVE)
|
||||
return GDK_ACTION_MOVE;
|
||||
|
||||
|
||||
if (actions & GDK_ACTION_LINK)
|
||||
return GDK_ACTION_LINK;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static GdkDragAction
|
||||
gtk_drop_target_async_drag_enter (GtkDropTargetAsync *self,
|
||||
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));
|
||||
}
|
||||
|
||||
static GdkDragAction
|
||||
static GdkDragAction
|
||||
gtk_drop_target_async_drag_motion (GtkDropTargetAsync *self,
|
||||
GdkDrop *drop,
|
||||
double x,
|
||||
@@ -457,12 +457,12 @@ gtk_drop_target_async_class_init (GtkDropTargetAsyncClass *class)
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GtkDropTargetAsyncClass, drag_enter),
|
||||
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_DROP, G_TYPE_DOUBLE, G_TYPE_DOUBLE);
|
||||
g_signal_set_va_marshaller (signals[DRAG_ENTER],
|
||||
GTK_TYPE_DROP_TARGET_ASYNC,
|
||||
_gtk_marshal_FLAGS__OBJECT_DOUBLE_DOUBLEv);
|
||||
_gtk_marshal_ENUM__OBJECT_DOUBLE_DOUBLEv);
|
||||
|
||||
/**
|
||||
* GtkDropTargetAsync::drag-motion:
|
||||
@@ -481,12 +481,12 @@ gtk_drop_target_async_class_init (GtkDropTargetAsyncClass *class)
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GtkDropTargetAsyncClass, drag_motion),
|
||||
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_DROP, G_TYPE_DOUBLE, G_TYPE_DOUBLE);
|
||||
g_signal_set_va_marshaller (signals[DRAG_MOTION],
|
||||
GTK_TYPE_DROP_TARGET_ASYNC,
|
||||
_gtk_marshal_FLAGS__OBJECT_DOUBLE_DOUBLEv);
|
||||
_gtk_marshal_ENUM__OBJECT_DOUBLE_DOUBLEv);
|
||||
|
||||
/**
|
||||
* GtkDropTargetAsync::drag-leave:
|
||||
@@ -617,7 +617,7 @@ GdkContentFormats *
|
||||
gtk_drop_target_async_get_formats (GtkDropTargetAsync *self)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_DROP_TARGET_ASYNC (self), NULL);
|
||||
|
||||
|
||||
return self->formats;
|
||||
}
|
||||
|
||||
@@ -633,7 +633,7 @@ gtk_drop_target_async_set_actions (GtkDropTargetAsync *self,
|
||||
GdkDragAction actions)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_DROP_TARGET_ASYNC (self));
|
||||
|
||||
|
||||
if (self->actions == actions)
|
||||
return;
|
||||
|
||||
|
||||
+2
-2
@@ -69,9 +69,9 @@ typedef enum
|
||||
GTK_ALIGN_START,
|
||||
GTK_ALIGN_END,
|
||||
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_CENTER GDK_AVAILABLE_ENUMERATOR_IN_4_12,
|
||||
GTK_ALIGN_BASELINE_CENTER,
|
||||
} GtkAlign;
|
||||
|
||||
/**
|
||||
|
||||
@@ -410,22 +410,16 @@ gtk_event_controller_scroll_handle_event (GtkEventController *controller,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ABS (scroll->cur_dx) >= 0.5)
|
||||
if (ABS (scroll->cur_dx) >= 1)
|
||||
{
|
||||
steps = trunc (scroll->cur_dx);
|
||||
if (steps == 0)
|
||||
steps = (scroll->cur_dx > 0) ? 1 : -1;
|
||||
|
||||
scroll->cur_dx -= steps;
|
||||
dx = steps;
|
||||
}
|
||||
|
||||
if (ABS (scroll->cur_dy) >= 0.5)
|
||||
if (ABS (scroll->cur_dy) >= 1)
|
||||
{
|
||||
steps = trunc (scroll->cur_dy);
|
||||
if (steps == 0)
|
||||
steps = (scroll->cur_dy > 0) ? 1 : -1;
|
||||
|
||||
scroll->cur_dy -= steps;
|
||||
dy = steps;
|
||||
}
|
||||
@@ -465,22 +459,16 @@ gtk_event_controller_scroll_handle_event (GtkEventController *controller,
|
||||
scroll->cur_dy += dy;
|
||||
dx = dy = 0;
|
||||
|
||||
if (ABS (scroll->cur_dx) >= 0.5)
|
||||
if (ABS (scroll->cur_dx) >= 1)
|
||||
{
|
||||
steps = trunc (scroll->cur_dx);
|
||||
if (steps == 0)
|
||||
steps = (scroll->cur_dx > 0) ? 1 : -1;
|
||||
|
||||
scroll->cur_dx -= steps;
|
||||
dx = steps;
|
||||
}
|
||||
|
||||
if (ABS (scroll->cur_dy) >= 0.5)
|
||||
if (ABS (scroll->cur_dy) >= 1)
|
||||
{
|
||||
steps = trunc (scroll->cur_dy);
|
||||
if (steps == 0)
|
||||
steps = (scroll->cur_dy > 0) ? 1 : -1;
|
||||
|
||||
scroll->cur_dy -= steps;
|
||||
dy = steps;
|
||||
}
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@
|
||||
* expanded widget yourself, such as when you want to actually create
|
||||
* the widget at expansion time. In this case, create a `GtkExpander`
|
||||
* 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
|
||||
* a signal connection as follows:
|
||||
*
|
||||
|
||||
@@ -52,7 +52,6 @@ typedef struct {
|
||||
|
||||
const char *method_name;
|
||||
|
||||
char *exported_handle;
|
||||
GtkWindow *exported_window;
|
||||
PortalErrorHandler error_handler;
|
||||
} FilechooserPortalData;
|
||||
@@ -80,11 +79,7 @@ filechooser_portal_data_clear (FilechooserPortalData *data)
|
||||
|
||||
if (data->exported_window)
|
||||
{
|
||||
if (data->exported_handle)
|
||||
{
|
||||
gtk_window_unexport_handle (data->exported_window, data->exported_handle);
|
||||
g_clear_pointer (&data->exported_handle, g_free);
|
||||
}
|
||||
gtk_window_unexport_handle (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));
|
||||
}
|
||||
|
||||
data->exported_handle = g_strdup (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);
|
||||
search_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->browse_files_model);
|
||||
|
||||
g_clear_object (&impl->selection_model);
|
||||
g_clear_object (&impl->sort_model);
|
||||
@@ -3964,7 +3961,6 @@ set_list_model (GtkFileChooserWidget *impl,
|
||||
|
||||
set_busy_cursor (impl, TRUE);
|
||||
|
||||
g_clear_object (&impl->browse_files_model);
|
||||
impl->browse_files_model =
|
||||
_gtk_file_system_model_new_for_directory (impl->current_folder, MODEL_ATTRIBUTES);
|
||||
|
||||
|
||||
+14
-13
@@ -229,9 +229,9 @@ open_done (GObject *source,
|
||||
#endif
|
||||
|
||||
static void
|
||||
show_item_done (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer data)
|
||||
show_folder_done (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer data)
|
||||
{
|
||||
GDBusConnection *bus = G_DBUS_CONNECTION (source);
|
||||
GTask *task = G_TASK (data);
|
||||
@@ -261,10 +261,11 @@ show_item_done (GObject *source,
|
||||
#define FILE_MANAGER_DBUS_PATH "/org/freedesktop/FileManager1"
|
||||
|
||||
static void
|
||||
show_item (GtkWindow *parent,
|
||||
const char *uri,
|
||||
GCancellable *cancellable,
|
||||
GTask *task)
|
||||
show_folder (GtkWindow *parent,
|
||||
const char *uri,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GDBusConnection *bus;
|
||||
GVariantBuilder uris_builder = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE_STRING_ARRAY);
|
||||
@@ -273,10 +274,10 @@ show_item (GtkWindow *parent,
|
||||
|
||||
if (!bus)
|
||||
{
|
||||
g_task_return_new_error (task,
|
||||
g_task_return_new_error (G_TASK (user_data),
|
||||
GTK_DIALOG_ERROR, GTK_DIALOG_ERROR_FAILED,
|
||||
"Session bus not available");
|
||||
g_object_unref (task);
|
||||
g_object_unref (G_TASK (user_data));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -286,14 +287,14 @@ show_item (GtkWindow *parent,
|
||||
FILE_MANAGER_DBUS_NAME,
|
||||
FILE_MANAGER_DBUS_PATH,
|
||||
FILE_MANAGER_DBUS_IFACE,
|
||||
"ShowItems",
|
||||
"ShowFolders",
|
||||
g_variant_new ("(ass)", &uris_builder, ""),
|
||||
NULL, /* ignore returned type */
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
-1,
|
||||
cancellable,
|
||||
show_item_done,
|
||||
task);
|
||||
show_folder_done,
|
||||
user_data);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
show_item (parent, uri, cancellable, task);
|
||||
show_folder (parent, uri, cancellable, show_folder_done, task);
|
||||
|
||||
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_CHANGED:
|
||||
case G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED:
|
||||
if (g_file_equal (file, model->dir))
|
||||
return;
|
||||
/* We can treat all children the same way */
|
||||
/* We can treat all of these the same way */
|
||||
g_file_query_info_async (file,
|
||||
model->attributes,
|
||||
G_FILE_QUERY_INFO_NONE,
|
||||
|
||||
@@ -34,11 +34,9 @@
|
||||
* It hides some elements from the other model according to
|
||||
* 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
|
||||
* [method@Gtk.FilterListModel.set_incremental] for details.
|
||||
*
|
||||
* `GtkFilterListModel` passes through sections from the underlying model.
|
||||
*/
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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
|
||||
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);
|
||||
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);
|
||||
if (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);
|
||||
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)
|
||||
{
|
||||
self->strictness = GTK_FILTER_MATCH_NONE;
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
*
|
||||
* `GtkFlattenListModel` is a list model that concatenates other list models.
|
||||
*
|
||||
* `GtkFlattenListModel` takes a list model containing list models, and flattens
|
||||
* it into a single model. Each list model becomes a section in the single model.
|
||||
* `GtkFlattenListModel` takes a list model containing list models,
|
||||
* and flattens it into a single model.
|
||||
*/
|
||||
|
||||
enum {
|
||||
|
||||
+68
-146
@@ -19,7 +19,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkgridviewprivate.h"
|
||||
#include "gtkgridview.h"
|
||||
|
||||
#include "gtkbitset.h"
|
||||
#include "gtklistbaseprivate.h"
|
||||
@@ -384,37 +384,6 @@ gtk_grid_view_get_allocation (GtkListBase *base,
|
||||
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
|
||||
gtk_grid_view_get_position_from_allocation (GtkListBase *base,
|
||||
int x,
|
||||
@@ -425,7 +394,6 @@ gtk_grid_view_get_position_from_allocation (GtkListBase *base,
|
||||
GtkGridView *self = GTK_GRID_VIEW (base);
|
||||
GtkListTile *tile;
|
||||
guint pos;
|
||||
guint col;
|
||||
|
||||
tile = gtk_list_item_manager_get_nearest_tile (self->item_manager, x, y);
|
||||
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);
|
||||
col = gtk_grid_view_get_column_for_position (self->item_manager, self->n_columns, pos);
|
||||
|
||||
if (tile->n_items > 1)
|
||||
{
|
||||
int xspacing, yspacing;
|
||||
unsigned int row_height;
|
||||
unsigned int row_index;
|
||||
|
||||
gtk_list_base_get_border_spacing (base, &xspacing, &yspacing);
|
||||
|
||||
/* offset in x direction */
|
||||
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 */
|
||||
if (tile->n_items > self->n_columns)
|
||||
{
|
||||
guint rows_in_tile = tile->n_items / self->n_columns;
|
||||
|
||||
row_height = (tile->area.height + yspacing) / rows_in_tile - yspacing;
|
||||
row_index = MIN (tile->area.height - 1, y - tile->area.y) / (row_height + yspacing);
|
||||
guint 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);
|
||||
pos += self->n_columns * row_index;
|
||||
|
||||
if (area)
|
||||
{
|
||||
area->y = tile->area.y + row_index * (row_height + yspacing);
|
||||
area->height = row_height;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
row_height = tile->area.height;
|
||||
row_index = 0;
|
||||
if (area)
|
||||
{
|
||||
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
|
||||
{
|
||||
@@ -688,7 +657,7 @@ gtk_grid_view_measure_list (GtkWidget *widget,
|
||||
gtk_grid_view_measure_column_size (self, &col_min, &col_nat);
|
||||
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);
|
||||
column_size = (for_size + xspacing) / n_columns - xspacing;
|
||||
column_size = for_size / n_columns;
|
||||
|
||||
i = 0;
|
||||
row_height = 0;
|
||||
@@ -767,48 +736,6 @@ gtk_grid_view_measure (GtkWidget *widget,
|
||||
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
|
||||
gtk_grid_view_size_allocate (GtkWidget *widget,
|
||||
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);
|
||||
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 */
|
||||
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)
|
||||
{
|
||||
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,
|
||||
xspacing,
|
||||
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);
|
||||
|
||||
/* step 2: split tiles as required */
|
||||
gtk_grid_view_split_tiles_by_columns (self->item_manager, self->n_columns);
|
||||
|
||||
/* step 3: determine height of known rows */
|
||||
/* step 2: determine height of known rows */
|
||||
heights = g_array_new (FALSE, FALSE, sizeof (int));
|
||||
|
||||
tile = gtk_list_item_manager_get_first (self->item_manager);
|
||||
while (tile != NULL)
|
||||
for (;
|
||||
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);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Not a multirow tile */
|
||||
i = 0;
|
||||
row_height = 0;
|
||||
|
||||
for (i = 0, start = tile;
|
||||
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)
|
||||
{
|
||||
@@ -884,53 +812,32 @@ gtk_grid_view_size_allocate (GtkWidget *widget,
|
||||
g_array_append_val (heights, 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;
|
||||
}
|
||||
|
||||
if (row_height > 0)
|
||||
{
|
||||
for (i = 0;
|
||||
start != tile;
|
||||
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,
|
||||
start,
|
||||
column_end (self, xspacing, i + n_columns - 1)
|
||||
column_end (self, xspacing, i + start->n_items - 1)
|
||||
- column_start (self, xspacing, i),
|
||||
tile_height);
|
||||
|
||||
i = (i + start->n_items) % self->n_columns;
|
||||
row_height);
|
||||
i += start->n_items;
|
||||
}
|
||||
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);
|
||||
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;
|
||||
i = 0;
|
||||
for (tile = gtk_list_item_manager_get_first (self->item_manager);
|
||||
@@ -941,8 +848,7 @@ gtk_grid_view_size_allocate (GtkWidget *widget,
|
||||
tile,
|
||||
column_start (self, xspacing, i),
|
||||
y);
|
||||
|
||||
if (gtk_grid_view_is_multirow_tile (self->item_manager, self->n_columns, tile))
|
||||
if (tile->n_items >= self->n_columns && tile->widget == NULL)
|
||||
{
|
||||
g_assert (i == 0);
|
||||
g_assert (tile->n_items % self->n_columns == 0);
|
||||
@@ -955,10 +861,15 @@ gtk_grid_view_size_allocate (GtkWidget *widget,
|
||||
}
|
||||
else
|
||||
{
|
||||
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);
|
||||
if (tile->area.height == 0)
|
||||
{
|
||||
/* this case is for the last row - it may not be a full row so it won't
|
||||
* 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;
|
||||
}
|
||||
|
||||
@@ -969,8 +880,23 @@ gtk_grid_view_size_allocate (GtkWidget *widget,
|
||||
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));
|
||||
}
|
||||
|
||||
@@ -1025,8 +951,6 @@ gtk_grid_view_dispose (GObject *object)
|
||||
|
||||
self->item_manager = NULL;
|
||||
|
||||
g_clear_object (&self->factory);
|
||||
|
||||
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))
|
||||
return;
|
||||
|
||||
gtk_grid_view_update_factories (self);
|
||||
|
||||
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 <gdk-pixbuf/gdk-pixdata.h>
|
||||
|
||||
#if defined(G_ENABLE_DEBUG) || defined(BUILD_TOOLS)
|
||||
|
||||
#define VERBOSE(x)
|
||||
|
||||
@@ -402,4 +401,3 @@ gtk_icon_cache_validate (CacheInfo *info)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+40
-14
@@ -51,7 +51,7 @@
|
||||
#include "gtkstyleproviderprivate.h"
|
||||
#include "gtksymbolicpaintable.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
#include "gdktextureutilsprivate.h"
|
||||
#include "gdkpixbufutilsprivate.h"
|
||||
#include "gdk/gdktextureprivate.h"
|
||||
#include "gdk/gdkprofilerprivate.h"
|
||||
|
||||
@@ -3747,15 +3747,22 @@ icon_ensure_texture__locked (GtkIconPaintable *icon,
|
||||
{
|
||||
if (icon->is_svg)
|
||||
{
|
||||
GdkPixbuf *source_pixbuf;
|
||||
|
||||
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,
|
||||
icon->desired_scale,
|
||||
&load_error);
|
||||
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,
|
||||
TRUE, &load_error);
|
||||
if (source_pixbuf)
|
||||
{
|
||||
icon->texture = gdk_texture_new_for_pixbuf (source_pixbuf);
|
||||
g_object_unref (source_pixbuf);
|
||||
}
|
||||
}
|
||||
else
|
||||
icon->texture = gdk_texture_new_from_resource (icon->filename);
|
||||
@@ -3764,8 +3771,10 @@ icon_ensure_texture__locked (GtkIconPaintable *icon,
|
||||
{
|
||||
if (icon->is_svg)
|
||||
{
|
||||
GdkPixbuf *source_pixbuf;
|
||||
|
||||
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,
|
||||
icon->desired_scale,
|
||||
&load_error);
|
||||
@@ -3774,16 +3783,22 @@ icon_ensure_texture__locked (GtkIconPaintable *icon,
|
||||
GFile *file = g_file_new_for_path (icon->filename);
|
||||
GInputStream *stream = G_INPUT_STREAM (g_file_read (file, NULL, &load_error));
|
||||
|
||||
g_object_unref (file);
|
||||
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,
|
||||
TRUE, NULL,
|
||||
&load_error);
|
||||
g_object_unref (stream);
|
||||
}
|
||||
|
||||
g_object_unref (file);
|
||||
else
|
||||
source_pixbuf = NULL;
|
||||
}
|
||||
if (source_pixbuf)
|
||||
{
|
||||
icon->texture = gdk_texture_new_for_pixbuf (source_pixbuf);
|
||||
g_object_unref (source_pixbuf);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -3794,24 +3809,35 @@ icon_ensure_texture__locked (GtkIconPaintable *icon,
|
||||
else
|
||||
{
|
||||
GInputStream *stream;
|
||||
GdkPixbuf *source_pixbuf;
|
||||
|
||||
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)
|
||||
{
|
||||
/* SVG icons are a special case - we just immediately scale them
|
||||
* to the desired size
|
||||
*/
|
||||
if (icon->is_svg)
|
||||
icon->texture = gdk_texture_new_from_stream_at_scale (stream,
|
||||
pixel_size, pixel_size,
|
||||
TRUE, NULL,
|
||||
&load_error);
|
||||
{
|
||||
source_pixbuf = _gdk_pixbuf_new_from_stream_at_scale (stream,
|
||||
pixel_size, pixel_size,
|
||||
TRUE, NULL,
|
||||
&load_error);
|
||||
}
|
||||
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);
|
||||
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 "gtktypebuiltins.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
#include "gdktextureutilsprivate.h"
|
||||
#include "gdkpixbufutilsprivate.h"
|
||||
|
||||
#include <math.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].
|
||||
*
|
||||
* Returns: a new `GtkImage`
|
||||
*
|
||||
* Deprecated: 4.12: Use [ctor@Gtk.Image.new_from_paintable] and
|
||||
* [ctor@Gdk.Texture.new_for_pixbuf] instead
|
||||
*/
|
||||
GtkWidget*
|
||||
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);
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gtk_image_set_from_pixbuf (image, pixbuf);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
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],
|
||||
* and you can't get back the exact pixbuf once this is called,
|
||||
* only a paintable.
|
||||
*
|
||||
* Deprecated: 4.12: Use [method@Gtk.Image.set_from_paintable] instead
|
||||
*/
|
||||
void
|
||||
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);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
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);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkWidget* gtk_image_new_from_paintable (GdkPaintable *paintable);
|
||||
@@ -91,7 +91,7 @@ void gtk_image_set_from_file (GtkImage *image,
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_image_set_from_resource (GtkImage *image,
|
||||
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,
|
||||
GdkPixbuf *pixbuf);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
|
||||
+66
-102
@@ -198,6 +198,7 @@ gtk_list_item_manager_augment_node (GtkRbTree *tree,
|
||||
aug->has_footer = TRUE;
|
||||
break;
|
||||
case GTK_LIST_TILE_ITEM:
|
||||
case GTK_LIST_TILE_FILLER:
|
||||
case GTK_LIST_TILE_REMOVED:
|
||||
aug->has_header = 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
|
||||
* 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 *
|
||||
gtk_list_item_manager_get_nearest_tile (GtkListItemManager *self,
|
||||
@@ -595,7 +597,7 @@ gtk_list_tile_get_position (GtkListItemManager *self,
|
||||
}
|
||||
else
|
||||
{
|
||||
pos = 0;
|
||||
pos = 0;
|
||||
}
|
||||
|
||||
for (parent = gtk_rb_tree_node_get_parent (tile);
|
||||
@@ -631,7 +633,7 @@ static GtkListTile *
|
||||
gtk_list_tile_get_next_skip (GtkListTile *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))
|
||||
{ }
|
||||
|
||||
@@ -642,7 +644,7 @@ static GtkListTile *
|
||||
gtk_list_tile_get_previous_skip (GtkListTile *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))
|
||||
{ }
|
||||
|
||||
@@ -713,7 +715,6 @@ static void
|
||||
gtk_list_tile_set_type (GtkListTile *tile,
|
||||
GtkListTileType type)
|
||||
{
|
||||
g_assert (tile != NULL);
|
||||
if (tile->type == type)
|
||||
return;
|
||||
|
||||
@@ -844,8 +845,7 @@ gtk_list_item_manager_remove_items (GtkListItemManager *self,
|
||||
if (offset)
|
||||
tile = gtk_list_item_manager_ensure_split (self, tile, offset);
|
||||
header = gtk_list_tile_get_previous_skip (tile);
|
||||
if (header != NULL &&
|
||||
(header->type != GTK_LIST_TILE_HEADER && header->type != GTK_LIST_TILE_UNMATCHED_HEADER))
|
||||
if (header->type != GTK_LIST_TILE_HEADER && header->type != GTK_LIST_TILE_UNMATCHED_HEADER)
|
||||
header = NULL;
|
||||
|
||||
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);
|
||||
break;
|
||||
|
||||
case GTK_LIST_TILE_FILLER:
|
||||
case GTK_LIST_TILE_REMOVED:
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
@@ -910,7 +911,7 @@ gtk_list_item_manager_add_items (GtkListItemManager *self,
|
||||
GtkListItemChange *change,
|
||||
guint position,
|
||||
guint n_items)
|
||||
{
|
||||
{
|
||||
GtkListTile *tile;
|
||||
guint offset;
|
||||
gboolean has_sections;
|
||||
@@ -925,7 +926,7 @@ gtk_list_item_manager_add_items (GtkListItemManager *self,
|
||||
{
|
||||
/* at end of list, pick the footer */
|
||||
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))
|
||||
{ }
|
||||
|
||||
@@ -951,7 +952,7 @@ gtk_list_item_manager_add_items (GtkListItemManager *self,
|
||||
}
|
||||
if (offset)
|
||||
tile = gtk_list_item_manager_ensure_split (self, tile, offset);
|
||||
|
||||
|
||||
tile = gtk_rb_tree_insert_before (self->items, tile);
|
||||
tile->type = GTK_LIST_TILE_ITEM;
|
||||
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);
|
||||
|
||||
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_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
|
||||
* tile will remain with @n_items items, the remaining
|
||||
* 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
|
||||
* the split.
|
||||
@@ -1026,6 +1027,34 @@ gtk_list_tile_split (GtkListItemManager *self,
|
||||
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:
|
||||
* @self: the listitemmanager
|
||||
@@ -1043,7 +1072,7 @@ gtk_list_tile_split (GtkListItemManager *self,
|
||||
*
|
||||
* Returns: The next tile or NULL if everything was gc'ed
|
||||
**/
|
||||
static GtkListTile *
|
||||
GtkListTile *
|
||||
gtk_list_tile_gc (GtkListItemManager *self,
|
||||
GtkListTile *tile)
|
||||
{
|
||||
@@ -1052,6 +1081,13 @@ gtk_list_tile_gc (GtkListItemManager *self,
|
||||
if (tile == 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)
|
||||
{
|
||||
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_UNMATCHED_HEADER:
|
||||
case GTK_LIST_TILE_UNMATCHED_FOOTER:
|
||||
case GTK_LIST_TILE_FILLER:
|
||||
break;
|
||||
|
||||
case GTK_LIST_TILE_REMOVED:
|
||||
@@ -1093,18 +1130,6 @@ gtk_list_tile_gc (GtkListItemManager *self,
|
||||
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
|
||||
gtk_list_item_manager_release_items (GtkListItemManager *self,
|
||||
GtkListItemChange *change)
|
||||
@@ -1153,6 +1178,7 @@ gtk_list_item_manager_release_items (GtkListItemManager *self,
|
||||
deleted_section = TRUE;
|
||||
break;
|
||||
|
||||
case GTK_LIST_TILE_FILLER:
|
||||
case GTK_LIST_TILE_REMOVED:
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
@@ -1181,7 +1207,7 @@ gtk_list_item_manager_insert_section (GtkListItemManager *self,
|
||||
{
|
||||
GtkListTile *tile, *footer, *header;
|
||||
guint offset;
|
||||
|
||||
|
||||
tile = gtk_list_item_manager_get_nth (self, pos, &offset);
|
||||
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);
|
||||
|
||||
header = gtk_list_tile_get_previous_skip (tile);
|
||||
if (header != NULL &&
|
||||
(header->type == GTK_LIST_TILE_HEADER || header->type == GTK_LIST_TILE_UNMATCHED_HEADER))
|
||||
if (header->type == GTK_LIST_TILE_HEADER || header->type == GTK_LIST_TILE_UNMATCHED_HEADER)
|
||||
{
|
||||
if (header_type == GTK_LIST_TILE_HEADER)
|
||||
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);
|
||||
other;
|
||||
other = gtk_rb_tree_node_get_previous (other))
|
||||
{
|
||||
{
|
||||
if (other->widget)
|
||||
return other->widget;
|
||||
}
|
||||
@@ -1386,6 +1411,7 @@ gtk_list_item_manager_ensure_items (GtkListItemManager *self,
|
||||
break;
|
||||
|
||||
case GTK_LIST_TILE_UNMATCHED_FOOTER:
|
||||
case GTK_LIST_TILE_FILLER:
|
||||
case GTK_LIST_TILE_REMOVED:
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
@@ -1434,7 +1460,7 @@ gtk_list_item_manager_model_items_changed_cb (GListModel *model,
|
||||
GtkListTile *tile, *new_tile;
|
||||
GtkWidget *insert_after;
|
||||
guint i, 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);
|
||||
new_tile && new_tile->widget == NULL;
|
||||
@@ -1550,7 +1576,7 @@ gtk_list_item_manager_model_items_changed_cb (GListModel *model,
|
||||
GtkListItemTracker *tracker = l->data;
|
||||
GtkListTile *tile;
|
||||
|
||||
if (tracker->widget != NULL ||
|
||||
if (tracker->widget != NULL ||
|
||||
tracker->position == GTK_INVALID_LIST_POSITION)
|
||||
continue;
|
||||
|
||||
@@ -1565,67 +1591,6 @@ gtk_list_item_manager_model_items_changed_cb (GListModel *model,
|
||||
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
|
||||
gtk_list_item_manager_model_selection_changed_cb (GListModel *model,
|
||||
guint position,
|
||||
@@ -1666,6 +1631,7 @@ static void
|
||||
gtk_list_item_manager_clear_model (GtkListItemManager *self)
|
||||
{
|
||||
GtkListItemChange change;
|
||||
GtkListTile *tile;
|
||||
GSList *l;
|
||||
|
||||
if (self->model == NULL)
|
||||
@@ -1685,13 +1651,15 @@ gtk_list_item_manager_clear_model (GtkListItemManager *self)
|
||||
g_signal_handlers_disconnect_by_func (self->model,
|
||||
gtk_list_item_manager_model_items_changed_cb,
|
||||
self);
|
||||
g_signal_handlers_disconnect_by_func (self->model,
|
||||
gtk_list_item_manager_model_sections_changed_cb,
|
||||
self);
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -1746,11 +1714,6 @@ gtk_list_item_manager_set_model (GtkListItemManager *self,
|
||||
"selection-changed",
|
||||
G_CALLBACK (gtk_list_item_manager_model_selection_changed_cb),
|
||||
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_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;
|
||||
break;
|
||||
case GTK_LIST_TILE_ITEM:
|
||||
case GTK_LIST_TILE_FILLER:
|
||||
case GTK_LIST_TILE_REMOVED:
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -51,6 +51,7 @@ typedef enum
|
||||
GTK_LIST_TILE_FOOTER,
|
||||
GTK_LIST_TILE_UNMATCHED_HEADER,
|
||||
GTK_LIST_TILE_UNMATCHED_FOOTER,
|
||||
GTK_LIST_TILE_FILLER,
|
||||
GTK_LIST_TILE_REMOVED,
|
||||
} GtkListTileType;
|
||||
|
||||
@@ -59,7 +60,7 @@ struct _GtkListTile
|
||||
GtkListTileType type;
|
||||
GtkWidget *widget;
|
||||
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;
|
||||
};
|
||||
|
||||
@@ -94,19 +95,7 @@ gpointer gtk_list_item_manager_get_nth (GtkListItemMana
|
||||
GtkListTile * gtk_list_item_manager_get_nearest_tile (GtkListItemManager *self,
|
||||
int x,
|
||||
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,
|
||||
GtkListTile *tile);
|
||||
@@ -127,6 +116,10 @@ void gtk_list_tile_set_area_size (GtkListItemMana
|
||||
GtkListTile * gtk_list_tile_split (GtkListItemManager *self,
|
||||
GtkListTile *tile,
|
||||
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,
|
||||
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_FOOTER:
|
||||
case GTK_LIST_TILE_UNMATCHED_FOOTER:
|
||||
case GTK_LIST_TILE_FILLER:
|
||||
case GTK_LIST_TILE_REMOVED:
|
||||
g_assert (tile->widget == NULL);
|
||||
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);
|
||||
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 */
|
||||
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)
|
||||
{
|
||||
gtk_list_base_allocate (GTK_LIST_BASE (self));
|
||||
@@ -633,7 +632,7 @@ gtk_list_view_size_allocate (GtkWidget *widget,
|
||||
|
||||
for (;
|
||||
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)
|
||||
continue;
|
||||
@@ -727,9 +726,6 @@ gtk_list_view_dispose (GObject *object)
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -42,11 +42,12 @@ BOOLEAN:OBJECT,OBJECT,OBJECT
|
||||
BOOLEAN:STRING
|
||||
BOOLEAN:UINT,UINT,FLAGS
|
||||
BOOLEAN:VOID
|
||||
FLAGS:OBJECT,DOUBLE,DOUBLE
|
||||
ENUM:OBJECT,DOUBLE,DOUBLE
|
||||
FLAGS:DOUBLE,DOUBLE
|
||||
INT:INT
|
||||
INT:OBJECT,OBJECT,POINTER
|
||||
INT:POINTER
|
||||
OBJECT:BOOLEAN
|
||||
OBJECT:DOUBLE,DOUBLE
|
||||
OBJECT:OBJECT
|
||||
OBJECT:VOID
|
||||
|
||||
+1
-1
@@ -1554,7 +1554,7 @@ gtk_menu_button_get_child (GtkMenuButton *menu_button)
|
||||
* @menu_button: a `GtkMenuButton`
|
||||
* @active: whether the menu button is active
|
||||
*
|
||||
* Sets whether the menu button is active.
|
||||
* Sets whether menu button acts is active.
|
||||
*
|
||||
* 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_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_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]);
|
||||
}
|
||||
|
||||
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
|
||||
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,
|
||||
gtk_multi_selection_items_changed_cb,
|
||||
self);
|
||||
g_signal_handlers_disconnect_by_func (self->model,
|
||||
gtk_multi_selection_sections_changed_cb,
|
||||
self);
|
||||
g_clear_object (&self->model);
|
||||
}
|
||||
|
||||
@@ -504,9 +490,6 @@ gtk_multi_selection_set_model (GtkMultiSelection *self,
|
||||
"items-changed",
|
||||
G_CALLBACK (gtk_multi_selection_items_changed_cb),
|
||||
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,
|
||||
0,
|
||||
n_items_before,
|
||||
|
||||
+1
-20
@@ -33,8 +33,6 @@
|
||||
*
|
||||
* This model is meant to be used as a simple wrapper around a `GListModel`
|
||||
* when a `GtkSelectionModel` is required.
|
||||
*
|
||||
* `GtkNoSelection` passes through sections from the underlying model.
|
||||
*/
|
||||
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]);
|
||||
}
|
||||
|
||||
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
|
||||
gtk_no_selection_clear_model (GtkNoSelection *self)
|
||||
{
|
||||
if (self->model == NULL)
|
||||
return;
|
||||
|
||||
g_signal_handlers_disconnect_by_func (self->model,
|
||||
g_signal_handlers_disconnect_by_func (self->model,
|
||||
gtk_no_selection_items_changed_cb,
|
||||
self);
|
||||
g_signal_handlers_disconnect_by_func (self->model,
|
||||
gtk_no_selection_sections_changed_cb,
|
||||
self);
|
||||
g_clear_object (&self->model);
|
||||
}
|
||||
|
||||
@@ -361,9 +345,6 @@ gtk_no_selection_set_model (GtkNoSelection *self,
|
||||
self->model = g_object_ref (model);
|
||||
g_signal_connect (self->model, "items-changed",
|
||||
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);
|
||||
}
|
||||
else
|
||||
|
||||
+5
-49
@@ -46,7 +46,6 @@
|
||||
#include "gtkorientable.h"
|
||||
#include "gtksizerequest.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkselectionmodel.h"
|
||||
#include "gtkstack.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
@@ -1173,7 +1172,7 @@ gtk_notebook_class_init (GtkNotebookClass *class)
|
||||
*
|
||||
* A selection model with the pages.
|
||||
*/
|
||||
properties[PROP_PAGES] =
|
||||
properties[PROP_PAGES] =
|
||||
g_param_spec_object ("pages", NULL, NULL,
|
||||
G_TYPE_LIST_MODEL,
|
||||
GTK_PARAM_READABLE);
|
||||
@@ -1359,7 +1358,7 @@ gtk_notebook_class_init (GtkNotebookClass *class)
|
||||
/**
|
||||
* 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);
|
||||
|
||||
@@ -1828,7 +1827,7 @@ gtk_notebook_reorder_tab (GtkNotebook *notebook,
|
||||
page_num = reorder_tab (notebook, child->next, notebook->focus_tab);
|
||||
else
|
||||
page_num = reorder_tab (notebook, child, notebook->focus_tab);
|
||||
|
||||
|
||||
gtk_notebook_child_reordered (notebook, notebook->focus_tab->data);
|
||||
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);
|
||||
if (list != NULL)
|
||||
page = list->data;
|
||||
|
||||
|
||||
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_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_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))
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, gtk_notebook_pages_list_model_init))
|
||||
|
||||
static void
|
||||
gtk_notebook_pages_init (GtkNotebookPages *pages)
|
||||
|
||||
@@ -334,8 +334,8 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
static GtkOrdering
|
||||
gtk_numeric_sorter_compare (GtkSorter *sorter,
|
||||
gpointer item1,
|
||||
gpointer item2)
|
||||
gpointer item1,
|
||||
gpointer item2)
|
||||
{
|
||||
GtkNumericSorter *self = GTK_NUMERIC_SORTER (sorter);
|
||||
GValue value1 = G_VALUE_INIT;
|
||||
|
||||
@@ -108,7 +108,6 @@ enum {
|
||||
|
||||
typedef struct {
|
||||
GtkWindow *parent;
|
||||
char *parent_handle;
|
||||
GFile *file;
|
||||
char *uri;
|
||||
gboolean open_folder;
|
||||
@@ -129,9 +128,8 @@ open_uri_data_free (OpenUriData *data)
|
||||
g_clear_object (&data->connection);
|
||||
if (data->cancel_handler)
|
||||
g_signal_handler_disconnect (data->cancellable, data->cancel_handler);
|
||||
if (data->parent && data->parent_handle)
|
||||
gtk_window_unexport_handle (data->parent, data->parent_handle);
|
||||
g_free (data->parent_handle);
|
||||
if (data->parent)
|
||||
gtk_window_unexport_handle (data->parent);
|
||||
g_clear_object (&data->parent);
|
||||
g_clear_object (&data->file);
|
||||
g_free (data->uri);
|
||||
@@ -428,8 +426,6 @@ window_handle_exported (GtkWindow *window,
|
||||
GAppLaunchContext *context;
|
||||
char *activation_token = NULL;
|
||||
|
||||
data->parent_handle = g_strdup (handle);
|
||||
|
||||
if (window)
|
||||
display = gtk_widget_get_display (GTK_WIDGET (window));
|
||||
else
|
||||
|
||||
+1
-11
@@ -873,18 +873,8 @@ gtk_path_bar_get_mount_callback (GObject *source,
|
||||
{
|
||||
GFile *file = G_FILE (source);
|
||||
struct SetFileInfo *file_info = data;
|
||||
GError *error = NULL;
|
||||
|
||||
file_info->mount = g_file_find_enclosing_mount_finish (file, result,
|
||||
&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);
|
||||
file_info->mount = g_file_find_enclosing_mount_finish (file, result, NULL);
|
||||
|
||||
if (file_info->mount)
|
||||
file_info->root_file = g_mount_get_root (file_info->mount);
|
||||
|
||||
+1
-6
@@ -28,7 +28,7 @@
|
||||
#include "gtksnapshot.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
#include "gdktextureutilsprivate.h"
|
||||
#include "gdkpixbufutilsprivate.h"
|
||||
|
||||
/**
|
||||
* GtkPicture:
|
||||
@@ -525,9 +525,6 @@ gtk_picture_new_for_paintable (GdkPaintable *paintable)
|
||||
* The pixbuf must not be modified after passing it to this function.
|
||||
*
|
||||
* Returns: a new `GtkPicture`
|
||||
*
|
||||
* Deprecated: 4.12: Use [ctor@Gtk.Picture.new_for_paintable] and
|
||||
* [ctor@Gdk.Texture.new_for_pixbuf] instead
|
||||
*/
|
||||
GtkWidget*
|
||||
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.
|
||||
*
|
||||
* This is a utility function that calls [method@Gtk.Picture.set_paintable].
|
||||
*
|
||||
* Deprecated: 4.12: Use [method@Gtk.Picture.set_paintable] instead
|
||||
*/
|
||||
void
|
||||
gtk_picture_set_pixbuf (GtkPicture *self,
|
||||
|
||||
+2
-2
@@ -39,7 +39,7 @@ GDK_AVAILABLE_IN_ALL
|
||||
GtkWidget* gtk_picture_new (void);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
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);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkWidget* gtk_picture_new_for_file (GFile *file);
|
||||
@@ -64,7 +64,7 @@ void gtk_picture_set_filename (GtkPicture
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_picture_set_resource (GtkPicture *self,
|
||||
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,
|
||||
GdkPixbuf *pixbuf);
|
||||
|
||||
|
||||
+8
-9
@@ -483,7 +483,6 @@ create_popup_layout (GtkPopover *popover)
|
||||
GdkPopupLayout *layout;
|
||||
GtkCssStyle *style;
|
||||
GtkBorder shadow_width;
|
||||
gboolean ltr = gtk_widget_get_direction (GTK_WIDGET (popover)) != GTK_TEXT_DIR_RTL;
|
||||
|
||||
compute_surface_pointing_to (popover, &rect);
|
||||
|
||||
@@ -546,13 +545,13 @@ create_popup_layout (GtkPopover *popover)
|
||||
switch (gtk_widget_get_halign (GTK_WIDGET (popover)))
|
||||
{
|
||||
case GTK_ALIGN_START:
|
||||
parent_anchor = ltr ? GDK_GRAVITY_NORTH_WEST : GDK_GRAVITY_NORTH_EAST;
|
||||
surface_anchor = ltr ? GDK_GRAVITY_SOUTH_WEST : GDK_GRAVITY_SOUTH_EAST;
|
||||
parent_anchor = GDK_GRAVITY_NORTH_WEST;
|
||||
surface_anchor = GDK_GRAVITY_SOUTH_WEST;
|
||||
break;
|
||||
|
||||
case GTK_ALIGN_END:
|
||||
parent_anchor = ltr ? GDK_GRAVITY_NORTH_EAST : GDK_GRAVITY_NORTH_WEST;
|
||||
surface_anchor = ltr ? GDK_GRAVITY_SOUTH_EAST : GDK_GRAVITY_SOUTH_WEST;
|
||||
parent_anchor = GDK_GRAVITY_NORTH_EAST;
|
||||
surface_anchor = GDK_GRAVITY_SOUTH_EAST;
|
||||
break;
|
||||
|
||||
case GTK_ALIGN_FILL:
|
||||
@@ -571,13 +570,13 @@ create_popup_layout (GtkPopover *popover)
|
||||
switch (gtk_widget_get_halign (GTK_WIDGET (popover)))
|
||||
{
|
||||
case GTK_ALIGN_START:
|
||||
parent_anchor = ltr ? GDK_GRAVITY_SOUTH_WEST : GDK_GRAVITY_SOUTH_EAST;
|
||||
surface_anchor = ltr ? GDK_GRAVITY_NORTH_WEST : GDK_GRAVITY_NORTH_EAST;
|
||||
parent_anchor = GDK_GRAVITY_SOUTH_WEST;
|
||||
surface_anchor = GDK_GRAVITY_NORTH_WEST;
|
||||
break;
|
||||
|
||||
case GTK_ALIGN_END:
|
||||
parent_anchor = ltr ? GDK_GRAVITY_SOUTH_EAST : GDK_GRAVITY_SOUTH_WEST;
|
||||
surface_anchor = ltr ? GDK_GRAVITY_NORTH_EAST : GDK_GRAVITY_NORTH_WEST;
|
||||
parent_anchor = GDK_GRAVITY_SOUTH_EAST;
|
||||
surface_anchor = GDK_GRAVITY_NORTH_EAST;
|
||||
break;
|
||||
|
||||
case GTK_ALIGN_FILL:
|
||||
|
||||
@@ -48,7 +48,6 @@ typedef struct {
|
||||
GtkPrintOperationResult result;
|
||||
GtkPrintOperationPrintFunc print_cb;
|
||||
GtkWindow *parent;
|
||||
char *handle;
|
||||
GMainLoop *loop;
|
||||
guint32 token;
|
||||
GDestroyNotify destroy;
|
||||
@@ -63,9 +62,8 @@ portal_data_free (gpointer data)
|
||||
{
|
||||
PortalData *portal = data;
|
||||
|
||||
if (portal->parent && portal->handle)
|
||||
gtk_window_unexport_handle (portal->parent, portal->handle);
|
||||
g_free (portal->handle);
|
||||
if (portal->parent)
|
||||
gtk_window_unexport_handle (portal->parent);
|
||||
g_object_unref (portal->op);
|
||||
g_object_unref (portal->proxy);
|
||||
if (portal->loop)
|
||||
@@ -549,8 +547,6 @@ window_handle_exported (GtkWindow *window,
|
||||
{
|
||||
PortalData *portal = user_data;
|
||||
|
||||
portal->handle = g_strdup (handle_str);
|
||||
|
||||
g_dbus_proxy_call (portal->proxy,
|
||||
"PreparePrint",
|
||||
g_variant_new ("(ss@a{sv}@a{sv}@a{sv})",
|
||||
|
||||
@@ -329,7 +329,7 @@ gtk_property_lookup_list_model_get_property (GObject *object,
|
||||
break;
|
||||
|
||||
case PROP_PROPERTY:
|
||||
g_value_set_string (value, self->property);
|
||||
g_value_set_object (value, self->property);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -408,7 +408,7 @@ gtk_property_lookup_list_model_class_init (GtkPropertyLookupListModelClass *klas
|
||||
*/
|
||||
properties[PROP_OBJECT] =
|
||||
g_param_spec_object ("object", NULL, NULL,
|
||||
G_TYPE_OBJECT,
|
||||
G_TYPE_LIST_MODEL,
|
||||
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
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
|
||||
gtk_property_lookup_list_model_init (GtkPropertyLookupListModel *self)
|
||||
{
|
||||
self->item_type = G_TYPE_OBJECT;
|
||||
self->items = g_ptr_array_new ();
|
||||
/* add sentinel */
|
||||
g_ptr_array_add (self->items, NULL);
|
||||
|
||||
@@ -1431,7 +1431,6 @@ gtk_recent_manager_clamp_to_age (GtkRecentManager *manager,
|
||||
}
|
||||
|
||||
g_strfreev (uris);
|
||||
g_date_time_unref (now);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2181,16 +2180,13 @@ gtk_recent_info_get_uri_display (GtkRecentInfo *info)
|
||||
int
|
||||
gtk_recent_info_get_age (GtkRecentInfo *info)
|
||||
{
|
||||
int diff;
|
||||
GDateTime *now;
|
||||
|
||||
g_return_val_if_fail (info != NULL, -1);
|
||||
|
||||
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 diff;
|
||||
return (int) (g_date_time_difference (now, info->modified) / (double)G_TIME_SPAN_DAY);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-31
@@ -1750,38 +1750,8 @@ gtk_scrolled_window_measure (GtkWidget *widget,
|
||||
if (priv->child && gtk_widget_get_visible (priv->child))
|
||||
{
|
||||
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 */
|
||||
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,
|
||||
gtk_widget_measure (priv->child, orientation, -1,
|
||||
&min_child_size, &nat_child_size,
|
||||
NULL, NULL);
|
||||
|
||||
|
||||
+12
-11
@@ -26,19 +26,21 @@
|
||||
/**
|
||||
* 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
|
||||
* like `GtkListView` and `GtkGridView` then allow displaying section headers for
|
||||
* these sections by installing a header factory.
|
||||
* This support is then used by widgets using list models to be able to group their
|
||||
* items into sections.
|
||||
*
|
||||
* Many GTK list models support sections inherently, or they pass through the sections
|
||||
* 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
|
||||
* [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
|
||||
* that range are invalidated, too.
|
||||
*
|
||||
@@ -194,11 +196,10 @@ gtk_list_model_get_section (GListModel *self,
|
||||
* @n_items: the number of changed items
|
||||
*
|
||||
* This function emits the [signal@Gtk.SectionModel::section-changed]
|
||||
* 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 start. It does not have to cover all positions for
|
||||
* which the section has changed.
|
||||
* 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
|
||||
* start. It does not have to cover all positions for which the section
|
||||
* has changed.
|
||||
*
|
||||
* The [signal@Gio.ListModel::items-changed] implies the effect of the
|
||||
* [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));
|
||||
}
|
||||
|
||||
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
|
||||
gtk_single_selection_clear_model (GtkSingleSelection *self)
|
||||
{
|
||||
if (self->model == NULL)
|
||||
return;
|
||||
|
||||
g_signal_handlers_disconnect_by_func (self->model,
|
||||
g_signal_handlers_disconnect_by_func (self->model,
|
||||
gtk_single_selection_items_changed_cb,
|
||||
self);
|
||||
g_signal_handlers_disconnect_by_func (self->model,
|
||||
gtk_single_selection_sections_changed_cb,
|
||||
self);
|
||||
g_clear_object (&self->model);
|
||||
}
|
||||
|
||||
@@ -572,7 +558,7 @@ gtk_single_selection_set_model (GtkSingleSelection *self,
|
||||
return;
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (self));
|
||||
|
||||
|
||||
n_items_before = self->model ? g_list_model_get_n_items (self->model) : 0;
|
||||
gtk_single_selection_clear_model (self);
|
||||
|
||||
@@ -581,9 +567,6 @@ gtk_single_selection_set_model (GtkSingleSelection *self,
|
||||
self->model = g_object_ref (model);
|
||||
g_signal_connect (self->model, "items-changed",
|
||||
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,
|
||||
0,
|
||||
n_items_before,
|
||||
|
||||
+3
-69
@@ -20,7 +20,6 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkslicelistmodel.h"
|
||||
#include "gtksectionmodelprivate.h"
|
||||
|
||||
#include "gtkprivate.h"
|
||||
|
||||
@@ -32,8 +31,6 @@
|
||||
* 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
|
||||
* opened.
|
||||
*
|
||||
* `GtkSliceListModel` passes through sections from the underlying model.
|
||||
*/
|
||||
|
||||
#define DEFAULT_SIZE 10
|
||||
@@ -55,6 +52,8 @@ struct _GtkSliceListModel
|
||||
GListModel *model;
|
||||
guint offset;
|
||||
guint size;
|
||||
|
||||
guint n_items;
|
||||
};
|
||||
|
||||
struct _GtkSliceListModelClass
|
||||
@@ -112,69 +111,8 @@ gtk_slice_list_model_model_init (GListModelInterface *iface)
|
||||
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_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))
|
||||
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, gtk_slice_list_model_model_init))
|
||||
|
||||
static void
|
||||
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)
|
||||
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_clear_object (&self->model);
|
||||
}
|
||||
@@ -450,9 +387,6 @@ gtk_slice_list_model_set_model (GtkSliceListModel *self,
|
||||
self->model = g_object_ref (model);
|
||||
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));
|
||||
|
||||
if (GTK_IS_SECTION_MODEL (model))
|
||||
g_signal_connect (model, "sections-changed", G_CALLBACK (gtk_slice_list_model_sections_changed_cb), self);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+19
-36
@@ -873,10 +873,9 @@ gtk_sort_list_model_get_property (GObject *object,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_sort_list_model_sorter_changed (GtkSorter *sorter,
|
||||
int change,
|
||||
GtkSortListModel *self,
|
||||
gboolean sections_changed)
|
||||
gtk_sort_list_model_sorter_changed_cb (GtkSorter *sorter,
|
||||
int change,
|
||||
GtkSortListModel *self)
|
||||
{
|
||||
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))
|
||||
pos = n_items = 0;
|
||||
else
|
||||
@@ -929,25 +922,8 @@ gtk_sort_list_model_sorter_changed (GtkSorter *sorter,
|
||||
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), 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);
|
||||
if (n_items > 0)
|
||||
g_list_model_items_changed (G_LIST_MODEL (self), pos, n_items, n_items);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -973,8 +949,7 @@ gtk_sort_list_model_clear_real_sorter (GtkSortListModel *self)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_sort_list_model_ensure_real_sorter (GtkSortListModel *self,
|
||||
gboolean sections_changed)
|
||||
gtk_sort_list_model_ensure_real_sorter (GtkSortListModel *self)
|
||||
{
|
||||
if (self->sorter)
|
||||
{
|
||||
@@ -999,7 +974,7 @@ gtk_sort_list_model_ensure_real_sorter (GtkSortListModel *self,
|
||||
if (self->real_sorter)
|
||||
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
|
||||
@@ -1220,8 +1195,12 @@ gtk_sort_list_model_set_sorter (GtkSortListModel *self,
|
||||
return;
|
||||
|
||||
gtk_sort_list_model_clear_real_sorter (self);
|
||||
g_set_object (&self->sorter, sorter);
|
||||
gtk_sort_list_model_ensure_real_sorter (self, FALSE);
|
||||
g_clear_object (&self->sorter);
|
||||
|
||||
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]);
|
||||
}
|
||||
@@ -1262,8 +1241,12 @@ gtk_sort_list_model_set_section_sorter (GtkSortListModel *self,
|
||||
return;
|
||||
|
||||
gtk_sort_list_model_clear_real_sorter (self);
|
||||
g_set_object (&self->section_sorter, sorter);
|
||||
gtk_sort_list_model_ensure_real_sorter (self, TRUE);
|
||||
g_clear_object (&self->section_sorter);
|
||||
|
||||
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]);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user