Compare commits
118 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 805f3bb123 | |||
| 0fcf01ddd5 | |||
| 1119a74ff0 | |||
| 18ea60e235 | |||
| d752828977 | |||
| 1034271d9a | |||
| f013d3b5d6 | |||
| 5f41d26abc | |||
| 7d5826ccf7 | |||
| daded2bc86 | |||
| bc7619abaf | |||
| 459d6e1349 | |||
| 6e108d310a | |||
| 9c84fa127a | |||
| 84c6708366 | |||
| f7e3016949 | |||
| dd1110ca5c | |||
| 28c4adac24 | |||
| cf20cfd31e | |||
| 7e579bb59a | |||
| 96e1b85c2c | |||
| 71e616d17e | |||
| f85d939e5e | |||
| 8d014d6cb0 | |||
| f7f8990f7a | |||
| d6f288427a | |||
| 2a8f371643 | |||
| dee863dbb2 | |||
| 7d6877ec80 | |||
| f426d23690 | |||
| 6bd0dc3e78 | |||
| 4f0c920a8e | |||
| b0b793dd94 | |||
| efbb649eee | |||
| e128a77eed | |||
| 5cd2ee927a | |||
| 90dfb5e138 | |||
| e854b90293 | |||
| 6d042d9e61 | |||
| 4310f24a4e | |||
| aebf8e3c29 | |||
| fcd449f0d4 | |||
| ab1b117d91 | |||
| 1253296387 | |||
| 466484176f | |||
| 20289ad8e1 | |||
| 0abb8c6862 | |||
| 147386189f | |||
| 9cec9e4ce2 | |||
| 26119af7a6 | |||
| 478d1f71e3 | |||
| b1d952b8a2 | |||
| b9bcdbbfdc | |||
| 6c31ed53f4 | |||
| aa95ae774f | |||
| 65adfd9243 | |||
| c4a8c0893b | |||
| e90f5e8a20 | |||
| 526c76181e | |||
| cf352374ae | |||
| 98b99201b0 | |||
| bce4d669ee | |||
| e7a326e230 | |||
| 9eaeaa8452 | |||
| 2031c5bf90 | |||
| 9fefa7b44c | |||
| a2a70c3b65 | |||
| 0b4ed8d791 | |||
| c34f98931e | |||
| 2feac2772f | |||
| fdda4e4e99 | |||
| e1cf0cff26 | |||
| 634fa772c9 | |||
| 4b3bbe0ecd | |||
| cde43541d0 | |||
| 186287ecfb | |||
| bd5d1615ac | |||
| 21299cc7e4 | |||
| e747ea7dfd | |||
| 810cd7881e | |||
| a8213d7f45 | |||
| e6f6d1e478 | |||
| 933d241bba | |||
| 7249c3a09b | |||
| d13f8ac3a9 | |||
| fa35e3b874 | |||
| 853883c6e5 | |||
| b467279c7d | |||
| c6a5ac1d16 | |||
| e41288de4f | |||
| b886988a54 | |||
| bb8a459fe2 | |||
| d5143a1bf0 | |||
| 12611fa142 | |||
| 3e319b409b | |||
| f2b16836c2 | |||
| 14bf45a0d5 | |||
| 0c6a6b3370 | |||
| 9521f609d8 | |||
| 7533369695 | |||
| f31765d5dd | |||
| d33062795c | |||
| 2da8d9b0ac | |||
| 3f56e8191f | |||
| bf4c3dc2c5 | |||
| a5365ec8cb | |||
| ec94ec0286 | |||
| af0973c847 | |||
| e71f6b0bc0 | |||
| 1738724e4a | |||
| e9e09be37e | |||
| 8a923e02a1 | |||
| 4f12e2f711 | |||
| addcf57b4d | |||
| 7eece7e769 | |||
| 7f6608cbed | |||
| f816a8fb82 | |||
| 3c2484142d |
@@ -17,7 +17,7 @@ license fees or royalties.
|
||||
|
||||
The official download location
|
||||
|
||||
- https://download.gnome.org/sources/gtk+
|
||||
- https://download.gnome.org/sources/gtk/
|
||||
|
||||
The official web site
|
||||
|
||||
@@ -49,11 +49,11 @@ In order to build GTK you will need:
|
||||
You will also need various dependencies, based on the platform you are
|
||||
building for:
|
||||
|
||||
- [GLib](https://download.gnome.org/sources/glib)
|
||||
- [GdkPixbuf](https://download.gnome.org/sources/gdk-pixbuf)
|
||||
- [GObject-Introspection](https://download.gnome.org/sources/gobject-introspection)
|
||||
- [Cairo](https://www.cairographics.org)
|
||||
- [Pango](https://download.gnome.org/sources/pango)
|
||||
- [GLib](https://download.gnome.org/sources/glib/)
|
||||
- [GdkPixbuf](https://download.gnome.org/sources/gdk-pixbuf/)
|
||||
- [GObject-Introspection](https://download.gnome.org/sources/gobject-introspection/)
|
||||
- [Cairo](https://www.cairographics.org/)
|
||||
- [Pango](https://download.gnome.org/sources/pango/)
|
||||
- [Epoxy](https://github.com/anholt/libepoxy)
|
||||
- [Graphene](https://github.com/ebassi/graphene)
|
||||
- [Xkb-common](https://github.com/xkbcommon/libxkbcommon)
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
if 'DESTDIR' not in os.environ:
|
||||
gtk_api_version = sys.argv[1]
|
||||
gtk_abi_version = sys.argv[2]
|
||||
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
if 'DESTDIR' not in os.environ:
|
||||
gtk_api_version = sys.argv[1]
|
||||
gtk_abi_version = sys.argv[2]
|
||||
gtk_libdir = sys.argv[3]
|
||||
gtk_datadir = sys.argv[4]
|
||||
|
||||
gtk_moduledir = os.path.join(gtk_libdir, 'gtk-' + gtk_api_version, gtk_abi_version)
|
||||
gtk_printmodule_dir = os.path.join(gtk_moduledir, 'printbackends')
|
||||
gtk_immodule_dir = os.path.join(gtk_moduledir, 'immodules')
|
||||
|
||||
print('Compiling GSettings schemas...')
|
||||
gtk_bindir = sys.argv[5]
|
||||
|
||||
gtk_moduledir = os.path.join(gtk_libdir, 'gtk-' + gtk_api_version, gtk_abi_version)
|
||||
gtk_printmodule_dir = os.path.join(gtk_moduledir, 'printbackends')
|
||||
gtk_immodule_dir = os.path.join(gtk_moduledir, 'immodules')
|
||||
|
||||
print('Compiling GSettings schemas...')
|
||||
glib_compile_schemas = subprocess.check_output(['pkg-config',
|
||||
'--variable=glib_compile_schemas',
|
||||
'gio-2.0']).strip()
|
||||
@@ -22,13 +23,14 @@ if 'DESTDIR' not in os.environ:
|
||||
# pkg-config variables only available since GLib 2.62.0.
|
||||
glib_compile_schemas = 'glib-compile-schemas'
|
||||
subprocess.call([glib_compile_schemas,
|
||||
os.path.join(gtk_datadir, 'glib-2.0', 'schemas')])
|
||||
|
||||
print('Updating icon cache...')
|
||||
subprocess.call(['gtk4-update-icon-cache', '-q', '-t' ,'-f',
|
||||
os.path.join(gtk_datadir, 'icons', 'hicolor')])
|
||||
|
||||
print('Updating module cache for print backends...')
|
||||
os.path.join(gtk_datadir, 'glib-2.0', 'schemas')])
|
||||
|
||||
print('Updating icon cache...')
|
||||
update_icon_cache = os.path.join(gtk_bindir, 'gtk4-update-icon-cache')
|
||||
subprocess.call([update_icon_cache, '-q', '-t' ,'-f',
|
||||
os.path.join(gtk_datadir, 'icons', 'hicolor')])
|
||||
|
||||
print('Updating module cache for print backends...')
|
||||
os.makedirs(gtk_printmodule_dir, exist_ok=True)
|
||||
gio_querymodules = subprocess.check_output(['pkg-config',
|
||||
'--variable=gio_querymodules',
|
||||
@@ -37,7 +39,7 @@ if 'DESTDIR' not in os.environ:
|
||||
# pkg-config variables only available since GLib 2.62.0.
|
||||
gio_querymodules = 'gio-querymodules'
|
||||
subprocess.call([gio_querymodules, gtk_printmodule_dir])
|
||||
|
||||
print('Updating module cache for input methods...')
|
||||
|
||||
print('Updating module cache for input methods...')
|
||||
os.makedirs(gtk_immodule_dir, exist_ok=True)
|
||||
subprocess.call([gio_querymodules, gtk_immodule_dir])
|
||||
|
||||
@@ -20,7 +20,7 @@ mainImage(out vec4 fragColor, in vec2 fragCoord, in vec2 resolution, in vec2 uv)
|
||||
float b = 1.0/distance (pos, p2);
|
||||
float sum = r + g + b;
|
||||
|
||||
float alpha = 1.0 - pow (1.0/(sum), 40)*pow (10.0, 40*0.7);
|
||||
float alpha = 1.0 - pow (1.0/(sum), 40.0)*pow (10.0, 40.0*0.7);
|
||||
|
||||
fragColor = vec4 (r*0.5, g*0.5, b*0.5, 1.0) * alpha;
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ float ccell2(vec2 p, float r) {
|
||||
float df(vec2 p, float scale, inout vec2 nn) {
|
||||
p /= scale;
|
||||
nn = hextile(p);
|
||||
nn = round(nn);
|
||||
nn = floor(nn + 0.5);
|
||||
float r = hash(nn);
|
||||
|
||||
float d;;
|
||||
|
||||
@@ -179,7 +179,7 @@ float ccell2(vec2 p, float r) {
|
||||
float df(vec2 p, float scale, inout vec2 nn) {
|
||||
p /= scale;
|
||||
nn = hextile(p);
|
||||
nn = round(nn);
|
||||
nn = floor(nn + 0.5);
|
||||
float r = hash(nn);
|
||||
|
||||
float d;;
|
||||
|
||||
+20
-22
@@ -53,31 +53,30 @@
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<style>
|
||||
<class name="sidebar"/>
|
||||
</style>
|
||||
<property name="width-request">120</property>
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<property name="min-content-width">150</property>
|
||||
<object class="GtkBox">
|
||||
<property name="width-request">220</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="width-request">220</property>
|
||||
<property name="orientation">vertical</property>
|
||||
|
||||
<object class="GtkSearchBar" id="searchbar">
|
||||
<property name="key-capture-widget">window</property>
|
||||
<child>
|
||||
<object class="GtkSearchBar" id="searchbar">
|
||||
<property name="key-capture-widget">window</property>
|
||||
<child>
|
||||
<object class="GtkSearchEntry" id="search-entry">
|
||||
<accessibility>
|
||||
<relation name="controls">listview</relation>
|
||||
</accessibility>
|
||||
</object>
|
||||
</child>
|
||||
<object class="GtkSearchEntry" id="search-entry">
|
||||
<accessibility>
|
||||
<relation name="controls">listview</relation>
|
||||
</accessibility>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<style>
|
||||
<class name="sidebar"/>
|
||||
</style>
|
||||
<property name="width-request">120</property>
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<property name="min-content-width">150</property>
|
||||
<property name="vexpand">1</property>
|
||||
<child>
|
||||
<object class="GtkListView" id="listview">
|
||||
<style>
|
||||
@@ -94,7 +93,6 @@
|
||||
</accessibility>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
@@ -31,7 +31,7 @@ void mainImage(out vec4 fragColor, in vec2 fragCoord, in vec2 resolution, in vec
|
||||
float propagation_length = time * wave_speed;
|
||||
|
||||
float t = (propagation_length - distance_from_center) / wave_length;
|
||||
float offset_magnitude = 0;
|
||||
float offset_magnitude = 0.0;
|
||||
if (t > 0.0)
|
||||
offset_magnitude = decay(wave_height * sin(t * 2.0 * PI), t);
|
||||
|
||||
|
||||
@@ -98,19 +98,22 @@ gsk_render_node_write_to_file
|
||||
GskScalingFilter
|
||||
gsk_render_node_get_bounds
|
||||
|
||||
<SUBSECTION Nodes>
|
||||
<SUBSECTION>
|
||||
gsk_color_node_new
|
||||
gsk_color_node_get_color
|
||||
gsk_texture_node_new
|
||||
gsk_texture_node_get_texture
|
||||
<SUBSECTION>
|
||||
GskColorStop
|
||||
gsk_linear_gradient_node_new
|
||||
gsk_repeating_linear_gradient_node_new
|
||||
gsk_linear_gradient_node_get_start
|
||||
gsk_linear_gradient_node_get_end
|
||||
gsk_linear_gradient_node_get_n_color_stops
|
||||
gsk_linear_gradient_node_get_color_stops
|
||||
gsk_repeating_linear_gradient_node_new
|
||||
<SUBSECTION>
|
||||
gsk_radial_gradient_node_new
|
||||
gsk_repeating_radial_gradient_node_new
|
||||
gsk_radial_gradient_node_get_n_color_stops
|
||||
gsk_radial_gradient_node_get_color_stops
|
||||
gsk_radial_gradient_node_get_start
|
||||
@@ -118,16 +121,18 @@ gsk_radial_gradient_node_get_end
|
||||
gsk_radial_gradient_node_get_hradius
|
||||
gsk_radial_gradient_node_get_vradius
|
||||
gsk_radial_gradient_node_get_center
|
||||
gsk_repeating_radial_gradient_node_new
|
||||
<SUBSECTION>
|
||||
gsk_conic_gradient_node_new
|
||||
gsk_conic_gradient_node_get_n_color_stops
|
||||
gsk_conic_gradient_node_get_color_stops
|
||||
gsk_conic_gradient_node_get_center
|
||||
gsk_conic_gradient_node_get_rotation
|
||||
<SUBSECTION>
|
||||
gsk_border_node_new
|
||||
gsk_border_node_get_outline
|
||||
gsk_border_node_get_widths
|
||||
gsk_border_node_get_colors
|
||||
<SUBSECTION>
|
||||
gsk_inset_shadow_node_new
|
||||
gsk_inset_shadow_node_get_outline
|
||||
gsk_inset_shadow_node_get_color
|
||||
@@ -135,6 +140,7 @@ gsk_inset_shadow_node_get_dx
|
||||
gsk_inset_shadow_node_get_dy
|
||||
gsk_inset_shadow_node_get_spread
|
||||
gsk_inset_shadow_node_get_blur_radius
|
||||
<SUBSECTION>
|
||||
gsk_outset_shadow_node_new
|
||||
gsk_outset_shadow_node_get_outline
|
||||
gsk_outset_shadow_node_get_color
|
||||
@@ -142,45 +148,57 @@ gsk_outset_shadow_node_get_dx
|
||||
gsk_outset_shadow_node_get_dy
|
||||
gsk_outset_shadow_node_get_spread
|
||||
gsk_outset_shadow_node_get_blur_radius
|
||||
<SUBSECTION>
|
||||
gsk_cairo_node_new
|
||||
gsk_cairo_node_get_draw_context
|
||||
gsk_cairo_node_get_surface
|
||||
<SUBSECTION>
|
||||
gsk_container_node_new
|
||||
gsk_container_node_get_n_children
|
||||
gsk_container_node_get_child
|
||||
<SUBSECTION>
|
||||
gsk_transform_node_new
|
||||
gsk_transform_node_get_child
|
||||
gsk_transform_node_get_transform
|
||||
<SUBSECTION>
|
||||
gsk_opacity_node_new
|
||||
gsk_opacity_node_get_child
|
||||
gsk_opacity_node_get_opacity
|
||||
<SUBSECTION>
|
||||
gsk_color_matrix_node_new
|
||||
gsk_color_matrix_node_get_child
|
||||
gsk_color_matrix_node_get_color_matrix
|
||||
gsk_color_matrix_node_get_color_offset
|
||||
<SUBSECTION>
|
||||
gsk_repeat_node_new
|
||||
gsk_repeat_node_get_child
|
||||
gsk_repeat_node_get_child_bounds
|
||||
<SUBSECTION>
|
||||
gsk_clip_node_new
|
||||
gsk_clip_node_get_child
|
||||
gsk_clip_node_get_clip
|
||||
<SUBSECTION>
|
||||
gsk_rounded_clip_node_new
|
||||
gsk_rounded_clip_node_get_child
|
||||
gsk_rounded_clip_node_get_clip
|
||||
<SUBSECTION>
|
||||
GskShadow
|
||||
gsk_shadow_node_new
|
||||
gsk_shadow_node_get_shadow
|
||||
gsk_shadow_node_get_n_shadows
|
||||
gsk_shadow_node_get_child
|
||||
<SUBSECTION>
|
||||
GskBlendMode
|
||||
gsk_blend_node_new
|
||||
gsk_blend_node_get_bottom_child
|
||||
gsk_blend_node_get_top_child
|
||||
gsk_blend_node_get_blend_mode
|
||||
<SUBSECTION>
|
||||
gsk_cross_fade_node_new
|
||||
gsk_cross_fade_node_get_start_child
|
||||
gsk_cross_fade_node_get_end_child
|
||||
gsk_cross_fade_node_get_progress
|
||||
<SUBSECTION>
|
||||
gsk_text_node_new
|
||||
gsk_text_node_get_font
|
||||
gsk_text_node_get_glyphs
|
||||
@@ -188,12 +206,15 @@ gsk_text_node_get_color
|
||||
gsk_text_node_has_color_glyphs
|
||||
gsk_text_node_get_num_glyphs
|
||||
gsk_text_node_get_offset
|
||||
<SUBSECTION>
|
||||
gsk_blur_node_new
|
||||
gsk_blur_node_get_child
|
||||
gsk_blur_node_get_radius
|
||||
<SUBSECTION>
|
||||
gsk_debug_node_new
|
||||
gsk_debug_node_get_child
|
||||
gsk_debug_node_get_message
|
||||
<SUBSECTION>
|
||||
gsk_gl_shader_node_new
|
||||
gsk_gl_shader_node_get_n_children
|
||||
gsk_gl_shader_node_get_child
|
||||
|
||||
@@ -19,8 +19,8 @@ gtk_assistant_page_get_type
|
||||
gtk_at_context_get_type
|
||||
gtk_bin_layout_get_type
|
||||
gtk_bitset_get_type
|
||||
gtk_expression_get_type
|
||||
gtk_bookmark_list_get_type
|
||||
gtk_bool_filter_get_type
|
||||
gtk_box_get_type
|
||||
gtk_box_layout_get_type
|
||||
gtk_buildable_get_type
|
||||
@@ -46,6 +46,7 @@ gtk_cell_renderer_spinner_get_type
|
||||
gtk_cell_renderer_text_get_type
|
||||
gtk_cell_renderer_toggle_get_type
|
||||
gtk_cell_view_get_type
|
||||
gtk_center_box_get_type
|
||||
gtk_center_layout_get_type
|
||||
gtk_check_button_get_type
|
||||
gtk_closure_expression_get_type
|
||||
@@ -65,14 +66,16 @@ gtk_constraint_target_get_type
|
||||
gtk_css_provider_get_type
|
||||
gtk_custom_filter_get_type
|
||||
gtk_custom_sorter_get_type
|
||||
gtk_custom_layout_get_type
|
||||
gtk_dialog_get_type
|
||||
gtk_directory_list_get_type
|
||||
gtk_drag_icon_get_type
|
||||
gtk_drag_source_get_type
|
||||
gtk_drawing_area_get_type
|
||||
gtk_drop_target_get_type
|
||||
gtk_drop_target_async_get_type
|
||||
gtk_drop_controller_motion_get_type
|
||||
gtk_drop_down_get_type
|
||||
gtk_drop_target_async_get_type
|
||||
gtk_drop_target_get_type
|
||||
gtk_editable_get_type
|
||||
gtk_editable_label_get_type
|
||||
gtk_emoji_chooser_get_type
|
||||
@@ -87,6 +90,7 @@ gtk_event_controller_motion_get_type
|
||||
gtk_event_controller_scroll_get_type
|
||||
gtk_every_filter_get_type
|
||||
gtk_expander_get_type
|
||||
gtk_expression_get_type
|
||||
gtk_file_chooser_dialog_get_type
|
||||
gtk_file_chooser_get_type
|
||||
gtk_file_chooser_native_get_type
|
||||
@@ -250,6 +254,7 @@ gtk_video_get_type
|
||||
gtk_viewport_get_type
|
||||
gtk_volume_button_get_type
|
||||
gtk_widget_get_type
|
||||
gtk_widget_paintable_get_type
|
||||
gtk_window_get_type
|
||||
gtk_window_controls_get_type
|
||||
gtk_window_group_get_type
|
||||
|
||||
@@ -119,21 +119,18 @@ around or to activate a widget that does not currently have the focus.
|
||||
|
||||
GTK has traditionally supported different kinds of shortcuts:
|
||||
|
||||
Accelerators
|
||||
: Accelerators are any other shortcuts that can be activated regardless
|
||||
of where the focus is, and typically trigger global actions, such as
|
||||
Ctrl-Q to quit an application.
|
||||
Mnmemonics
|
||||
: 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
|
||||
: 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.
|
||||
|
||||
- Accelerators are any other shortcuts that can be activated regardless
|
||||
of where the focus is, and typically trigger global actions, such as
|
||||
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 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.
|
||||
|
||||
|
||||
@@ -1062,7 +1062,7 @@ to start a drag manually, call gdk_drag_begin().
|
||||
The ::drag-data-get signal has been replaced by the #GtkDragSource::prepare
|
||||
signal, which returns a #GdkContentProvider for the drag operation.
|
||||
|
||||
The destination-side Drag-and-Drop apis in GTK 4 have also been changed
|
||||
The destination-side Drag-and-Drop API in GTK 4 have also been changed
|
||||
to use an event controller, #GtkDropTarget. Instead of calling
|
||||
gtk_drag_dest_set() and connecting to #GtkWidget signals, you create
|
||||
a #GtkDropTarget object, attach it to the widget with
|
||||
|
||||
@@ -97,11 +97,11 @@ the question you have, this list is a good place to start.
|
||||
#define N_(x) x
|
||||
#define C_(ctx,x) pgettext (ctx, x)
|
||||
|
||||
You use N_() (N stands for no-op) to mark a string for translation in
|
||||
You use `N_()` (N stands for no-op) to mark a string for translation in
|
||||
a location where a function call to gettext() is not allowed, such as
|
||||
in an array initializer. You eventually have to call gettext() on the
|
||||
string to actually fetch the translation. _() both marks the string for
|
||||
translation and actually translates it. The C_() macro (C stands for
|
||||
string to actually fetch the translation. `_()` both marks the string for
|
||||
translation and actually translates it. The `C_()` macro (C stands for
|
||||
context) adds an additional context to the string that is marked for
|
||||
translation, which can help to disambiguate short strings that might
|
||||
need different translations in different parts of your program.
|
||||
@@ -190,7 +190,7 @@ the question you have, this list is a good place to start.
|
||||
encode string literals in UTF-8 by using octal or hexadecimal escapes
|
||||
like `\212` or `\xa8` to encode each byte. This is portable, but
|
||||
modifying the escaped strings is not very convenient. Be careful when
|
||||
mixing hexadecimal escapes with ordinary text; `"\xa8abcd" is a string
|
||||
mixing hexadecimal escapes with ordinary text; `"\xa8abcd"` is a string
|
||||
of length 1 !
|
||||
|
||||
- Runtime conversion
|
||||
|
||||
+7
-4
@@ -182,6 +182,7 @@ G_GNUC_UNUSED static inline void
|
||||
gdk_array(splice) (GdkArray *self,
|
||||
gsize pos,
|
||||
gsize removed,
|
||||
gboolean stolen,
|
||||
_T_ *additions,
|
||||
gsize added)
|
||||
{
|
||||
@@ -192,8 +193,9 @@ gdk_array(splice) (GdkArray *self,
|
||||
g_assert (pos + removed <= size);
|
||||
remaining = size - pos - removed;
|
||||
|
||||
gdk_array(free_elements) (gdk_array(index) (self, pos),
|
||||
gdk_array(index) (self, pos + removed));
|
||||
if (!stolen)
|
||||
gdk_array(free_elements) (gdk_array(index) (self, pos),
|
||||
gdk_array(index) (self, pos + removed));
|
||||
|
||||
gdk_array(reserve) (self, size - removed + added);
|
||||
|
||||
@@ -225,9 +227,9 @@ gdk_array(set_size) (GdkArray *self,
|
||||
{
|
||||
gsize old_size = gdk_array(get_size) (self);
|
||||
if (new_size > old_size)
|
||||
gdk_array(splice) (self, old_size, 0, NULL, new_size - old_size);
|
||||
gdk_array(splice) (self, old_size, 0, FALSE, NULL, new_size - old_size);
|
||||
else
|
||||
gdk_array(splice) (self, new_size, old_size - new_size, NULL, 0);
|
||||
gdk_array(splice) (self, new_size, old_size - new_size, FALSE, NULL, 0);
|
||||
}
|
||||
|
||||
G_GNUC_UNUSED static void
|
||||
@@ -241,6 +243,7 @@ gdk_array(append) (GdkArray *self,
|
||||
gdk_array(splice) (self,
|
||||
gdk_array(get_size) (self),
|
||||
0,
|
||||
FALSE,
|
||||
#ifdef GDK_ARRAY_BY_VALUE
|
||||
value,
|
||||
#else
|
||||
|
||||
@@ -1138,6 +1138,22 @@ gdk_event_get_axes (GdkEvent *event,
|
||||
return GDK_EVENT_GET_CLASS (event)->get_axes (event, axes, n_axes);
|
||||
}
|
||||
|
||||
double *
|
||||
gdk_event_dup_axes (GdkEvent *event)
|
||||
{
|
||||
double *axes;
|
||||
guint n_axes;
|
||||
|
||||
if (gdk_event_get_axes (event, &axes, &n_axes))
|
||||
{
|
||||
double *axes_copy = g_memdup (axes, n_axes * sizeof (double));
|
||||
|
||||
return axes_copy;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_event_get_event_type:
|
||||
* @event: a #GdkEvent
|
||||
|
||||
@@ -603,6 +603,8 @@ void _gdk_event_queue_handle_motion_compression (GdkDisplay *display);
|
||||
void gdk_event_queue_handle_scroll_compression (GdkDisplay *display);
|
||||
void _gdk_event_queue_flush (GdkDisplay *display);
|
||||
|
||||
double * gdk_event_dup_axes (GdkEvent *event);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
+6
-140
@@ -95,141 +95,7 @@ G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GdkVulkanContext, gdk_vulkan_context, GDK_TYPE
|
||||
const char *
|
||||
gdk_vulkan_strerror (VkResult result)
|
||||
{
|
||||
/* If your compiler brought you here with a warning about missing
|
||||
* enumeration values, you're running a newer Vulkan version than
|
||||
* the GTK developers (or you are a GTK developer) and have
|
||||
* encountered a newly added Vulkan error message.
|
||||
* You want to add it to this enum now.
|
||||
*
|
||||
* Because the Vulkan people don't make adding this too easy, here's
|
||||
* the process to manage it:
|
||||
* 1. go to
|
||||
* https://github.com/KhronosGroup/Vulkan-Headers/blob/master/include/vulkan/vulkan_core.h
|
||||
* 2. Find the line where this enum value was added.
|
||||
* 3. Click the commit that added this line.
|
||||
* 4. The commit you're looking at now should also change
|
||||
* VK_HEADER_VERSION, find that number.
|
||||
* 5. Use that number in the #ifdef when adding the enum value to
|
||||
* this enum.
|
||||
* 6. For the error message, look at the specification (the one
|
||||
* that includes all extensions) at
|
||||
* https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VkResult
|
||||
* 7. If this value has not been added to the specification yet,
|
||||
* search for the error message in the text of specification.
|
||||
* Often it will have a description that can be used as an error
|
||||
* message.
|
||||
* 8. If that didn't lead to one (or you are lazy), just use the
|
||||
* literal string of the enum value as the error message. A
|
||||
* GTK developer will add the correct one once it's added to the
|
||||
* specification.
|
||||
*/
|
||||
switch (result)
|
||||
{
|
||||
case VK_SUCCESS:
|
||||
return "Command successfully completed.";
|
||||
case VK_NOT_READY:
|
||||
return "A fence or query has not yet completed.";
|
||||
case VK_TIMEOUT:
|
||||
return "A wait operation has not completed in the specified time.";
|
||||
case VK_EVENT_SET:
|
||||
return "An event is signaled.";
|
||||
case VK_EVENT_RESET:
|
||||
return "An event is unsignaled.";
|
||||
case VK_INCOMPLETE:
|
||||
return "A return array was too small for the result.";
|
||||
case VK_SUBOPTIMAL_KHR:
|
||||
return "A swapchain no longer matches the surface properties exactly, but can still be used to present to the surface successfully.";
|
||||
case VK_ERROR_OUT_OF_HOST_MEMORY:
|
||||
return "A host memory allocation has failed.";
|
||||
case VK_ERROR_OUT_OF_DEVICE_MEMORY:
|
||||
return "A device memory allocation has failed.";
|
||||
case VK_ERROR_INITIALIZATION_FAILED:
|
||||
return "Initialization of an object could not be completed for implementation-specific reasons.";
|
||||
case VK_ERROR_DEVICE_LOST:
|
||||
return "The logical or physical device has been lost.";
|
||||
case VK_ERROR_MEMORY_MAP_FAILED:
|
||||
return "Mapping of a memory object has failed.";
|
||||
case VK_ERROR_LAYER_NOT_PRESENT:
|
||||
return "A requested layer is not present or could not be loaded.";
|
||||
case VK_ERROR_EXTENSION_NOT_PRESENT:
|
||||
return "A requested extension is not supported.";
|
||||
case VK_ERROR_FEATURE_NOT_PRESENT:
|
||||
return "A requested feature is not supported.";
|
||||
case VK_ERROR_INCOMPATIBLE_DRIVER:
|
||||
return "The requested version of Vulkan is not supported by the driver or is otherwise incompatible for implementation-specific reasons.";
|
||||
case VK_ERROR_TOO_MANY_OBJECTS:
|
||||
return "Too many objects of the type have already been created.";
|
||||
case VK_ERROR_FORMAT_NOT_SUPPORTED:
|
||||
return "A requested format is not supported on this device.";
|
||||
#if VK_HEADER_VERSION >= 24
|
||||
case VK_ERROR_FRAGMENTED_POOL:
|
||||
return "A requested pool allocation has failed due to fragmentation of the pool’s memory.";
|
||||
#endif
|
||||
case VK_ERROR_SURFACE_LOST_KHR:
|
||||
return "A surface is no longer available.";
|
||||
case VK_ERROR_NATIVE_WINDOW_IN_USE_KHR:
|
||||
return "The requested window is already in use by Vulkan or another API in a manner which prevents it from being used again.";
|
||||
case VK_ERROR_OUT_OF_DATE_KHR:
|
||||
return "A surface has changed in such a way that it is no longer compatible with the swapchain.";
|
||||
case VK_ERROR_INCOMPATIBLE_DISPLAY_KHR:
|
||||
return "The display used by a swapchain does not use the same presentable image layout, or is incompatible in a way that prevents sharing an image.";
|
||||
case VK_ERROR_VALIDATION_FAILED_EXT:
|
||||
return "The application caused the validation layer to fail.";
|
||||
case VK_ERROR_INVALID_SHADER_NV:
|
||||
return "One or more shaders failed to compile or link.";
|
||||
#if VK_HEADER_VERSION >= 39
|
||||
case VK_ERROR_OUT_OF_POOL_MEMORY_KHR:
|
||||
return "A pool memory allocation has failed.";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION >= 54
|
||||
case VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR:
|
||||
return "An external handle is not a valid handle of the specified type.";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION >= 64
|
||||
case VK_ERROR_NOT_PERMITTED_EXT:
|
||||
return "The caller does not have sufficient privileges.";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION >= 72
|
||||
case VK_ERROR_FRAGMENTATION_EXT:
|
||||
return "A descriptor pool creation has failed due to fragmentation";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION >= 89
|
||||
case VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT:
|
||||
return "Invalid DRM format modifier plane layout";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION >= 97
|
||||
case VK_ERROR_INVALID_DEVICE_ADDRESS_EXT:
|
||||
return "Invalid device address";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION >= 105
|
||||
case VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT:
|
||||
return "An operation on a swapchain created with VK_FULL_SCREEN_EXCLUSIVE_APPLICATION_CONTROLLED_EXT failed as it did not have exclusive full-screen access.";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION >= 131
|
||||
case VK_ERROR_UNKNOWN:
|
||||
return "An unknown error has occurred; either the application has provided invalid input, or an implementation failure has occurred.";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION >= 135
|
||||
case VK_ERROR_INCOMPATIBLE_VERSION_KHR:
|
||||
return "Acceleration structure serialized with version as the version information is not compatible with device.";
|
||||
case VK_THREAD_IDLE_KHR:
|
||||
return "A deferred operation is not complete but there is currently no work for this thread to do at the time of this call.";
|
||||
case VK_THREAD_DONE_KHR:
|
||||
return "A deferred operation is not complete but there is no work remaining to assign to additional threads.";
|
||||
case VK_OPERATION_DEFERRED_KHR:
|
||||
return "A deferred operation was requested and at least some of the work was deferred.";
|
||||
case VK_OPERATION_NOT_DEFERRED_KHR:
|
||||
return "A deferred operation was requested and no operations were deferred.";
|
||||
case VK_ERROR_PIPELINE_COMPILE_REQUIRED_EXT:
|
||||
return "A requested pipeline creation would have required compilation, but the application requested compilation to not be performed.";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION < 140
|
||||
case VK_RESULT_RANGE_SIZE:
|
||||
#endif
|
||||
case VK_RESULT_MAX_ENUM:
|
||||
default:
|
||||
return "Unknown Vulkan error.";
|
||||
}
|
||||
return "Unknown Vulkan error.";
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -304,7 +170,7 @@ gdk_vulkan_context_check_swapchain (GdkVulkanContext *context,
|
||||
if (res != VK_SUCCESS)
|
||||
{
|
||||
g_set_error (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_NOT_AVAILABLE,
|
||||
"Could not query surface capabilities: %s", gdk_vulkan_strerror (res));
|
||||
"Could not query surface capabilities: %d", res);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -401,7 +267,7 @@ gdk_vulkan_context_check_swapchain (GdkVulkanContext *context,
|
||||
else
|
||||
{
|
||||
g_set_error (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_NOT_AVAILABLE,
|
||||
"Could not create swapchain for this surface: %s", gdk_vulkan_strerror (res));
|
||||
"Could not create swapchain for this surface: %d", res);
|
||||
priv->swapchain = VK_NULL_HANDLE;
|
||||
return FALSE;
|
||||
}
|
||||
@@ -577,7 +443,7 @@ gdk_vulkan_context_real_init (GInitable *initable,
|
||||
if (res != VK_SUCCESS)
|
||||
{
|
||||
g_set_error (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_NOT_AVAILABLE,
|
||||
"Could not create surface for this surface: %s", gdk_vulkan_strerror (res));
|
||||
"Could not create surface for this surface: %d", res);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -588,7 +454,7 @@ gdk_vulkan_context_real_init (GInitable *initable,
|
||||
if (res != VK_SUCCESS)
|
||||
{
|
||||
g_set_error (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_NOT_AVAILABLE,
|
||||
"Could not check if queue family supports this surface: %s", gdk_vulkan_strerror (res));
|
||||
"Could not check if queue family supports this surface: %d", res);
|
||||
}
|
||||
else if (!supported)
|
||||
{
|
||||
@@ -1116,7 +982,7 @@ gdk_display_create_vulkan_instance (GdkDisplay *display,
|
||||
if (res != VK_SUCCESS)
|
||||
{
|
||||
g_set_error (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_UNSUPPORTED,
|
||||
"Could not create a Vulkan instance: %s", gdk_vulkan_strerror (res));
|
||||
"Could not create a Vulkan instance: %d", res);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
+24
-25
@@ -1824,6 +1824,7 @@ blur_texture (GskGLRenderer *self,
|
||||
float blur_radius_x,
|
||||
float blur_radius_y)
|
||||
{
|
||||
const GskRoundedRect new_clip = GSK_ROUNDED_RECT_INIT (0, 0, texture_to_blur_width, texture_to_blur_height);
|
||||
int pass1_texture_id, pass1_render_target;
|
||||
int pass2_texture_id, pass2_render_target;
|
||||
int prev_render_target;
|
||||
@@ -1850,17 +1851,16 @@ blur_texture (GskGLRenderer *self,
|
||||
GL_NEAREST, GL_NEAREST,
|
||||
&pass2_texture_id, &pass2_render_target);
|
||||
|
||||
init_projection_matrix (&item_proj,
|
||||
&GRAPHENE_RECT_INIT (0, 0, texture_to_blur_width, texture_to_blur_height));
|
||||
init_projection_matrix (&item_proj, &new_clip.bounds);
|
||||
|
||||
ops_set_program (builder, &self->programs->blur_program);
|
||||
prev_projection = ops_set_projection (builder, &item_proj);
|
||||
ops_set_modelview (builder, NULL);
|
||||
prev_viewport = ops_set_viewport (builder, &GRAPHENE_RECT_INIT (0, 0, texture_to_blur_width, texture_to_blur_height));
|
||||
ops_push_clip (builder, &GSK_ROUNDED_RECT_INIT (0, 0, texture_to_blur_width, texture_to_blur_height));
|
||||
prev_viewport = ops_set_viewport (builder, &new_clip.bounds);
|
||||
ops_push_clip (builder, &new_clip);
|
||||
|
||||
prev_render_target = ops_set_render_target (builder, pass1_render_target);
|
||||
ops_begin (builder, OP_CLEAR);
|
||||
ops_set_program (builder, &self->programs->blur_program);
|
||||
|
||||
op = ops_begin (builder, OP_CHANGE_BLUR);
|
||||
op->size.width = texture_to_blur_width;
|
||||
@@ -1871,7 +1871,7 @@ blur_texture (GskGLRenderer *self,
|
||||
ops_set_texture (builder, region->texture_id);
|
||||
|
||||
load_vertex_data_with_region (ops_draw (builder, NULL),
|
||||
&GRAPHENE_RECT_INIT (0, 0, texture_to_blur_width, texture_to_blur_height),
|
||||
&new_clip.bounds,
|
||||
builder, region,
|
||||
FALSE);
|
||||
#if 0
|
||||
@@ -1893,7 +1893,7 @@ blur_texture (GskGLRenderer *self,
|
||||
ops_set_render_target (builder, pass2_render_target);
|
||||
ops_begin (builder, OP_CLEAR);
|
||||
load_vertex_data_with_region (ops_draw (builder, NULL), /* render pass 2 */
|
||||
&GRAPHENE_RECT_INIT (0, 0, texture_to_blur_width, texture_to_blur_height),
|
||||
&new_clip.bounds,
|
||||
builder, region,
|
||||
FALSE);
|
||||
|
||||
@@ -2940,10 +2940,15 @@ static inline void
|
||||
apply_color_matrix_op (const Program *program,
|
||||
const OpColorMatrix *op)
|
||||
{
|
||||
float mat[16];
|
||||
OP_PRINT (" -> Color Matrix");
|
||||
graphene_matrix_to_float (op->matrix, mat);
|
||||
glUniformMatrix4fv (program->color_matrix.color_matrix_location, 1, GL_FALSE, mat);
|
||||
OP_PRINT (" -> Color matrix. Send matrix: %d. Send offset: %d.",
|
||||
op->matrix.send, op->offset.send);
|
||||
|
||||
if (op->matrix.send)
|
||||
{
|
||||
float mat[16];
|
||||
graphene_matrix_to_float (op->matrix.value, mat);
|
||||
glUniformMatrix4fv (program->color_matrix.color_matrix_location, 1, GL_FALSE, mat);
|
||||
}
|
||||
|
||||
if (op->offset.send)
|
||||
{
|
||||
@@ -3199,6 +3204,7 @@ static inline void
|
||||
apply_repeat_op (const Program *program,
|
||||
const OpRepeat *op)
|
||||
{
|
||||
OP_PRINT (" -> Repeat");
|
||||
glUniform4fv (program->repeat.child_bounds_location, 1, op->child_bounds);
|
||||
glUniform4fv (program->repeat.texture_rect_location, 1, op->texture_rect);
|
||||
}
|
||||
@@ -3839,6 +3845,7 @@ add_offscreen_ops (GskGLRenderer *self,
|
||||
int filter;
|
||||
GskTextureKey key;
|
||||
int cached_id;
|
||||
graphene_rect_t viewport;
|
||||
|
||||
if (node_is_invisible (child_node))
|
||||
{
|
||||
@@ -3924,27 +3931,19 @@ add_offscreen_ops (GskGLRenderer *self,
|
||||
render_target);
|
||||
}
|
||||
|
||||
init_projection_matrix (&item_proj,
|
||||
&GRAPHENE_RECT_INIT (
|
||||
bounds->origin.x * scale_x,
|
||||
bounds->origin.y * scale_y,
|
||||
width, height
|
||||
));
|
||||
viewport = GRAPHENE_RECT_INIT (bounds->origin.x * scale_x,
|
||||
bounds->origin.y * scale_y,
|
||||
width, height);
|
||||
|
||||
init_projection_matrix (&item_proj, &viewport);
|
||||
prev_render_target = ops_set_render_target (builder, render_target);
|
||||
/* Clear since we use this rendertarget for the first time */
|
||||
ops_begin (builder, OP_CLEAR);
|
||||
prev_projection = ops_set_projection (builder, &item_proj);
|
||||
ops_set_modelview (builder, gsk_transform_scale (NULL, scale_x, scale_y));
|
||||
prev_viewport = ops_set_viewport (builder,
|
||||
&GRAPHENE_RECT_INIT (bounds->origin.x * scale_x,
|
||||
bounds->origin.y * scale_y,
|
||||
width, height));
|
||||
prev_viewport = ops_set_viewport (builder, &viewport);
|
||||
if (flags & RESET_CLIP)
|
||||
ops_push_clip (builder,
|
||||
&GSK_ROUNDED_RECT_INIT (bounds->origin.x * scale_x,
|
||||
bounds->origin.y * scale_y,
|
||||
width, height));
|
||||
ops_push_clip (builder, &GSK_ROUNDED_RECT_INIT_FROM_RECT (viewport));
|
||||
|
||||
builder->dx = 0;
|
||||
builder->dy = 0;
|
||||
|
||||
+75
-157
@@ -14,27 +14,28 @@ rect_equal (const graphene_rect_t *a,
|
||||
return memcmp (a, b, sizeof (graphene_rect_t)) == 0;
|
||||
}
|
||||
|
||||
static inline gboolean G_GNUC_PURE
|
||||
static inline bool G_GNUC_PURE
|
||||
rounded_rect_equal (const GskRoundedRect *r1,
|
||||
const GskRoundedRect *r2)
|
||||
{
|
||||
int i;
|
||||
if (r1 == r2)
|
||||
return true;
|
||||
|
||||
if (!r1)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
if (r1->bounds.origin.x != r2->bounds.origin.x ||
|
||||
r1->bounds.origin.y != r2->bounds.origin.y ||
|
||||
r1->bounds.size.width != r2->bounds.size.width ||
|
||||
r1->bounds.size.height != r2->bounds.size.height)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
for (i = 0; i < 4; i ++)
|
||||
for (int i = 0; i < 4; i ++)
|
||||
if (r1->corner[i].width != r2->corner[i].width ||
|
||||
r1->corner[i].height != r2->corner[i].height)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline gboolean G_GNUC_PURE
|
||||
@@ -208,10 +209,9 @@ ops_free (RenderOpBuilder *builder)
|
||||
|
||||
void
|
||||
ops_set_program (RenderOpBuilder *builder,
|
||||
Program *program)
|
||||
Program *program)
|
||||
{
|
||||
OpProgram *op;
|
||||
ProgramState *program_state = NULL;
|
||||
|
||||
if (builder->current_program == program)
|
||||
return;
|
||||
@@ -220,86 +220,6 @@ ops_set_program (RenderOpBuilder *builder,
|
||||
op->program = program;
|
||||
|
||||
builder->current_program = program;
|
||||
|
||||
program_state = &program->state;
|
||||
|
||||
if (memcmp (&builder->current_projection, &program_state->projection, sizeof (graphene_matrix_t)) != 0)
|
||||
{
|
||||
OpMatrix *opm;
|
||||
|
||||
opm = ops_begin (builder, OP_CHANGE_PROJECTION);
|
||||
opm->matrix = builder->current_projection;
|
||||
program_state->projection = builder->current_projection;
|
||||
}
|
||||
|
||||
if (program_state->modelview == NULL ||
|
||||
!gsk_transform_equal (builder->current_modelview, program_state->modelview))
|
||||
{
|
||||
OpMatrix *opm;
|
||||
|
||||
opm = ops_begin (builder, OP_CHANGE_MODELVIEW);
|
||||
gsk_transform_to_matrix (builder->current_modelview, &opm->matrix);
|
||||
gsk_transform_unref (program_state->modelview);
|
||||
program_state->modelview = gsk_transform_ref (builder->current_modelview);
|
||||
}
|
||||
|
||||
if (!rect_equal (&builder->current_viewport, &program_state->viewport))
|
||||
{
|
||||
OpViewport *opv;
|
||||
|
||||
opv = ops_begin (builder, OP_CHANGE_VIEWPORT);
|
||||
opv->viewport = builder->current_viewport;
|
||||
program_state->viewport = builder->current_viewport;
|
||||
}
|
||||
|
||||
if (!rounded_rect_equal (builder->current_clip, &program_state->clip))
|
||||
{
|
||||
OpClip *opc;
|
||||
|
||||
opc = ops_begin (builder, OP_CHANGE_CLIP);
|
||||
opc->clip = *builder->current_clip;
|
||||
opc->send_corners = !rounded_rect_corners_equal (builder->current_clip, &program_state->clip);
|
||||
program_state->clip = *builder->current_clip;
|
||||
}
|
||||
|
||||
if (program_state->opacity != builder->current_opacity)
|
||||
{
|
||||
OpOpacity *opo;
|
||||
|
||||
opo = ops_begin (builder, OP_CHANGE_OPACITY);
|
||||
opo->opacity = builder->current_opacity;
|
||||
program_state->opacity = builder->current_opacity;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ops_set_clip (RenderOpBuilder *builder,
|
||||
const GskRoundedRect *clip)
|
||||
{
|
||||
ProgramState *current_program_state = get_current_program_state (builder);
|
||||
OpClip *op;
|
||||
|
||||
if (current_program_state &&
|
||||
rounded_rect_equal (¤t_program_state->clip, clip))
|
||||
return;
|
||||
|
||||
if (!(op = op_buffer_peek_tail_checked (&builder->render_ops, OP_CHANGE_CLIP)))
|
||||
{
|
||||
op = op_buffer_add (&builder->render_ops, OP_CHANGE_CLIP);
|
||||
op->send_corners = !current_program_state ||
|
||||
!rounded_rect_corners_equal (¤t_program_state->clip, clip);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If the op before sent the corners, this one needs, too */
|
||||
op->send_corners |= !current_program_state ||
|
||||
!rounded_rect_corners_equal (¤t_program_state->clip, clip);
|
||||
}
|
||||
|
||||
op->clip = *clip;
|
||||
|
||||
if (current_program_state)
|
||||
current_program_state->clip = *clip;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -318,7 +238,6 @@ ops_push_clip (RenderOpBuilder *self,
|
||||
g_array_append_val (self->clip_stack, entry);
|
||||
self->current_clip = &g_array_index (self->clip_stack, ClipStackEntry, self->clip_stack->len - 1).rect;
|
||||
self->clip_is_rectilinear = entry.is_rectilinear;
|
||||
ops_set_clip (self, clip);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -336,7 +255,6 @@ ops_pop_clip (RenderOpBuilder *self)
|
||||
{
|
||||
self->current_clip = &head->rect;
|
||||
self->clip_is_rectilinear = head->is_rectilinear;
|
||||
ops_set_clip (self, &head->rect);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -352,32 +270,6 @@ ops_has_clip (RenderOpBuilder *self)
|
||||
self->clip_stack->len > 1;
|
||||
}
|
||||
|
||||
static void
|
||||
ops_set_modelview_internal (RenderOpBuilder *builder,
|
||||
GskTransform *transform)
|
||||
{
|
||||
ProgramState *current_program_state = get_current_program_state (builder);
|
||||
OpMatrix *op;
|
||||
|
||||
#if 0
|
||||
XXX This is not possible if we want pop() to work.
|
||||
if (builder->current_program &&
|
||||
gsk_transform_equal (builder->current_program_state->modelview, transform))
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (!(op = op_buffer_peek_tail_checked (&builder->render_ops, OP_CHANGE_MODELVIEW)))
|
||||
op = op_buffer_add (&builder->render_ops, OP_CHANGE_MODELVIEW);
|
||||
|
||||
gsk_transform_to_matrix (transform, &op->matrix);
|
||||
|
||||
if (builder->current_program != NULL)
|
||||
{
|
||||
gsk_transform_unref (current_program_state->modelview);
|
||||
current_program_state->modelview = gsk_transform_ref (transform);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ops_set_modelview:
|
||||
* @builder
|
||||
@@ -410,7 +302,6 @@ ops_set_modelview (RenderOpBuilder *builder,
|
||||
builder->current_modelview = entry->transform;
|
||||
builder->scale_x = entry->metadata.scale_x;
|
||||
builder->scale_y = entry->metadata.scale_y;
|
||||
ops_set_modelview_internal (builder, entry->transform);
|
||||
}
|
||||
|
||||
/* This sets the given modelview to the one we get when multiplying
|
||||
@@ -456,7 +347,6 @@ ops_push_modelview (RenderOpBuilder *builder,
|
||||
builder->scale_x = entry->metadata.scale_x;
|
||||
builder->scale_y = entry->metadata.scale_y;
|
||||
builder->current_modelview = entry->transform;
|
||||
ops_set_modelview_internal (builder, entry->transform);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -480,7 +370,6 @@ ops_pop_modelview (RenderOpBuilder *builder)
|
||||
builder->scale_x = head->metadata.scale_x;
|
||||
builder->scale_y = head->metadata.scale_y;
|
||||
builder->current_modelview = head->transform;
|
||||
ops_set_modelview_internal (builder, head->transform);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -492,17 +381,7 @@ graphene_matrix_t
|
||||
ops_set_projection (RenderOpBuilder *builder,
|
||||
const graphene_matrix_t *projection)
|
||||
{
|
||||
ProgramState *current_program_state = get_current_program_state (builder);
|
||||
graphene_matrix_t prev_mv;
|
||||
OpMatrix *op;
|
||||
|
||||
if (!(op = op_buffer_peek_tail_checked (&builder->render_ops, OP_CHANGE_PROJECTION)))
|
||||
op = op_buffer_add (&builder->render_ops, OP_CHANGE_PROJECTION);
|
||||
|
||||
op->matrix = *projection;
|
||||
|
||||
if (builder->current_program != NULL)
|
||||
current_program_state->projection = *projection;
|
||||
|
||||
prev_mv = builder->current_projection;
|
||||
builder->current_projection = *projection;
|
||||
@@ -518,9 +397,8 @@ ops_set_viewport (RenderOpBuilder *builder,
|
||||
OpViewport *op;
|
||||
graphene_rect_t prev_viewport;
|
||||
|
||||
if (current_program_state != NULL &&
|
||||
rect_equal (¤t_program_state->viewport, viewport))
|
||||
return current_program_state->viewport;
|
||||
if (rect_equal (&builder->current_viewport, viewport))
|
||||
return *viewport;
|
||||
|
||||
op = ops_begin (builder, OP_CHANGE_VIEWPORT);
|
||||
op->viewport = *viewport;
|
||||
@@ -586,24 +464,14 @@ float
|
||||
ops_set_opacity (RenderOpBuilder *builder,
|
||||
float opacity)
|
||||
{
|
||||
ProgramState *current_program_state = get_current_program_state (builder);
|
||||
OpOpacity *op;
|
||||
float prev_opacity;
|
||||
|
||||
if (builder->current_opacity == opacity)
|
||||
return opacity;
|
||||
|
||||
if (!(op = op_buffer_peek_tail_checked (&builder->render_ops, OP_CHANGE_OPACITY)))
|
||||
op = op_buffer_add (&builder->render_ops, OP_CHANGE_OPACITY);
|
||||
|
||||
op->opacity = opacity;
|
||||
|
||||
prev_opacity = builder->current_opacity;
|
||||
builder->current_opacity = opacity;
|
||||
|
||||
if (builder->current_program != NULL)
|
||||
current_program_state->opacity = opacity;
|
||||
|
||||
return prev_opacity;
|
||||
}
|
||||
|
||||
@@ -666,30 +534,30 @@ ops_set_color_matrix (RenderOpBuilder *builder,
|
||||
const graphene_vec4_t *offset)
|
||||
{
|
||||
ProgramState *current_program_state = get_current_program_state (builder);
|
||||
const bool offset_equal = graphene_vec4_equal (offset, ¤t_program_state->color_matrix.offset);
|
||||
const bool matrix_equal = graphene_matrix_equal_fast (matrix,
|
||||
¤t_program_state->color_matrix.matrix);
|
||||
OpColorMatrix *op;
|
||||
bool offset_equal;
|
||||
|
||||
offset_equal = memcmp (offset,
|
||||
¤t_program_state->color_matrix.offset,
|
||||
sizeof (graphene_vec4_t)) == 0;
|
||||
|
||||
if (memcmp (matrix,
|
||||
¤t_program_state->color_matrix.matrix,
|
||||
sizeof (graphene_matrix_t)) == 0 &&
|
||||
offset_equal)
|
||||
if (offset_equal && matrix_equal)
|
||||
return;
|
||||
|
||||
current_program_state->color_matrix.matrix = *matrix;
|
||||
|
||||
op = ops_begin (builder, OP_CHANGE_COLOR_MATRIX);
|
||||
op->matrix = matrix;
|
||||
|
||||
if (!matrix_equal)
|
||||
{
|
||||
current_program_state->color_matrix.matrix = *matrix;
|
||||
op->matrix.value = matrix;
|
||||
op->matrix.send = TRUE;
|
||||
}
|
||||
else
|
||||
op->matrix.send = FALSE;
|
||||
|
||||
if (!offset_equal)
|
||||
{
|
||||
current_program_state->color_matrix.offset = *offset;
|
||||
op->offset.value = offset;
|
||||
op->offset.send = TRUE;
|
||||
|
||||
current_program_state->color_matrix.offset = *offset;
|
||||
}
|
||||
else
|
||||
op->offset.send = FALSE;
|
||||
@@ -755,8 +623,58 @@ GskQuadVertex *
|
||||
ops_draw (RenderOpBuilder *builder,
|
||||
const GskQuadVertex vertex_data[GL_N_VERTICES])
|
||||
{
|
||||
ProgramState *program_state = get_current_program_state (builder);
|
||||
OpDraw *op;
|
||||
|
||||
if (memcmp (&builder->current_projection, &program_state->projection, sizeof (graphene_matrix_t)) != 0)
|
||||
{
|
||||
OpMatrix *opm;
|
||||
|
||||
opm = ops_begin (builder, OP_CHANGE_PROJECTION);
|
||||
opm->matrix = builder->current_projection;
|
||||
program_state->projection = builder->current_projection;
|
||||
}
|
||||
|
||||
if (program_state->modelview == NULL ||
|
||||
!gsk_transform_equal (builder->current_modelview, program_state->modelview))
|
||||
{
|
||||
OpMatrix *opm;
|
||||
|
||||
opm = ops_begin (builder, OP_CHANGE_MODELVIEW);
|
||||
gsk_transform_to_matrix (builder->current_modelview, &opm->matrix);
|
||||
gsk_transform_unref (program_state->modelview);
|
||||
program_state->modelview = gsk_transform_ref (builder->current_modelview);
|
||||
}
|
||||
|
||||
if (!rect_equal (&builder->current_viewport, &program_state->viewport))
|
||||
{
|
||||
OpViewport *opv;
|
||||
|
||||
opv = ops_begin (builder, OP_CHANGE_VIEWPORT);
|
||||
opv->viewport = builder->current_viewport;
|
||||
program_state->viewport = builder->current_viewport;
|
||||
}
|
||||
|
||||
if (!rounded_rect_equal (builder->current_clip, &program_state->clip))
|
||||
{
|
||||
OpClip *opc;
|
||||
|
||||
opc = ops_begin (builder, OP_CHANGE_CLIP);
|
||||
opc->clip = *builder->current_clip;
|
||||
opc->send_corners = !rounded_rect_corners_equal (builder->current_clip, &program_state->clip);
|
||||
program_state->clip = *builder->current_clip;
|
||||
}
|
||||
|
||||
if (program_state->opacity != builder->current_opacity)
|
||||
{
|
||||
OpOpacity *opo;
|
||||
|
||||
opo = ops_begin (builder, OP_CHANGE_OPACITY);
|
||||
opo->opacity = builder->current_opacity;
|
||||
program_state->opacity = builder->current_opacity;
|
||||
}
|
||||
|
||||
/* TODO: Did the additions above break the following optimization? */
|
||||
if ((op = op_buffer_peek_tail_checked (&builder->render_ops, OP_DRAW)))
|
||||
{
|
||||
op->vao_size += GL_N_VERTICES;
|
||||
|
||||
+2
-1
@@ -53,6 +53,7 @@ typedef struct { GskRoundedRect value; guint send: 1; guint send_corners: 1; } R
|
||||
typedef struct { const GdkRGBA *value; guint send: 1; } RGBAUniformValue;
|
||||
typedef struct { const graphene_vec4_t *value; guint send: 1; } Vec4UniformValue;
|
||||
typedef struct { const GskColorStop *value; guint send: 1; } ColorStopUniformValue;
|
||||
typedef struct { const graphene_matrix_t *value; guint send: 1; } MatrixUniformValue;
|
||||
|
||||
/* OpNode are allocated within OpBuffer.pos, but we keep
|
||||
* a secondary index into the locations of that buffer
|
||||
@@ -167,7 +168,7 @@ typedef struct
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const graphene_matrix_t *matrix;
|
||||
MatrixUniformValue matrix;
|
||||
Vec4UniformValue offset;
|
||||
} OpColorMatrix;
|
||||
|
||||
|
||||
+22
-5
@@ -1263,15 +1263,22 @@ gsk_border_node_diff (GskRenderNode *node1,
|
||||
gdk_rgba_equal (&self1->border_color[0], &self2->border_color[0]))
|
||||
return;
|
||||
|
||||
if (gsk_rounded_rect_equal (&self1->outline, &self2->outline) &&
|
||||
/* Different uniformity -> diff impossible */
|
||||
if (self1->uniform ^ self2->uniform)
|
||||
{
|
||||
gsk_render_node_diff_impossible (node1, node2, region);
|
||||
return;
|
||||
}
|
||||
|
||||
if (self1->border_width[0] == self2->border_width[0] &&
|
||||
self1->border_width[1] == self2->border_width[1] &&
|
||||
self1->border_width[2] == self2->border_width[2] &&
|
||||
self1->border_width[3] == self2->border_width[3] &&
|
||||
gdk_rgba_equal (&self1->border_color[0], &self2->border_color[0]) &&
|
||||
gdk_rgba_equal (&self1->border_color[1], &self2->border_color[1]) &&
|
||||
gdk_rgba_equal (&self1->border_color[2], &self2->border_color[2]) &&
|
||||
gdk_rgba_equal (&self1->border_color[3], &self2->border_color[3]) &&
|
||||
self1->border_width[0] == self2->border_width[0] &&
|
||||
self1->border_width[1] == self2->border_width[1] &&
|
||||
self1->border_width[2] == self2->border_width[2] &&
|
||||
self1->border_width[3] == self2->border_width[3])
|
||||
gsk_rounded_rect_equal (&self1->outline, &self2->outline))
|
||||
return;
|
||||
|
||||
gsk_render_node_diff_impossible (node1, node2, region);
|
||||
@@ -2755,6 +2762,16 @@ gsk_transform_node_draw (GskRenderNode *node,
|
||||
ctm.xx, ctm.yx,
|
||||
ctm.xy, ctm.yy,
|
||||
ctm.x0, ctm.y0));
|
||||
if (xx * yy == xy * yx)
|
||||
{
|
||||
/* broken matrix here. This can happen during transitions
|
||||
* (like when flipping an axis at the point where scale == 0)
|
||||
* and just means that nothing should be drawn.
|
||||
* But Cairo thows lots of ugly errors instead of silently
|
||||
* going on. So We silently go on.
|
||||
*/
|
||||
return;
|
||||
}
|
||||
cairo_transform (cr, &ctm);
|
||||
|
||||
gsk_render_node_draw (self->child, cr);
|
||||
|
||||
+89
-61
@@ -688,10 +688,16 @@ create_ascii_glyphs (PangoFont *font)
|
||||
glyph_string = pango_glyph_string_new ();
|
||||
for (i = MIN_ASCII_GLYPH; i < MAX_ASCII_GLYPH; i++)
|
||||
{
|
||||
pango_shape ((char[2]) { i, 0 },
|
||||
1,
|
||||
¬_a_hack,
|
||||
glyph_string);
|
||||
const char text[2] = { i, 0 };
|
||||
|
||||
pango_shape_with_flags (text,
|
||||
1,
|
||||
text,
|
||||
1,
|
||||
¬_a_hack,
|
||||
glyph_string,
|
||||
PANGO_SHAPE_ROUND_POSITIONS);
|
||||
|
||||
if (glyph_string->num_glyphs != 1)
|
||||
{
|
||||
pango_glyph_string_free (glyph_string);
|
||||
@@ -2304,6 +2310,84 @@ base64_encode_with_linebreaks (const guchar *data,
|
||||
return out;
|
||||
}
|
||||
|
||||
void
|
||||
gsk_text_node_serialize_glyphs (GskRenderNode *node,
|
||||
GString *p)
|
||||
{
|
||||
const guint n_glyphs = gsk_text_node_get_num_glyphs (node);
|
||||
const PangoGlyphInfo *glyphs = gsk_text_node_get_glyphs (node, NULL);
|
||||
PangoFont *font = gsk_text_node_get_font (node);
|
||||
GString *str;
|
||||
guint i, j;
|
||||
PangoGlyphString *ascii;
|
||||
|
||||
ascii = create_ascii_glyphs (font);
|
||||
str = g_string_new ("");
|
||||
|
||||
for (i = 0; i < n_glyphs; i++)
|
||||
{
|
||||
if (ascii)
|
||||
{
|
||||
for (j = 0; j < ascii->num_glyphs; j++)
|
||||
{
|
||||
if (glyphs[i].glyph == ascii->glyphs[j].glyph &&
|
||||
glyphs[i].geometry.width == ascii->glyphs[j].geometry.width &&
|
||||
glyphs[i].geometry.x_offset == 0 &&
|
||||
glyphs[i].geometry.y_offset == 0 &&
|
||||
glyphs[i].attr.is_cluster_start)
|
||||
{
|
||||
g_string_append_c (str, j + MIN_ASCII_GLYPH);
|
||||
break;
|
||||
}
|
||||
else if (glyphs[i].glyph == ascii->glyphs[j].glyph)
|
||||
{
|
||||
if (glyphs[i].geometry.width != ascii->glyphs[j].geometry.width)
|
||||
g_print ("not ascii because of width (%d != %d)\n",
|
||||
glyphs[i].geometry.width,
|
||||
ascii->glyphs[j].geometry.width);
|
||||
if (glyphs[i].geometry.x_offset != 0 ||
|
||||
glyphs[i].geometry.y_offset != 0)
|
||||
g_print ("not ascii because of offset\n");
|
||||
if (!glyphs[i].attr.is_cluster_start)
|
||||
g_print ("not ascii because of cluster\n");
|
||||
}
|
||||
}
|
||||
if (j != ascii->num_glyphs)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (str->len)
|
||||
{
|
||||
g_string_append_printf (p, "\"%s\", ", str->str);
|
||||
g_string_set_size (str, 0);
|
||||
}
|
||||
|
||||
g_string_append_printf (p, "%u %g",
|
||||
glyphs[i].glyph,
|
||||
(double) glyphs[i].geometry.width / PANGO_SCALE);
|
||||
if (!glyphs[i].attr.is_cluster_start ||
|
||||
glyphs[i].geometry.x_offset != 0 ||
|
||||
glyphs[i].geometry.y_offset != 0)
|
||||
{
|
||||
g_string_append_printf (p, " %g %g",
|
||||
(double) glyphs[i].geometry.x_offset / PANGO_SCALE,
|
||||
(double) glyphs[i].geometry.y_offset / PANGO_SCALE);
|
||||
if (!glyphs[i].attr.is_cluster_start)
|
||||
g_string_append (p, " same-cluster");
|
||||
}
|
||||
|
||||
if (i + 1 < n_glyphs)
|
||||
g_string_append (p, ", ");
|
||||
}
|
||||
|
||||
if (str->len)
|
||||
g_string_append_printf (p, "\"%s\"", str->str);
|
||||
|
||||
g_string_free (str, TRUE);
|
||||
if (ascii)
|
||||
pango_glyph_string_free (ascii);
|
||||
}
|
||||
|
||||
static void
|
||||
render_node_print (Printer *p,
|
||||
GskRenderNode *node)
|
||||
@@ -2631,16 +2715,11 @@ render_node_print (Printer *p,
|
||||
|
||||
case GSK_TEXT_NODE:
|
||||
{
|
||||
const guint n_glyphs = gsk_text_node_get_num_glyphs (node);
|
||||
const PangoGlyphInfo *glyphs = gsk_text_node_get_glyphs (node, NULL);
|
||||
const graphene_point_t *offset = gsk_text_node_get_offset (node);
|
||||
const GdkRGBA *color = gsk_text_node_get_color (node);
|
||||
PangoFont *font = gsk_text_node_get_font (node);
|
||||
PangoFontDescription *desc;
|
||||
char *font_name;
|
||||
GString *str;
|
||||
guint i, j;
|
||||
PangoGlyphString *ascii = create_ascii_glyphs (font);
|
||||
|
||||
start_node (p, "text");
|
||||
|
||||
@@ -2650,61 +2729,14 @@ render_node_print (Printer *p,
|
||||
_indent (p);
|
||||
desc = pango_font_describe (font);
|
||||
font_name = pango_font_description_to_string (desc);
|
||||
if (ascii == NULL)
|
||||
g_print ("\"%s\" has no ascii table\n", font_name);
|
||||
g_string_append_printf (p->str, "font: \"%s\";\n", font_name);
|
||||
g_free (font_name);
|
||||
pango_font_description_free (desc);
|
||||
|
||||
_indent (p);
|
||||
str = g_string_new (NULL);
|
||||
g_string_append (p->str, "glyphs: ");
|
||||
for (i = 0; i < n_glyphs; i++)
|
||||
{
|
||||
if (ascii)
|
||||
{
|
||||
for (j = 0; j < ascii->num_glyphs; j++)
|
||||
{
|
||||
if (glyphs[i].glyph == ascii->glyphs[j].glyph &&
|
||||
glyphs[i].geometry.width == ascii->glyphs[j].geometry.width &&
|
||||
glyphs[i].geometry.x_offset == 0 &&
|
||||
glyphs[i].geometry.y_offset == 0 &&
|
||||
glyphs[i].attr.is_cluster_start)
|
||||
{
|
||||
g_string_append_c (str, j + MIN_ASCII_GLYPH);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j != ascii->num_glyphs)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (str->len)
|
||||
{
|
||||
g_string_append_printf (p->str, "\"%s\", ", str->str);
|
||||
g_string_set_size (str, 0);
|
||||
}
|
||||
|
||||
g_string_append_printf (p->str, "%u %g",
|
||||
glyphs[i].glyph,
|
||||
(double) glyphs[i].geometry.width / PANGO_SCALE);
|
||||
if (!glyphs[i].attr.is_cluster_start ||
|
||||
glyphs[i].geometry.x_offset != 0 ||
|
||||
glyphs[i].geometry.y_offset != 0)
|
||||
{
|
||||
g_string_append_printf (p->str, "%g %g",
|
||||
(double) glyphs[i].geometry.x_offset / PANGO_SCALE,
|
||||
(double) glyphs[i].geometry.y_offset / PANGO_SCALE);
|
||||
if (!glyphs[i].attr.is_cluster_start)
|
||||
g_string_append (p->str, " same-cluster");
|
||||
}
|
||||
|
||||
if (i + 1 < n_glyphs)
|
||||
g_string_append (p->str, ", ");
|
||||
}
|
||||
|
||||
if (str->len)
|
||||
g_string_append_printf (p->str, "\"%s\"", str->str);
|
||||
gsk_text_node_serialize_glyphs (node, p->str);
|
||||
|
||||
g_string_append_c (p->str, ';');
|
||||
g_string_append_c (p->str, '\n');
|
||||
@@ -2713,10 +2745,6 @@ render_node_print (Printer *p,
|
||||
append_point_param (p, "offset", offset);
|
||||
|
||||
end_node (p);
|
||||
|
||||
g_string_free (str, TRUE);
|
||||
if (ascii)
|
||||
pango_glyph_string_free (ascii);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -96,6 +96,9 @@ void gsk_render_node_diff_impossible (GskRenderNode
|
||||
|
||||
bool gsk_border_node_get_uniform (GskRenderNode *self);
|
||||
|
||||
void gsk_text_node_serialize_glyphs (GskRenderNode *self,
|
||||
GString *str);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GSK_RENDER_NODE_PRIVATE_H__ */
|
||||
|
||||
@@ -7,6 +7,16 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GSK_ROUNDED_RECT_INIT_FROM_RECT(_r) \
|
||||
(GskRoundedRect) { .bounds = _r, \
|
||||
.corner = { \
|
||||
GRAPHENE_SIZE_INIT(0, 0),\
|
||||
GRAPHENE_SIZE_INIT(0, 0),\
|
||||
GRAPHENE_SIZE_INIT(0, 0),\
|
||||
GRAPHENE_SIZE_INIT(0, 0),\
|
||||
}}
|
||||
|
||||
|
||||
gboolean gsk_rounded_rect_is_circular (const GskRoundedRect *self);
|
||||
|
||||
void gsk_rounded_rect_path (const GskRoundedRect *self,
|
||||
|
||||
+7
-5
@@ -127,8 +127,10 @@ gsk_transform_alloc (const GskTransformClass *transform_class,
|
||||
|
||||
self->transform_class = transform_class;
|
||||
self->category = next ? MIN (category, next->category) : category;
|
||||
self->next = gsk_transform_is_identity (next) ? NULL : gsk_transform_ref (next);
|
||||
g_clear_pointer (&next, gsk_transform_unref);
|
||||
if (gsk_transform_is_identity (next))
|
||||
gsk_transform_unref (next);
|
||||
else
|
||||
self->next = next;
|
||||
|
||||
return self;
|
||||
}
|
||||
@@ -217,7 +219,7 @@ gsk_identity_transform_equal (GskTransform *first_transform,
|
||||
static const GskTransformClass GSK_IDENTITY_TRANSFORM_CLASS =
|
||||
{
|
||||
sizeof (GskTransform),
|
||||
"GskIdentityMatrix",
|
||||
"GskIdentityTransform",
|
||||
gsk_identity_transform_finalize,
|
||||
gsk_identity_transform_to_matrix,
|
||||
gsk_identity_transform_apply_2d,
|
||||
@@ -1707,8 +1709,8 @@ gsk_transform_invert (GskTransform *self)
|
||||
|
||||
/**
|
||||
* gsk_transform_equal:
|
||||
* @first: the first transform
|
||||
* @second: the second transform
|
||||
* @first: (nullable): the first transform
|
||||
* @second: (nullable): the second transform
|
||||
*
|
||||
* Checks two transforms for equality.
|
||||
*
|
||||
|
||||
@@ -15,8 +15,8 @@ void main() {
|
||||
gl_Position = u_projection * u_modelview * vec4(aPosition, 0.0, 1.0);
|
||||
|
||||
// The -90 is because conics point to the top by default
|
||||
rotation = mod (u_rotation - 90, 360.0);
|
||||
if (rotation < 0)
|
||||
rotation = mod (u_rotation - 90.0, 360.0);
|
||||
if (rotation < 0.0)
|
||||
rotation += 360.0;
|
||||
rotation = PI / 180.0 * rotation;
|
||||
|
||||
@@ -55,7 +55,7 @@ void main() {
|
||||
angle -= rotation;
|
||||
// fract() does the modulo here, so now we have progress
|
||||
// into the current conic
|
||||
float offset = fract (angle / 2 / PI + 2);
|
||||
float offset = fract (angle / 2.0 / PI + 2.0);
|
||||
|
||||
vec4 color = color_stops[0];
|
||||
for (int i = 1; i < u_num_color_stops; i ++) {
|
||||
|
||||
+22
-11
@@ -66,11 +66,11 @@ get_color (GskPangoRenderer *crenderer,
|
||||
rgba->red = color->red / 65535.;
|
||||
rgba->green = color->green / 65535.;
|
||||
rgba->blue = color->blue / 65535.;
|
||||
rgba->alpha = a ? a / 65535. : crenderer->fg_color.alpha;
|
||||
rgba->alpha = a ? a / 65535. : crenderer->fg_color->alpha;
|
||||
}
|
||||
else
|
||||
{
|
||||
*rgba = crenderer->fg_color;
|
||||
*rgba = *crenderer->fg_color;
|
||||
if (a)
|
||||
rgba->alpha = a / 65535.;
|
||||
}
|
||||
@@ -138,11 +138,19 @@ gsk_pango_renderer_draw_trapezoid (PangoRenderer *renderer,
|
||||
double x22)
|
||||
{
|
||||
GskPangoRenderer *crenderer = (GskPangoRenderer *) (renderer);
|
||||
PangoLayout *layout;
|
||||
PangoRectangle ink_rect;
|
||||
cairo_t *cr;
|
||||
double x, y;
|
||||
|
||||
cr = gtk_snapshot_append_cairo (crenderer->snapshot, &crenderer->bounds);
|
||||
layout = pango_renderer_get_layout (renderer);
|
||||
if (!layout)
|
||||
return;
|
||||
|
||||
pango_layout_get_pixel_extents (layout, &ink_rect, NULL);
|
||||
cr = gtk_snapshot_append_cairo (crenderer->snapshot,
|
||||
&GRAPHENE_RECT_INIT (ink_rect.x, ink_rect.y,
|
||||
ink_rect.width, ink_rect.height));
|
||||
set_color (crenderer, part, cr);
|
||||
|
||||
x = y = 0;
|
||||
@@ -234,7 +242,6 @@ gsk_pango_renderer_draw_shape (PangoRenderer *renderer,
|
||||
int y)
|
||||
{
|
||||
GskPangoRenderer *crenderer = (GskPangoRenderer *) (renderer);
|
||||
cairo_t *cr;
|
||||
PangoLayout *layout;
|
||||
PangoCairoShapeRendererFunc shape_renderer;
|
||||
gpointer shape_renderer_data;
|
||||
@@ -263,17 +270,25 @@ gsk_pango_renderer_draw_shape (PangoRenderer *renderer,
|
||||
|
||||
if (!handled)
|
||||
{
|
||||
cr = gtk_snapshot_append_cairo (crenderer->snapshot, &crenderer->bounds);
|
||||
cairo_t *cr;
|
||||
PangoRectangle ink_rect;
|
||||
|
||||
layout = pango_renderer_get_layout (renderer);
|
||||
if (!layout)
|
||||
return;
|
||||
|
||||
pango_layout_get_pixel_extents (layout, &ink_rect, NULL);
|
||||
cr = gtk_snapshot_append_cairo (crenderer->snapshot,
|
||||
&GRAPHENE_RECT_INIT (ink_rect.x, ink_rect.y,
|
||||
ink_rect.width, ink_rect.height));
|
||||
shape_renderer = pango_cairo_context_get_shape_renderer (pango_layout_get_context (layout),
|
||||
&shape_renderer_data);
|
||||
|
||||
if (!shape_renderer)
|
||||
return;
|
||||
{
|
||||
cairo_destroy (cr);
|
||||
return;
|
||||
}
|
||||
|
||||
set_color (crenderer, PANGO_RENDER_PART_FOREGROUND, cr);
|
||||
|
||||
@@ -480,7 +495,6 @@ gtk_snapshot_append_layout (GtkSnapshot *snapshot,
|
||||
const GdkRGBA *color)
|
||||
{
|
||||
GskPangoRenderer *crenderer;
|
||||
PangoRectangle ink_rect;
|
||||
|
||||
g_return_if_fail (snapshot != NULL);
|
||||
g_return_if_fail (PANGO_IS_LAYOUT (layout));
|
||||
@@ -488,10 +502,7 @@ gtk_snapshot_append_layout (GtkSnapshot *snapshot,
|
||||
crenderer = gsk_pango_renderer_acquire ();
|
||||
|
||||
crenderer->snapshot = snapshot;
|
||||
crenderer->fg_color = *color;
|
||||
|
||||
pango_layout_get_pixel_extents (layout, &ink_rect, NULL);
|
||||
graphene_rect_init (&crenderer->bounds, ink_rect.x, ink_rect.y, ink_rect.width, ink_rect.height);
|
||||
crenderer->fg_color = color;
|
||||
|
||||
pango_renderer_draw_layout (PANGO_RENDERER (crenderer), layout, 0, 0);
|
||||
|
||||
|
||||
+2
-3
@@ -49,7 +49,7 @@ typedef gboolean (*GskPangoShapeHandler) (PangoAttrShape *attr,
|
||||
/*
|
||||
* This is a PangoRenderer implementation that translates all the draw calls to
|
||||
* gsk render nodes, using the GtkSnapshot helper class. Glyphs are translated
|
||||
* to text nodes, all other draw calls fall back to cairo nodes.
|
||||
* to text nodes, other draw calls may fall back to cairo nodes.
|
||||
*/
|
||||
|
||||
struct _GskPangoRenderer
|
||||
@@ -58,8 +58,7 @@ struct _GskPangoRenderer
|
||||
|
||||
GtkWidget *widget;
|
||||
GtkSnapshot *snapshot;
|
||||
GdkRGBA fg_color;
|
||||
graphene_rect_t bounds;
|
||||
const GdkRGBA *fg_color;
|
||||
|
||||
/* Error underline color for this widget */
|
||||
GdkRGBA *error_color;
|
||||
|
||||
@@ -52,7 +52,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkCellRendererText, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkCellRendererToggle, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkCellView, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkCheckButton, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkClipboard, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkColorButton, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkColorChooser, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkColorChooserDialog, g_object_unref)
|
||||
|
||||
@@ -100,7 +100,7 @@ gtk_accels_remove (GtkAccels *accels,
|
||||
|
||||
position = gtk_accels_find (accels, action_and_target);
|
||||
if (position < gtk_accels_get_size (accels))
|
||||
gtk_accels_splice (accels, position, 1, NULL, 0);
|
||||
gtk_accels_splice (accels, position, 1, FALSE, NULL, 0);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
|
||||
+3
-3
@@ -317,8 +317,8 @@ gtk_box_buildable_iface_init (GtkBuildableIface *iface)
|
||||
|
||||
/**
|
||||
* gtk_box_new:
|
||||
* @orientation: the box’s orientation.
|
||||
* @spacing: the number of pixels to place by default between children.
|
||||
* @orientation: the box’s orientation
|
||||
* @spacing: the number of pixels to place by default between children
|
||||
*
|
||||
* Creates a new #GtkBox.
|
||||
*
|
||||
@@ -479,7 +479,7 @@ gtk_box_get_baseline_position (GtkBox *box)
|
||||
* gtk_box_insert_child_after:
|
||||
* @box: a #GtkBox
|
||||
* @child: the #GtkWidget to insert
|
||||
* @sibling: (nullable): the sibling to move @child after, or %NULL
|
||||
* @sibling: (nullable): the sibling after which to insert @child
|
||||
*
|
||||
* Inserts @child in the position after @sibling in the list
|
||||
* of @box children. If @sibling is %NULL, insert @child at
|
||||
|
||||
@@ -58,8 +58,15 @@
|
||||
*
|
||||
* # CSS nodes
|
||||
*
|
||||
* GtkColorButton has a single CSS node with name button. To differentiate
|
||||
* it from a plain #GtkButton, it gets the .color style class.
|
||||
* |[<!-- language="plain" -->
|
||||
* colorbutton
|
||||
* ╰── button.color
|
||||
* ╰── [content]
|
||||
*]|
|
||||
*
|
||||
* GtkColorButton has a single CSS node with name colorbutton which
|
||||
* contains a button node. To differentiate it from a plain #GtkButton,
|
||||
* it gets the .color style class.
|
||||
*/
|
||||
|
||||
typedef struct _GtkColorButtonClass GtkColorButtonClass;
|
||||
|
||||
@@ -167,7 +167,7 @@ gtk_css_selector_matches_insert_sorted (GtkCssSelectorMatches *matches,
|
||||
break;
|
||||
}
|
||||
|
||||
gtk_css_selector_matches_splice (matches, i, 0, (gpointer[1]) { data }, 1);
|
||||
gtk_css_selector_matches_splice (matches, i, 0, FALSE, (gpointer[1]) { data }, 1);
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
|
||||
+51
-3
@@ -55,15 +55,63 @@
|
||||
* source must be added to a widget as an event controller, using
|
||||
* gtk_widget_add_controller().
|
||||
*
|
||||
* |[<!-- language="C" -->
|
||||
* static void
|
||||
* my_widget_init (MyWidget *self)
|
||||
* {
|
||||
* GtkDragSource *drag_source = gtk_drag_source_new ();
|
||||
*
|
||||
* g_signal_connect (drag_source, "prepare", G_CALLBACK (on_drag_prepare), self);
|
||||
* g_signal_connect (drag_source, "drag-begin", G_CALLBACK (on_drag_begin), self);
|
||||
*
|
||||
* gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (drag_source));
|
||||
* }
|
||||
* ]|
|
||||
*
|
||||
* Setting up the content provider and icon ahead of time only
|
||||
* makes sense when the data does not change. More commonly, you
|
||||
* will want to set them up just in time. To do so, #GtkDragSource
|
||||
* has #GtkDragSource::prepare and #GtkDragSource::drag-begin signals.
|
||||
*
|
||||
* The ::prepare signal is emitted before a drag is started, and
|
||||
* can be used to set the content provider and actions that the
|
||||
* drag should be started with. The ::drag-begin signal is emitted
|
||||
* after the #GdkDrag object has been created, and can be used
|
||||
* to set up the drag icon.
|
||||
* drag should be started with.
|
||||
*
|
||||
* |[<!-- language="C" -->
|
||||
* static GdkContentProvider *
|
||||
* on_drag_prepare (GtkDragSource *source,
|
||||
* double x,
|
||||
* double y,
|
||||
* MyWidget *self)
|
||||
* {
|
||||
* // This widget supports two types of content: GFile objects
|
||||
* // and GdkPixbuf objects; GTK will handle the serialization
|
||||
* // of these types automatically
|
||||
* GFile *file = my_widget_get_file (self);
|
||||
* GdkPixbuf *pixbuf = my_widget_get_pixbuf (self);
|
||||
*
|
||||
* return gdk_content_provider_new_union ((GdkContentProvider *[2]) {
|
||||
* gdk_content_provider_new_typed (G_TYPE_FILE, file),
|
||||
* gdk_content_provider_new_typed (GDK_TYPE_PIXBUF, pixbuf),
|
||||
* }, 2);
|
||||
* }
|
||||
* ]|
|
||||
*
|
||||
* The ::drag-begin signal is emitted after the #GdkDrag object has
|
||||
* been created, and can be used to set up the drag icon.
|
||||
*
|
||||
* |[<!-- language="C" -->
|
||||
* static void
|
||||
* on_drag_begin (GtkDragSource *source,
|
||||
* GtkDrag *drag,
|
||||
* MyWidget *self)
|
||||
* {
|
||||
* // Set the widget as the drag icon
|
||||
* GdkPaintable *paintable = gtk_widget_paintable_new (GTK_WIDGET (self));
|
||||
* gtk_drag_source_set_icon (source, paintable, 0, 0);
|
||||
* g_object_unref (paintable);
|
||||
* }
|
||||
* ]|
|
||||
*
|
||||
* During the DND operation, GtkDragSource emits signals that
|
||||
* can be used to obtain updates about the status of the operation,
|
||||
|
||||
+40
-1
@@ -47,7 +47,46 @@
|
||||
* The most basic way to use a #GtkDropTarget to receive drops on a
|
||||
* widget is to create it via gtk_drop_target_new() passing in the
|
||||
* #GType of the data you want to receive and connect to the
|
||||
* GtkDropTarget::drop signal to receive the data.
|
||||
* GtkDropTarget::drop signal to receive the data:
|
||||
*
|
||||
* |[<!-- language="C" -->
|
||||
* static gboolean
|
||||
* on_drop (GtkDropTarget *target,
|
||||
* const GValue *value,
|
||||
* double x,
|
||||
* double y,
|
||||
* gpointer data)
|
||||
* {
|
||||
* MyWidget *self = data;
|
||||
*
|
||||
* // Call the appropriate setter depending on the type of data
|
||||
* // that we received
|
||||
* if (G_VALUE_HOLDS (value, G_TYPE_FILE))
|
||||
* my_widget_set_file (self, g_value_get_object (value));
|
||||
* else if (G_VALUE_HOLDS (value, GDK_TYPE_PIXBUF))
|
||||
* my_widget_set_pixbuf (self, g_value_get_object (value));
|
||||
* else
|
||||
* return FALSE;
|
||||
*
|
||||
* return TRUE;
|
||||
* }
|
||||
*
|
||||
* static void
|
||||
* my_widget_init (MyWidget *self)
|
||||
* {
|
||||
* GtkDropTarget *target =
|
||||
* gtk_drop_target_new (G_TYPE_INVALID, GDK_ACTION_COPY);
|
||||
*
|
||||
* // This widget accepts two types of drop types: GFile objects
|
||||
* // and GdkPixbuf objects
|
||||
* gtk_drop_target_set_gtypes (target, (GTypes [2]) {
|
||||
* G_TYPE_FILE,
|
||||
* GDK_TYPE_PIXBUF,
|
||||
* }, 2);
|
||||
*
|
||||
* gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (target));
|
||||
* }
|
||||
* ]|
|
||||
*
|
||||
* #GtkDropTarget supports more options, such as:
|
||||
*
|
||||
|
||||
+10
-2
@@ -133,8 +133,8 @@
|
||||
* }
|
||||
* ]|
|
||||
*
|
||||
* Finally, use gtk_editable_delegate_set_property() in your set_property
|
||||
* function (and similar for get_property), to set the editable properties:
|
||||
* Finally, use gtk_editable_delegate_set_property() in your `set_property`
|
||||
* function (and similar for `get_property`), to set the editable properties:
|
||||
*
|
||||
* |[
|
||||
* ...
|
||||
@@ -144,6 +144,14 @@
|
||||
* switch (prop_id)
|
||||
* ...
|
||||
* ]|
|
||||
*
|
||||
* It is important to note that if you create a GtkEditable that uses a delegate,
|
||||
* the low level #GtkEditable::insert-text and #GtkEditable::delete-text signals
|
||||
* will be propagated from the "wrapper" editable to the delegate, but they will
|
||||
* not be propagated from the delegate to the "wrapper" editable, as they would
|
||||
* cause an infinite recursion. If you wish to connect to the #GtkEditable::insert-text
|
||||
* and #GtkEditable::delete-text signals, you will need to connect to them on
|
||||
* the delegate obtained via gtk_editable_get_delegate().
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
+8
-1
@@ -59,7 +59,14 @@
|
||||
*
|
||||
* # CSS nodes
|
||||
*
|
||||
* GtkFontButton has a single CSS node with name fontbutton.
|
||||
* |[<!-- language="plain" -->
|
||||
* fontbutton
|
||||
* ╰── button.font
|
||||
* ╰── [content]
|
||||
*]|
|
||||
*
|
||||
* GtkFontButton has a single CSS node with name fontbutton which
|
||||
* contains a button node with the .font style class.
|
||||
*/
|
||||
|
||||
typedef struct _GtkFontButtonClass GtkFontButtonClass;
|
||||
|
||||
+10
-3
@@ -35,6 +35,7 @@
|
||||
#include "gtkintl.h"
|
||||
#include "gtkmarshalers.h"
|
||||
#include "gtkmain.h"
|
||||
#include "gtknative.h"
|
||||
|
||||
G_DEFINE_TYPE (GtkGestureStylus, gtk_gesture_stylus, GTK_TYPE_GESTURE_SINGLE)
|
||||
|
||||
@@ -319,6 +320,8 @@ gtk_gesture_stylus_get_backlog (GtkGestureStylus *gesture,
|
||||
GArray *backlog_array;
|
||||
GdkTimeCoord *history = NULL;
|
||||
guint n_coords = 0, i;
|
||||
double surf_x, surf_y;
|
||||
GtkNative *native;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_GESTURE_STYLUS (gesture), FALSE);
|
||||
g_return_val_if_fail (backlog != NULL && n_elems != NULL, FALSE);
|
||||
@@ -331,6 +334,9 @@ gtk_gesture_stylus_get_backlog (GtkGestureStylus *gesture,
|
||||
if (!history)
|
||||
return FALSE;
|
||||
|
||||
native = gtk_widget_get_native (gtk_get_event_widget (event));
|
||||
gtk_native_get_surface_transform (native, &surf_x, &surf_y);
|
||||
|
||||
backlog_array = g_array_new (FALSE, FALSE, sizeof (GdkTimeCoord));
|
||||
for (i = 0; i < n_coords; i++)
|
||||
{
|
||||
@@ -339,10 +345,11 @@ gtk_gesture_stylus_get_backlog (GtkGestureStylus *gesture,
|
||||
|
||||
g_array_append_val (backlog_array, *time_coord);
|
||||
time_coord = &g_array_index (backlog_array, GdkTimeCoord, backlog_array->len - 1);
|
||||
if (gtk_widget_compute_point (gtk_get_event_widget (event),
|
||||
|
||||
if (gtk_widget_compute_point (GTK_WIDGET (native),
|
||||
gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture)),
|
||||
&GRAPHENE_POINT_INIT (time_coord->axes[GDK_AXIS_X],
|
||||
time_coord->axes[GDK_AXIS_Y]),
|
||||
&GRAPHENE_POINT_INIT (time_coord->axes[GDK_AXIS_X] - surf_x,
|
||||
time_coord->axes[GDK_AXIS_Y] - surf_y),
|
||||
&p))
|
||||
{
|
||||
time_coord->axes[GDK_AXIS_X] = p.x;
|
||||
|
||||
+5
-8
@@ -3850,7 +3850,7 @@ gtk_icon_paintable_ensure_texture (GtkIconPaintable *self)
|
||||
|
||||
icon_ensure_texture__locked (self, FALSE);
|
||||
|
||||
texture = g_object_ref (self->texture);
|
||||
texture = self->texture;
|
||||
|
||||
g_mutex_unlock (&self->texture_lock);
|
||||
|
||||
@@ -3867,10 +3867,10 @@ init_color_matrix (graphene_matrix_t *color_matrix,
|
||||
const GdkRGBA *warning_color,
|
||||
const GdkRGBA *error_color)
|
||||
{
|
||||
GdkRGBA fg_default = { 0.7450980392156863, 0.7450980392156863, 0.7450980392156863, 1.0};
|
||||
GdkRGBA success_default = { 0.3046921492332342,0.6015716792553597, 0.023437857633325704, 1.0};
|
||||
GdkRGBA warning_default = {0.9570458533607996, 0.47266346227206835, 0.2421911955443656, 1.0 };
|
||||
GdkRGBA error_default = { 0.796887159533074, 0 ,0, 1.0 };
|
||||
const GdkRGBA fg_default = { 0.7450980392156863, 0.7450980392156863, 0.7450980392156863, 1.0};
|
||||
const GdkRGBA success_default = { 0.3046921492332342,0.6015716792553597, 0.023437857633325704, 1.0};
|
||||
const GdkRGBA warning_default = {0.9570458533607996, 0.47266346227206835, 0.2421911955443656, 1.0 };
|
||||
const GdkRGBA error_default = { 0.796887159533074, 0 ,0, 1.0 };
|
||||
const GdkRGBA *fg = foreground_color ? foreground_color : &fg_default;
|
||||
const GdkRGBA *sc = success_color ? success_color : &success_default;
|
||||
const GdkRGBA *wc = warning_color ? warning_color : &warning_default;
|
||||
@@ -3971,11 +3971,8 @@ gtk_icon_paintable_snapshot_with_colors (GtkIconPaintable *icon,
|
||||
|
||||
if (symbolic)
|
||||
gtk_snapshot_pop (snapshot);
|
||||
|
||||
g_object_unref (texture);
|
||||
}
|
||||
|
||||
|
||||
static GdkPaintableFlags
|
||||
icon_paintable_get_flags (GdkPaintable *paintable)
|
||||
{
|
||||
|
||||
+82
-108
@@ -3199,12 +3199,11 @@ get_layout_location (GtkLabel *self,
|
||||
int *yp)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (self);
|
||||
int req_width, x, y;
|
||||
int req_height;
|
||||
int layout_width, layout_height, x, y;
|
||||
float xalign, yalign;
|
||||
PangoRectangle logical;
|
||||
int baseline, layout_baseline, baseline_offset;
|
||||
int label_width, label_height;
|
||||
int widget_width, widget_height;
|
||||
|
||||
xalign = self->xalign;
|
||||
yalign = self->yalign;
|
||||
@@ -3212,19 +3211,17 @@ get_layout_location (GtkLabel *self,
|
||||
if (_gtk_widget_get_direction (widget) != GTK_TEXT_DIR_LTR)
|
||||
xalign = 1.0 - xalign;
|
||||
|
||||
pango_layout_get_extents (self->layout, NULL, &logical);
|
||||
pango_layout_get_pixel_extents (self->layout, NULL, &logical);
|
||||
|
||||
pango_extents_to_pixels (&logical, NULL);
|
||||
layout_width = logical.width;
|
||||
layout_height = logical.height;
|
||||
|
||||
req_width = logical.width;
|
||||
req_height = logical.height;
|
||||
|
||||
label_width = gtk_widget_get_width (widget);
|
||||
label_height = gtk_widget_get_height (widget);
|
||||
widget_width = gtk_widget_get_width (widget);
|
||||
widget_height = gtk_widget_get_height (widget);
|
||||
|
||||
baseline = gtk_widget_get_allocated_baseline (widget);
|
||||
|
||||
x = floor ((xalign * (label_width - req_width)) - logical.x);
|
||||
x = floor ((xalign * (widget_width - layout_width)) - logical.x);
|
||||
|
||||
baseline_offset = 0;
|
||||
if (baseline != -1)
|
||||
@@ -3234,23 +3231,7 @@ get_layout_location (GtkLabel *self,
|
||||
yalign = 0.0; /* Can't support yalign while baseline aligning */
|
||||
}
|
||||
|
||||
/* bgo#315462 - For single-line labels, *do* align the requisition with
|
||||
* respect to the allocation, even if we are under-allocated. For multi-line
|
||||
* labels, always show the top of the text when they are under-allocated. The
|
||||
* rationale is this:
|
||||
*
|
||||
* - Single-line labels appear in GtkButtons, and it is very easy to get them
|
||||
* to be smaller than their requisition. The button may clip the label, but
|
||||
* the label will still be able to show most of itself and the focus
|
||||
* rectangle. Also, it is fairly easy to read a single line of clipped text.
|
||||
*
|
||||
* - Multi-line labels should not be clipped to showing "something in the
|
||||
* middle". You want to read the first line, at least, to get some context.
|
||||
*/
|
||||
if (pango_layout_get_line_count (self->layout) == 1)
|
||||
y = floor ((label_height - req_height) * yalign) + baseline_offset;
|
||||
else
|
||||
y = floor (MAX ((label_height - req_height) * yalign, 0)) + baseline_offset;
|
||||
y = floor ((widget_height - layout_height) * yalign) + baseline_offset;
|
||||
|
||||
if (xp)
|
||||
*xp = x;
|
||||
@@ -3440,42 +3421,84 @@ gtk_label_snapshot (GtkWidget *widget,
|
||||
GtkLabelSelectionInfo *info;
|
||||
GtkStyleContext *context;
|
||||
int lx, ly;
|
||||
int width, height, x;
|
||||
int width, height;
|
||||
|
||||
info = self->select_info;
|
||||
if (!self->text || (*self->text == '\0'))
|
||||
return;
|
||||
|
||||
gtk_label_ensure_layout (self);
|
||||
|
||||
context = _gtk_widget_get_style_context (widget);
|
||||
get_layout_location (self, &lx, &ly);
|
||||
|
||||
gtk_snapshot_render_layout (snapshot, context, lx, ly, self->layout);
|
||||
|
||||
info = self->select_info;
|
||||
if (!info)
|
||||
return;
|
||||
|
||||
width = gtk_widget_get_width (widget);
|
||||
height = gtk_widget_get_height (widget);
|
||||
x = 0;
|
||||
|
||||
if (self->text && (*self->text != '\0'))
|
||||
if (info->selection_anchor != info->selection_end)
|
||||
{
|
||||
get_layout_location (self, &lx, &ly);
|
||||
int range[2];
|
||||
cairo_region_t *range_clip;
|
||||
cairo_rectangle_int_t clip_rect;
|
||||
int i;
|
||||
|
||||
gtk_snapshot_render_layout (snapshot, context, lx, ly, self->layout);
|
||||
range[0] = MIN (info->selection_anchor, info->selection_end);
|
||||
range[1] = MAX (info->selection_anchor, info->selection_end);
|
||||
|
||||
if (info && (info->selection_anchor != info->selection_end))
|
||||
gtk_style_context_save_to_node (context, info->selection_node);
|
||||
|
||||
range_clip = gdk_pango_layout_get_clip_region (self->layout, lx, ly, range, 1);
|
||||
for (i = 0; i < cairo_region_num_rectangles (range_clip); i++)
|
||||
{
|
||||
int range[2];
|
||||
cairo_region_t *range_clip;
|
||||
cairo_rectangle_int_t clip_rect;
|
||||
int i;
|
||||
cairo_region_get_rectangle (range_clip, i, &clip_rect);
|
||||
|
||||
range[0] = info->selection_anchor;
|
||||
range[1] = info->selection_end;
|
||||
gtk_snapshot_push_clip (snapshot, &GRAPHENE_RECT_FROM_RECT (&clip_rect));
|
||||
gtk_snapshot_render_background (snapshot, context, 0, 0, width, height);
|
||||
gtk_snapshot_render_layout (snapshot, context, lx, ly, self->layout);
|
||||
gtk_snapshot_pop (snapshot);
|
||||
}
|
||||
|
||||
if (range[0] > range[1])
|
||||
{
|
||||
int tmp = range[0];
|
||||
range[0] = range[1];
|
||||
range[1] = tmp;
|
||||
}
|
||||
cairo_region_destroy (range_clip);
|
||||
|
||||
gtk_style_context_save_to_node (context, info->selection_node);
|
||||
gtk_style_context_restore (context);
|
||||
}
|
||||
else
|
||||
{
|
||||
GtkLabelLink *focus_link;
|
||||
GtkLabelLink *active_link;
|
||||
int range[2];
|
||||
cairo_region_t *range_clip;
|
||||
cairo_rectangle_int_t clip_rect;
|
||||
int i;
|
||||
GdkRectangle rect;
|
||||
|
||||
if (info->selectable &&
|
||||
gtk_widget_has_focus (widget) &&
|
||||
gtk_widget_is_drawable (widget))
|
||||
{
|
||||
PangoDirection cursor_direction;
|
||||
|
||||
cursor_direction = get_cursor_direction (self);
|
||||
gtk_snapshot_render_insertion_cursor (snapshot, context,
|
||||
lx, ly,
|
||||
self->layout, self->select_info->selection_end,
|
||||
cursor_direction);
|
||||
}
|
||||
|
||||
focus_link = gtk_label_get_focus_link (self, NULL);
|
||||
active_link = info->active_link;
|
||||
|
||||
if (active_link)
|
||||
{
|
||||
range[0] = active_link->start;
|
||||
range[1] = active_link->end;
|
||||
|
||||
gtk_style_context_save_to_node (context, active_link->cssnode);
|
||||
|
||||
range_clip = gdk_pango_layout_get_clip_region (self->layout, lx, ly, range, 1);
|
||||
for (i = 0; i < cairo_region_num_rectangles (range_clip); i++)
|
||||
@@ -3483,7 +3506,7 @@ gtk_label_snapshot (GtkWidget *widget,
|
||||
cairo_region_get_rectangle (range_clip, i, &clip_rect);
|
||||
|
||||
gtk_snapshot_push_clip (snapshot, &GRAPHENE_RECT_FROM_RECT (&clip_rect));
|
||||
gtk_snapshot_render_background (snapshot, context, x, 0, width, height);
|
||||
gtk_snapshot_render_background (snapshot, context, 0, 0, width, height);
|
||||
gtk_snapshot_render_layout (snapshot, context, lx, ly, self->layout);
|
||||
gtk_snapshot_pop (snapshot);
|
||||
}
|
||||
@@ -3492,71 +3515,22 @@ gtk_label_snapshot (GtkWidget *widget,
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
}
|
||||
else if (info)
|
||||
|
||||
if (focus_link && gtk_widget_has_visible_focus (widget))
|
||||
{
|
||||
GtkLabelLink *focus_link;
|
||||
GtkLabelLink *active_link;
|
||||
int range[2];
|
||||
cairo_region_t *range_clip;
|
||||
cairo_rectangle_int_t clip_rect;
|
||||
int i;
|
||||
GdkRectangle rect;
|
||||
range[0] = focus_link->start;
|
||||
range[1] = focus_link->end;
|
||||
|
||||
if (info->selectable &&
|
||||
gtk_widget_has_focus (widget) &&
|
||||
gtk_widget_is_drawable (widget))
|
||||
{
|
||||
PangoDirection cursor_direction;
|
||||
gtk_style_context_save_to_node (context, focus_link->cssnode);
|
||||
|
||||
cursor_direction = get_cursor_direction (self);
|
||||
gtk_snapshot_render_insertion_cursor (snapshot, context,
|
||||
lx, ly,
|
||||
self->layout, self->select_info->selection_end,
|
||||
cursor_direction);
|
||||
}
|
||||
range_clip = gdk_pango_layout_get_clip_region (self->layout, lx, ly, range, 1);
|
||||
cairo_region_get_extents (range_clip, &rect);
|
||||
|
||||
focus_link = gtk_label_get_focus_link (self, NULL);
|
||||
active_link = info->active_link;
|
||||
gtk_snapshot_render_focus (snapshot, context, rect.x, rect.y, rect.width, rect.height);
|
||||
|
||||
if (active_link)
|
||||
{
|
||||
range[0] = active_link->start;
|
||||
range[1] = active_link->end;
|
||||
cairo_region_destroy (range_clip);
|
||||
|
||||
gtk_style_context_save_to_node (context, active_link->cssnode);
|
||||
|
||||
range_clip = gdk_pango_layout_get_clip_region (self->layout, lx, ly, range, 1);
|
||||
for (i = 0; i < cairo_region_num_rectangles (range_clip); i++)
|
||||
{
|
||||
cairo_region_get_rectangle (range_clip, i, &clip_rect);
|
||||
|
||||
gtk_snapshot_push_clip (snapshot, &GRAPHENE_RECT_FROM_RECT (&clip_rect));
|
||||
gtk_snapshot_render_background (snapshot, context, x, 0, width, height);
|
||||
gtk_snapshot_render_layout (snapshot, context, lx, ly, self->layout);
|
||||
gtk_snapshot_pop (snapshot);
|
||||
}
|
||||
|
||||
cairo_region_destroy (range_clip);
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
}
|
||||
|
||||
if (focus_link && gtk_widget_has_visible_focus (widget))
|
||||
{
|
||||
range[0] = focus_link->start;
|
||||
range[1] = focus_link->end;
|
||||
|
||||
gtk_style_context_save_to_node (context, focus_link->cssnode);
|
||||
|
||||
range_clip = gdk_pango_layout_get_clip_region (self->layout, lx, ly, range, 1);
|
||||
cairo_region_get_extents (range_clip, &rect);
|
||||
|
||||
gtk_snapshot_render_focus (snapshot, context, rect.x, rect.y, rect.width, rect.height);
|
||||
|
||||
cairo_region_destroy (range_clip);
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
}
|
||||
gtk_style_context_restore (context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -587,11 +587,12 @@ gtk_list_view_size_allocate (GtkWidget *widget,
|
||||
int min, nat, row_height;
|
||||
int x, y;
|
||||
GtkOrientation orientation, opposite_orientation;
|
||||
GtkScrollablePolicy scroll_policy;
|
||||
GtkScrollablePolicy scroll_policy, opposite_scroll_policy;
|
||||
|
||||
orientation = gtk_list_base_get_orientation (GTK_LIST_BASE (self));
|
||||
opposite_orientation = OPPOSITE_ORIENTATION (orientation);
|
||||
scroll_policy = gtk_list_base_get_scroll_policy (GTK_LIST_BASE (self), orientation);
|
||||
opposite_scroll_policy = gtk_list_base_get_scroll_policy (GTK_LIST_BASE (self), opposite_orientation);
|
||||
|
||||
/* step 0: exit early if list is empty */
|
||||
if (gtk_list_item_manager_get_root (self->item_manager) == NULL)
|
||||
@@ -602,7 +603,7 @@ gtk_list_view_size_allocate (GtkWidget *widget,
|
||||
-1,
|
||||
&min, &nat, NULL, NULL);
|
||||
self->list_width = orientation == GTK_ORIENTATION_VERTICAL ? width : height;
|
||||
if (scroll_policy == GTK_SCROLL_MINIMUM)
|
||||
if (opposite_scroll_policy == GTK_SCROLL_MINIMUM)
|
||||
self->list_width = MAX (min, self->list_width);
|
||||
else
|
||||
self->list_width = MAX (nat, self->list_width);
|
||||
|
||||
+3
-16
@@ -936,8 +936,6 @@ rewrite_event_for_surface (GdkEvent *event,
|
||||
GdkEventType type;
|
||||
double x, y;
|
||||
double dx, dy;
|
||||
double *axes = NULL;
|
||||
guint n_axes = 0;
|
||||
|
||||
type = gdk_event_get_event_type (event);
|
||||
|
||||
@@ -960,16 +958,6 @@ rewrite_event_for_surface (GdkEvent *event,
|
||||
break;
|
||||
}
|
||||
|
||||
if (gdk_event_get_axes (event, &axes, &n_axes))
|
||||
{
|
||||
double *axes_copy = g_memdup (axes, n_axes * sizeof (double));
|
||||
|
||||
/* The newly created event takes ownership of the axes, so
|
||||
* we need a copy
|
||||
*/
|
||||
axes = axes_copy;
|
||||
}
|
||||
|
||||
switch ((guint) type)
|
||||
{
|
||||
case GDK_BUTTON_PRESS:
|
||||
@@ -982,7 +970,7 @@ rewrite_event_for_surface (GdkEvent *event,
|
||||
gdk_event_get_modifier_state (event),
|
||||
gdk_button_event_get_button (event),
|
||||
x, y,
|
||||
g_steal_pointer (&axes));
|
||||
gdk_event_dup_axes (event));
|
||||
case GDK_MOTION_NOTIFY:
|
||||
return gdk_motion_event_new (new_surface,
|
||||
gdk_event_get_device (event),
|
||||
@@ -990,7 +978,7 @@ rewrite_event_for_surface (GdkEvent *event,
|
||||
gdk_event_get_time (event),
|
||||
gdk_event_get_modifier_state (event),
|
||||
x, y,
|
||||
g_steal_pointer (&axes));
|
||||
gdk_event_dup_axes (event));
|
||||
case GDK_TOUCH_BEGIN:
|
||||
case GDK_TOUCH_UPDATE:
|
||||
case GDK_TOUCH_END:
|
||||
@@ -1002,7 +990,7 @@ rewrite_event_for_surface (GdkEvent *event,
|
||||
gdk_event_get_time (event),
|
||||
gdk_event_get_modifier_state (event),
|
||||
x, y,
|
||||
g_steal_pointer (&axes),
|
||||
gdk_event_dup_axes (event),
|
||||
gdk_touch_event_get_emulating_pointer (event));
|
||||
case GDK_TOUCHPAD_SWIPE:
|
||||
gdk_touchpad_event_get_deltas (event, &dx, &dy);
|
||||
@@ -1030,7 +1018,6 @@ rewrite_event_for_surface (GdkEvent *event,
|
||||
break;
|
||||
}
|
||||
|
||||
g_assert (!axes);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
+8
-2
@@ -104,8 +104,14 @@
|
||||
*
|
||||
* # CSS nodes
|
||||
*
|
||||
* GtkMenuButton has a single CSS node with name button. To differentiate
|
||||
* it from a plain #GtkButton, it gets the .popup style class.
|
||||
* |[<!-- language="plain" -->
|
||||
* menubutton
|
||||
* ╰── button.toggle
|
||||
* ╰── [content]
|
||||
*]|
|
||||
*
|
||||
* GtkMenuButton has a single CSS node with name menubutton
|
||||
* which contains a toggle button node.
|
||||
*
|
||||
* # Accessibility
|
||||
*
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
* and #GtkModelButton:icon properties.
|
||||
*
|
||||
* The appearance of model buttons can be influenced with the
|
||||
* #GtkModelButton:centered and #GtkModelButton:iconic properties.
|
||||
* #GtkModelButton:iconic property.
|
||||
*
|
||||
* Model buttons have built-in support for submenus in #GtkPopoverMenu.
|
||||
* To make a GtkModelButton that opens a submenu when activated, set
|
||||
@@ -177,7 +177,6 @@ struct _GtkModelButton
|
||||
GtkEventController *controller;
|
||||
|
||||
guint active : 1;
|
||||
guint centered : 1;
|
||||
guint iconic : 1;
|
||||
guint keep_open : 1;
|
||||
};
|
||||
@@ -490,7 +489,7 @@ update_node_name (GtkModelButton *self)
|
||||
{
|
||||
case GTK_BUTTON_ROLE_TITLE:
|
||||
start_name = "arrow";
|
||||
end_name = NULL;
|
||||
end_name = "";
|
||||
break;
|
||||
case GTK_BUTTON_ROLE_NORMAL:
|
||||
start_name = NULL;
|
||||
@@ -760,8 +759,6 @@ gtk_model_button_set_iconic (GtkModelButton *self,
|
||||
gtk_widget_add_css_class (widget, "flat");
|
||||
}
|
||||
|
||||
self->centered = iconic;
|
||||
|
||||
if (!iconic)
|
||||
{
|
||||
if (self->start_indicator)
|
||||
|
||||
@@ -206,7 +206,7 @@ gtk_multi_filter_remove (GtkMultiFilter *self,
|
||||
|
||||
filter = gtk_filters_get (&self->filters, position);
|
||||
g_signal_handlers_disconnect_by_func (filter, gtk_multi_filter_changed_cb, self);
|
||||
gtk_filters_splice (&self->filters, position, 1, NULL, 0);
|
||||
gtk_filters_splice (&self->filters, position, 1, FALSE, NULL, 0);
|
||||
|
||||
gtk_filter_changed (GTK_FILTER (self),
|
||||
GTK_MULTI_FILTER_GET_CLASS (self)->removal_change);
|
||||
|
||||
@@ -432,7 +432,7 @@ gtk_multi_sorter_remove (GtkMultiSorter *self,
|
||||
|
||||
sorter = gtk_sorters_get (&self->sorters, position);
|
||||
g_signal_handlers_disconnect_by_func (sorter, gtk_multi_sorter_changed_cb, self);
|
||||
gtk_sorters_splice (&self->sorters, position, 1, NULL, 0);
|
||||
gtk_sorters_splice (&self->sorters, position, 1, FALSE, NULL, 0);
|
||||
|
||||
gtk_sorter_changed_with_keys (GTK_SORTER (self),
|
||||
GTK_SORTER_CHANGE_LESS_STRICT,
|
||||
|
||||
@@ -135,6 +135,9 @@ gtk_password_entry_buffer_real_deleted_text (GtkEntryBuffer *buffer,
|
||||
memmove (self->text + start, self->text + end, self->text_bytes + 1 - end);
|
||||
self->text_chars -= n_chars;
|
||||
self->text_bytes -= (end - start);
|
||||
|
||||
g_object_notify (G_OBJECT (buffer), "text");
|
||||
g_object_notify (G_OBJECT (buffer), "length");
|
||||
}
|
||||
|
||||
static guint
|
||||
|
||||
+1
-1
@@ -516,7 +516,7 @@ gtk_picture_new_for_filename (const char *filename)
|
||||
* gtk_picture_new_for_resource:
|
||||
* @resource_path: (nullable): resource path to play back
|
||||
*
|
||||
* Creates a new #GtkPicture displaying the file @filename.
|
||||
* Creates a new #GtkPicture displaying the resource at @resource_path.
|
||||
*
|
||||
* This is a utility function that calls gtk_picture_new_for_file().
|
||||
* See that function for details.
|
||||
|
||||
@@ -743,8 +743,12 @@ gtk_css_style_snapshot_outline (GtkCssBoxes *boxes,
|
||||
if (gdk_rgba_is_clear (color))
|
||||
return;
|
||||
|
||||
border_style[1] = border_style[2] = border_style[3] = border_style[0];
|
||||
border_width[0] = _gtk_css_number_value_get (outline->outline_width, 100);
|
||||
|
||||
if (G_APPROX_VALUE (border_width[0], 0, FLT_EPSILON))
|
||||
return;
|
||||
|
||||
border_style[1] = border_style[2] = border_style[3] = border_style[0];
|
||||
border_width[3] = border_width[2] = border_width[1] = border_width[0];
|
||||
colors[0] = colors[1] = colors[2] = colors[3] = *color;
|
||||
|
||||
|
||||
@@ -26,139 +26,6 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
* _gtk_rounded_box_init_rect:
|
||||
* @box: box to initialize
|
||||
* @x: x coordinate of box
|
||||
* @y: y coordinate of box
|
||||
* @width: width of box
|
||||
* @height: height of box
|
||||
*
|
||||
* Initializes the given @box to represent the given rectangle.
|
||||
* The
|
||||
**/
|
||||
void
|
||||
_gtk_rounded_box_init_rect (GskRoundedRect *box,
|
||||
double x,
|
||||
double y,
|
||||
double width,
|
||||
double height)
|
||||
{
|
||||
memset (box, 0, sizeof (GskRoundedRect));
|
||||
|
||||
box->bounds.origin.x = x;
|
||||
box->bounds.origin.y = y;
|
||||
box->bounds.size.width = width;
|
||||
box->bounds.size.height = height;
|
||||
}
|
||||
|
||||
/* clamp border radius, following CSS specs */
|
||||
static void
|
||||
gtk_rounded_box_clamp_border_radius (GskRoundedRect *box)
|
||||
{
|
||||
double factor = 1.0;
|
||||
double corners;
|
||||
|
||||
corners = box->corner[GSK_CORNER_TOP_LEFT].width + box->corner[GSK_CORNER_TOP_RIGHT].width;
|
||||
if (corners != 0)
|
||||
factor = MIN (factor, box->bounds.size.width / corners);
|
||||
|
||||
corners = box->corner[GSK_CORNER_TOP_RIGHT].height + box->corner[GSK_CORNER_BOTTOM_RIGHT].height;
|
||||
if (corners != 0)
|
||||
factor = MIN (factor, box->bounds.size.height / corners);
|
||||
|
||||
corners = box->corner[GSK_CORNER_BOTTOM_RIGHT].width + box->corner[GSK_CORNER_BOTTOM_LEFT].width;
|
||||
if (corners != 0)
|
||||
factor = MIN (factor, box->bounds.size.width / corners);
|
||||
|
||||
corners = box->corner[GSK_CORNER_TOP_LEFT].height + box->corner[GSK_CORNER_BOTTOM_LEFT].height;
|
||||
if (corners != 0)
|
||||
factor = MIN (factor, box->bounds.size.height / corners);
|
||||
|
||||
box->corner[GSK_CORNER_TOP_LEFT].width *= factor;
|
||||
box->corner[GSK_CORNER_TOP_LEFT].height *= factor;
|
||||
box->corner[GSK_CORNER_TOP_RIGHT].width *= factor;
|
||||
box->corner[GSK_CORNER_TOP_RIGHT].height *= factor;
|
||||
box->corner[GSK_CORNER_BOTTOM_RIGHT].width *= factor;
|
||||
box->corner[GSK_CORNER_BOTTOM_RIGHT].height *= factor;
|
||||
box->corner[GSK_CORNER_BOTTOM_LEFT].width *= factor;
|
||||
box->corner[GSK_CORNER_BOTTOM_LEFT].height *= factor;
|
||||
}
|
||||
|
||||
static void
|
||||
_gtk_rounded_box_apply_border_radius (GskRoundedRect *box,
|
||||
const GtkCssValue * const corner[4])
|
||||
{
|
||||
box->corner[GSK_CORNER_TOP_LEFT].width = _gtk_css_corner_value_get_x (corner[GSK_CORNER_TOP_LEFT],
|
||||
box->bounds.size.width);
|
||||
box->corner[GSK_CORNER_TOP_LEFT].height = _gtk_css_corner_value_get_y (corner[GSK_CORNER_TOP_LEFT],
|
||||
box->bounds.size.height);
|
||||
|
||||
box->corner[GSK_CORNER_TOP_RIGHT].width = _gtk_css_corner_value_get_x (corner[GSK_CORNER_TOP_RIGHT],
|
||||
box->bounds.size.width);
|
||||
box->corner[GSK_CORNER_TOP_RIGHT].height = _gtk_css_corner_value_get_y (corner[GSK_CORNER_TOP_RIGHT],
|
||||
box->bounds.size.height);
|
||||
|
||||
box->corner[GSK_CORNER_BOTTOM_RIGHT].width = _gtk_css_corner_value_get_x (corner[GSK_CORNER_BOTTOM_RIGHT],
|
||||
box->bounds.size.width);
|
||||
box->corner[GSK_CORNER_BOTTOM_RIGHT].height = _gtk_css_corner_value_get_y (corner[GSK_CORNER_BOTTOM_RIGHT],
|
||||
box->bounds.size.height);
|
||||
|
||||
box->corner[GSK_CORNER_BOTTOM_LEFT].width = _gtk_css_corner_value_get_x (corner[GSK_CORNER_BOTTOM_LEFT],
|
||||
box->bounds.size.width);
|
||||
box->corner[GSK_CORNER_BOTTOM_LEFT].height = _gtk_css_corner_value_get_y (corner[GSK_CORNER_BOTTOM_LEFT],
|
||||
box->bounds.size.height);
|
||||
|
||||
gtk_rounded_box_clamp_border_radius (box);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_rounded_boxes_init_for_style (GskRoundedRect *border_box,
|
||||
GskRoundedRect *padding_box,
|
||||
GskRoundedRect *content_box,
|
||||
GtkCssStyle *style,
|
||||
double x,
|
||||
double y,
|
||||
double width,
|
||||
double height)
|
||||
{
|
||||
const GtkCssValue *corner[4];
|
||||
GskRoundedRect box;
|
||||
|
||||
gsk_rounded_rect_init_from_rect (&box, &GRAPHENE_RECT_INIT (x, y, width, height), 0);
|
||||
|
||||
corner[GSK_CORNER_TOP_LEFT] = style->border->border_top_left_radius;
|
||||
corner[GSK_CORNER_TOP_RIGHT] = style->border->border_top_right_radius;
|
||||
corner[GSK_CORNER_BOTTOM_LEFT] = style->border->border_bottom_left_radius;
|
||||
corner[GSK_CORNER_BOTTOM_RIGHT] = style->border->border_bottom_right_radius;
|
||||
|
||||
_gtk_rounded_box_apply_border_radius (&box, corner);
|
||||
|
||||
if (border_box)
|
||||
gsk_rounded_rect_init_copy (border_box, &box);
|
||||
|
||||
if (padding_box || content_box)
|
||||
{
|
||||
gsk_rounded_rect_shrink (&box,
|
||||
_gtk_css_number_value_get (style->border->border_top_width, 100),
|
||||
_gtk_css_number_value_get (style->border->border_right_width, 100),
|
||||
_gtk_css_number_value_get (style->border->border_bottom_width, 100),
|
||||
_gtk_css_number_value_get (style->border->border_left_width, 100));
|
||||
if (padding_box)
|
||||
gsk_rounded_rect_init_copy (padding_box, &box);
|
||||
|
||||
if (content_box)
|
||||
{
|
||||
gsk_rounded_rect_shrink (&box,
|
||||
_gtk_css_number_value_get (style->size->padding_top, 100),
|
||||
_gtk_css_number_value_get (style->size->padding_right, 100),
|
||||
_gtk_css_number_value_get (style->size->padding_bottom, 100),
|
||||
_gtk_css_number_value_get (style->size->padding_left, 100));
|
||||
gsk_rounded_rect_init_copy (content_box, &box);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
double angle1;
|
||||
double angle2;
|
||||
@@ -591,12 +458,3 @@ _gtk_rounded_box_path_left (const GskRoundedRect *outer,
|
||||
cairo_close_path (cr);
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_rounded_box_clip_path (const GskRoundedRect *box,
|
||||
cairo_t *cr)
|
||||
{
|
||||
cairo_rectangle (cr,
|
||||
box->bounds.origin.x, box->bounds.origin.y,
|
||||
box->bounds.size.width, box->bounds.size.height);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,20 +28,6 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void _gtk_rounded_box_init_rect (GskRoundedRect *box,
|
||||
double x,
|
||||
double y,
|
||||
double width,
|
||||
double height);
|
||||
void gtk_rounded_boxes_init_for_style (GskRoundedRect *border_box,
|
||||
GskRoundedRect *padding_box,
|
||||
GskRoundedRect *content_box,
|
||||
GtkCssStyle *style,
|
||||
double x,
|
||||
double y,
|
||||
double width,
|
||||
double height);
|
||||
|
||||
double _gtk_rounded_box_guess_length (const GskRoundedRect *box,
|
||||
GtkCssSide side);
|
||||
|
||||
@@ -60,8 +46,6 @@ void _gtk_rounded_box_path_bottom (const GskRounde
|
||||
void _gtk_rounded_box_path_left (const GskRoundedRect *outer,
|
||||
const GskRoundedRect *inner,
|
||||
cairo_t *cr);
|
||||
void _gtk_rounded_box_clip_path (const GskRoundedRect *box,
|
||||
cairo_t *cr);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
+2
-2
@@ -1386,7 +1386,7 @@ gtk_snapshot_pop_one (GtkSnapshot *snapshot)
|
||||
|
||||
/* Remove all the state's nodes from the list of nodes */
|
||||
g_assert (state->start_node_index + state->n_nodes == gtk_snapshot_nodes_get_size (&snapshot->nodes));
|
||||
gtk_snapshot_nodes_splice (&snapshot->nodes, state->start_node_index, state->n_nodes, NULL, 0);
|
||||
gtk_snapshot_nodes_splice (&snapshot->nodes, state->start_node_index, state->n_nodes, FALSE, NULL, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1400,7 +1400,7 @@ gtk_snapshot_pop_one (GtkSnapshot *snapshot)
|
||||
g_assert (previous_state->start_node_index + previous_state->n_nodes == gtk_snapshot_nodes_get_size (&snapshot->nodes));
|
||||
}
|
||||
|
||||
gtk_snapshot_states_splice (&snapshot->state_stack, state_index, 1, NULL, 0);
|
||||
gtk_snapshot_states_splice (&snapshot->state_stack, state_index, 1, FALSE, NULL, 0);
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
+1
-1
@@ -471,7 +471,7 @@ gtk_string_list_splice (GtkStringList *self,
|
||||
else
|
||||
n_additions = 0;
|
||||
|
||||
objects_splice (&self->items, position, n_removals, NULL, n_additions);
|
||||
objects_splice (&self->items, position, n_removals, FALSE, NULL, n_additions);
|
||||
|
||||
for (i = 0; i < n_additions; i++)
|
||||
{
|
||||
|
||||
+2
-15
@@ -3906,7 +3906,6 @@ gtk_text_layout_after_buffer_delete_range (GtkTextBuffer *textbuffer,
|
||||
|
||||
static void
|
||||
render_para (GskPangoRenderer *crenderer,
|
||||
int offset_y,
|
||||
GtkTextLineDisplay *line_display,
|
||||
int selection_start_index,
|
||||
int selection_end_index,
|
||||
@@ -3936,13 +3935,6 @@ render_para (GskPangoRenderer *crenderer,
|
||||
gtk_style_context_restore (context);
|
||||
}
|
||||
|
||||
if (offset_y)
|
||||
{
|
||||
gtk_snapshot_save (crenderer->snapshot);
|
||||
gtk_snapshot_translate (crenderer->snapshot,
|
||||
&GRAPHENE_POINT_INIT (0, offset_y));
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
PangoLayoutLine *line = pango_layout_iter_get_line_readonly (iter);
|
||||
@@ -4114,9 +4106,6 @@ render_para (GskPangoRenderer *crenderer,
|
||||
}
|
||||
while (pango_layout_iter_next_line (iter));
|
||||
|
||||
if (offset_y)
|
||||
gtk_snapshot_restore (crenderer->snapshot);
|
||||
|
||||
pango_layout_iter_free (iter);
|
||||
}
|
||||
|
||||
@@ -4175,9 +4164,7 @@ gtk_text_layout_snapshot (GtkTextLayout *layout,
|
||||
|
||||
crenderer->widget = widget;
|
||||
crenderer->snapshot = snapshot;
|
||||
crenderer->fg_color = color;
|
||||
|
||||
graphene_rect_init (&crenderer->bounds, 0, 0, clip->width, clip->height);
|
||||
crenderer->fg_color = &color;
|
||||
|
||||
gtk_text_layout_wrap_loop_start (layout);
|
||||
|
||||
@@ -4248,7 +4235,7 @@ gtk_text_layout_snapshot (GtkTextLayout *layout,
|
||||
if (line_display->node == NULL)
|
||||
{
|
||||
gtk_snapshot_push_collect (snapshot);
|
||||
render_para (crenderer, 0, line_display,
|
||||
render_para (crenderer, line_display,
|
||||
selection_start_index, selection_end_index,
|
||||
cursor_alpha);
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@ typedef struct _GtkAdjustment GtkAdjustment;
|
||||
typedef struct _GtkBitset GtkBitset;
|
||||
typedef struct _GtkBuilder GtkBuilder;
|
||||
typedef struct _GtkBuilderScope GtkBuilderScope;
|
||||
typedef struct _GtkClipboard GtkClipboard;
|
||||
typedef struct _GtkCssStyleChange GtkCssStyleChange;
|
||||
typedef struct _GtkEventController GtkEventController;
|
||||
typedef struct _GtkGesture GtkGesture;
|
||||
|
||||
@@ -545,6 +545,11 @@ gtk_video_notify_cb (GtkMediaStream *stream,
|
||||
gtk_video_update_error (self);
|
||||
if (g_str_equal (pspec->name, "playing"))
|
||||
gtk_video_update_playing (self);
|
||||
if (g_str_equal (pspec->name, "prepared"))
|
||||
{
|
||||
if (self->autoplay && gtk_media_stream_is_prepared (stream))
|
||||
gtk_media_stream_play (stream);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+9
-5
@@ -9504,12 +9504,16 @@ gtk_widget_remove_mnemonic_label (GtkWidget *widget,
|
||||
|
||||
if (new_list != NULL && new_list->data != NULL)
|
||||
{
|
||||
GList *list;
|
||||
GtkAccessibleRelation relation = GTK_ACCESSIBLE_RELATION_LABELLED_BY;
|
||||
GValue value = G_VALUE_INIT;
|
||||
|
||||
list = gtk_widget_list_mnemonic_labels (widget);
|
||||
gtk_accessible_update_relation (GTK_ACCESSIBLE (widget),
|
||||
GTK_ACCESSIBLE_RELATION_LABELLED_BY, list,
|
||||
-1);
|
||||
/* The ATContext takes ownership of the GList returned by list_mnemonic_labels(),
|
||||
* so we don't need to free it
|
||||
*/
|
||||
gtk_accessible_relation_init_value (relation, &value);
|
||||
g_value_set_pointer (&value, gtk_widget_list_mnemonic_labels (widget));
|
||||
gtk_accessible_update_relation_value (GTK_ACCESSIBLE (widget), 1, &relation, &value);
|
||||
g_value_unset (&value);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -6480,6 +6480,8 @@ gtk_window_destroy (GtkWindow *window)
|
||||
|
||||
g_list_store_remove (toplevel_list, i);
|
||||
|
||||
gtk_window_release_application (window);
|
||||
|
||||
gtk_widget_unrealize (GTK_WIDGET (window));
|
||||
|
||||
g_object_unref (window);
|
||||
|
||||
@@ -65,9 +65,9 @@ static void
|
||||
recurse_child_widgets (GtkWidget *widget,
|
||||
GtkSnapshot *snapshot)
|
||||
{
|
||||
gboolean needs_clip;
|
||||
int width = gtk_widget_get_width (widget);
|
||||
int height = gtk_widget_get_height (widget);
|
||||
gboolean needs_clip;
|
||||
GtkCssStyle *style;
|
||||
GtkWidget *child;
|
||||
GtkBorder boxes[4];
|
||||
@@ -107,15 +107,23 @@ recurse_child_widgets (GtkWidget *widget,
|
||||
const GdkRGBA *color = &colors[i];
|
||||
const GtkBorder *box = &boxes[i];
|
||||
|
||||
gtk_snapshot_append_color (snapshot, color,
|
||||
&GRAPHENE_RECT_INIT ( 0, - box->top, width, box->top));
|
||||
gtk_snapshot_append_color (snapshot, color,
|
||||
&GRAPHENE_RECT_INIT (width, 0, box->right, height));
|
||||
gtk_snapshot_append_color (snapshot, color,
|
||||
&GRAPHENE_RECT_INIT (0, height, width, box->bottom));
|
||||
gtk_snapshot_append_color (snapshot, color,
|
||||
&GRAPHENE_RECT_INIT (- box->left, 0, box->left, height));
|
||||
if (gdk_rgba_is_clear (color))
|
||||
goto next;
|
||||
|
||||
if (box->top > 0)
|
||||
gtk_snapshot_append_color (snapshot, color,
|
||||
&GRAPHENE_RECT_INIT ( 0, - box->top, width, box->top));
|
||||
if (box->right > 0)
|
||||
gtk_snapshot_append_color (snapshot, color,
|
||||
&GRAPHENE_RECT_INIT (width, 0, box->right, height));
|
||||
if (box->bottom > 0)
|
||||
gtk_snapshot_append_color (snapshot, color,
|
||||
&GRAPHENE_RECT_INIT (0, height, width, box->bottom));
|
||||
if (box->left > 0)
|
||||
gtk_snapshot_append_color (snapshot, color,
|
||||
&GRAPHENE_RECT_INIT (- box->left, 0, box->left, height));
|
||||
|
||||
next:
|
||||
/* Grow box + offset */
|
||||
width += box->left + box->right;
|
||||
height += box->top + box->bottom;
|
||||
|
||||
@@ -774,13 +774,10 @@ populate_render_node_properties (GtkListStore *store,
|
||||
case GSK_TEXT_NODE:
|
||||
{
|
||||
const PangoFont *font = gsk_text_node_get_font (node);
|
||||
const PangoGlyphInfo *glyphs = gsk_text_node_get_glyphs (node, NULL);
|
||||
const GdkRGBA *color = gsk_text_node_get_color (node);
|
||||
guint num_glyphs = gsk_text_node_get_num_glyphs (node);
|
||||
const graphene_point_t *offset = gsk_text_node_get_offset (node);
|
||||
PangoFontDescription *desc;
|
||||
GString *s;
|
||||
int i;
|
||||
|
||||
desc = pango_font_describe ((PangoFont *)font);
|
||||
tmp = pango_font_description_to_string (desc);
|
||||
@@ -788,9 +785,8 @@ populate_render_node_properties (GtkListStore *store,
|
||||
g_free (tmp);
|
||||
pango_font_description_free (desc);
|
||||
|
||||
s = g_string_sized_new (6 * num_glyphs);
|
||||
for (i = 0; i < num_glyphs; i++)
|
||||
g_string_append_printf (s, "%x ", glyphs[i].glyph);
|
||||
s = g_string_sized_new (0);
|
||||
gsk_text_node_serialize_glyphs (node, s);
|
||||
add_text_row (store, "Glyphs", s->str);
|
||||
g_string_free (s, TRUE);
|
||||
|
||||
|
||||
@@ -6310,186 +6310,6 @@ void ra_shift_tail(roaring_array_t *ra, int32_t count, int32_t distance);
|
||||
|
||||
#endif
|
||||
/* end file include/roaring/roaring_array.h */
|
||||
/* begin file include/roaring/misc/configreport.h */
|
||||
/*
|
||||
* configreport.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef INCLUDE_MISC_CONFIGREPORT_H_
|
||||
#define INCLUDE_MISC_CONFIGREPORT_H_
|
||||
|
||||
#include <stddef.h> // for size_t
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#ifdef IS_X64
|
||||
// useful for basic info (0)
|
||||
static inline void native_cpuid(unsigned int *eax, unsigned int *ebx,
|
||||
unsigned int *ecx, unsigned int *edx) {
|
||||
#ifdef ROARING_INLINE_ASM
|
||||
__asm volatile("cpuid"
|
||||
: "=a"(*eax), "=b"(*ebx), "=c"(*ecx), "=d"(*edx)
|
||||
: "0"(*eax), "2"(*ecx));
|
||||
#endif /* not sure what to do when inline assembly is unavailable*/
|
||||
}
|
||||
|
||||
// CPUID instruction takes no parameters as CPUID implicitly uses the EAX
|
||||
// register.
|
||||
// The EAX register should be loaded with a value specifying what information to
|
||||
// return
|
||||
static inline void cpuinfo(int code, int *eax, int *ebx, int *ecx, int *edx) {
|
||||
#ifdef ROARING_INLINE_ASM
|
||||
__asm__ volatile("cpuid;" // call cpuid instruction
|
||||
: "=a"(*eax), "=b"(*ebx), "=c"(*ecx),
|
||||
"=d"(*edx) // output equal to "movl %%eax %1"
|
||||
: "a"(code) // input equal to "movl %1, %%eax"
|
||||
//:"%eax","%ebx","%ecx","%edx"// clobbered register
|
||||
);
|
||||
#endif /* not sure what to do when inline assembly is unavailable*/
|
||||
}
|
||||
|
||||
static inline int computecacheline(void) {
|
||||
int eax = 0, ebx = 0, ecx = 0, edx = 0;
|
||||
cpuinfo((int)0x80000006, &eax, &ebx, &ecx, &edx);
|
||||
return ecx & 0xFF;
|
||||
}
|
||||
|
||||
// this is quite imperfect, but can be handy
|
||||
static inline const char *guessprocessor(void) {
|
||||
unsigned eax = 1, ebx = 0, ecx = 0, edx = 0;
|
||||
native_cpuid(&eax, &ebx, &ecx, &edx);
|
||||
const char *codename;
|
||||
switch (eax >> 4) {
|
||||
case 0x506E:
|
||||
codename = "Skylake";
|
||||
break;
|
||||
case 0x406C:
|
||||
codename = "CherryTrail";
|
||||
break;
|
||||
case 0x306D:
|
||||
codename = "Broadwell";
|
||||
break;
|
||||
case 0x306C:
|
||||
codename = "Haswell";
|
||||
break;
|
||||
case 0x306A:
|
||||
codename = "IvyBridge";
|
||||
break;
|
||||
case 0x206A:
|
||||
case 0x206D:
|
||||
codename = "SandyBridge";
|
||||
break;
|
||||
case 0x2065:
|
||||
case 0x206C:
|
||||
case 0x206F:
|
||||
codename = "Westmere";
|
||||
break;
|
||||
case 0x106E:
|
||||
case 0x106A:
|
||||
case 0x206E:
|
||||
codename = "Nehalem";
|
||||
break;
|
||||
case 0x1067:
|
||||
case 0x106D:
|
||||
codename = "Penryn";
|
||||
break;
|
||||
case 0x006F:
|
||||
case 0x1066:
|
||||
codename = "Merom";
|
||||
break;
|
||||
case 0x0066:
|
||||
codename = "Presler";
|
||||
break;
|
||||
case 0x0063:
|
||||
case 0x0064:
|
||||
codename = "Prescott";
|
||||
break;
|
||||
case 0x006D:
|
||||
codename = "Dothan";
|
||||
break;
|
||||
case 0x0366:
|
||||
codename = "Cedarview";
|
||||
break;
|
||||
case 0x0266:
|
||||
codename = "Lincroft";
|
||||
break;
|
||||
case 0x016C:
|
||||
codename = "Pineview";
|
||||
break;
|
||||
default:
|
||||
codename = "UNKNOWN";
|
||||
break;
|
||||
}
|
||||
return codename;
|
||||
}
|
||||
|
||||
static inline void tellmeall(void) {
|
||||
printf("Intel processor: %s\t", guessprocessor());
|
||||
|
||||
#ifdef __VERSION__
|
||||
printf(" compiler version: %s\t", __VERSION__);
|
||||
#endif
|
||||
printf("\tBuild option USEAVX ");
|
||||
#ifdef USEAVX
|
||||
printf("enabled\n");
|
||||
#else
|
||||
printf("disabled\n");
|
||||
#endif
|
||||
#ifndef __AVX2__
|
||||
printf("AVX2 is NOT available.\n");
|
||||
#endif
|
||||
|
||||
if ((sizeof(int) != 4) || (sizeof(long) != 8)) {
|
||||
printf("number of bytes: int = %lu long = %lu \n",
|
||||
(long unsigned int)sizeof(size_t),
|
||||
(long unsigned int)sizeof(int));
|
||||
}
|
||||
#if defined(__LITTLE_ENDIAN__) && __LITTLE_ENDIAN__
|
||||
// This is what we expect!
|
||||
// printf("you have little endian machine");
|
||||
#endif
|
||||
#if defined(__BIG_ENDIAN__) && __BIG_ENDIAN__
|
||||
printf("you have a big endian machine");
|
||||
#endif
|
||||
#if __CHAR_BIT__
|
||||
if (__CHAR_BIT__ != 8) printf("on your machine, chars don't have 8bits???");
|
||||
#endif
|
||||
if (computecacheline() != 64)
|
||||
printf("cache line: %d bytes\n", computecacheline());
|
||||
}
|
||||
#else
|
||||
|
||||
static inline void tellmeall(void) {
|
||||
printf("Non-X64 processor\n");
|
||||
#ifdef __arm__
|
||||
printf("ARM processor detected\n");
|
||||
#endif
|
||||
#ifdef __VERSION__
|
||||
printf(" compiler version: %s\t", __VERSION__);
|
||||
#endif
|
||||
if ((sizeof(int) != 4) || (sizeof(long) != 8)) {
|
||||
printf("number of bytes: int = %lu long = %lu \n",
|
||||
(long unsigned int)sizeof(size_t),
|
||||
(long unsigned int)sizeof(int));
|
||||
}
|
||||
#if __LITTLE_ENDIAN__
|
||||
// This is what we expect!
|
||||
// printf("you have little endian machine");
|
||||
#endif
|
||||
#if __BIG_ENDIAN__
|
||||
printf("you have a big endian machine");
|
||||
#endif
|
||||
#if __CHAR_BIT__
|
||||
if (__CHAR_BIT__ != 8) printf("on your machine, chars don't have 8bits???");
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* INCLUDE_MISC_CONFIGREPORT_H_ */
|
||||
/* end file include/roaring/misc/configreport.h */
|
||||
/* begin file include/roaring/roaring.h */
|
||||
/*
|
||||
An implementation of Roaring Bitmaps in C.
|
||||
|
||||
@@ -536,7 +536,8 @@ button {
|
||||
transition: $button_transition;
|
||||
transition-duration: 500ms;
|
||||
}
|
||||
&:active {
|
||||
&:active,
|
||||
&:checked {
|
||||
@include button(undecorated-active);
|
||||
transition: $button_transition;
|
||||
}
|
||||
@@ -1396,9 +1397,10 @@ windowcontrols {
|
||||
min-height: 0;
|
||||
&:hover {
|
||||
//special case hover colors inside a headerbar
|
||||
@include button(undecorated-hover,$c:$headerbar_bg_color);
|
||||
@include button(undecorated-hover,$c:darken($headerbar_bg_color,10%));
|
||||
}
|
||||
&:active { @include button(undecorated-active,$c:$headerbar_bg_color); }
|
||||
&:active,
|
||||
&:checked { @include button(undecorated-active,$c:darken($headerbar_bg_color,10%)); }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -419,7 +419,7 @@
|
||||
box-shadow: none;
|
||||
text-shadow: none;
|
||||
@if $variant == 'light' {
|
||||
background-color: darken($c,26%);
|
||||
background-color: darken($c,14%);
|
||||
}
|
||||
@else {
|
||||
background-color: darken($c,10%);
|
||||
@@ -431,7 +431,7 @@
|
||||
box-shadow: none;
|
||||
text-shadow: none;
|
||||
@if $variant == 'light' {
|
||||
background-color: darken($c,40%);
|
||||
background-color: darken($c,30%);
|
||||
}
|
||||
@else {
|
||||
background-color: darken($c,14%);
|
||||
|
||||
+21
-20
@@ -251,9 +251,8 @@ static GdkPixbuf *
|
||||
load_symbolic_svg (const char *escaped_file_data,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
int icon_width,
|
||||
int icon_height,
|
||||
const char *icon_width_str,
|
||||
const char *icon_height_str,
|
||||
const char *fg_string,
|
||||
const char *success_color_string,
|
||||
const char *warning_color_string,
|
||||
@@ -263,22 +262,13 @@ load_symbolic_svg (const char *escaped_file_data,
|
||||
GInputStream *stream;
|
||||
GdkPixbuf *pixbuf;
|
||||
char *data;
|
||||
char *svg_width, *svg_height;
|
||||
|
||||
if (width == 0)
|
||||
width = icon_width * scale;
|
||||
if (height == 0)
|
||||
height = icon_height * scale;
|
||||
|
||||
svg_width = g_strdup_printf ("%d", icon_width);
|
||||
svg_height = g_strdup_printf ("%d", icon_height);
|
||||
|
||||
data = g_strconcat ("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"
|
||||
"<svg version=\"1.1\"\n"
|
||||
" xmlns=\"http://www.w3.org/2000/svg\"\n"
|
||||
" xmlns:xi=\"http://www.w3.org/2001/XInclude\"\n"
|
||||
" width=\"", svg_width, "\"\n"
|
||||
" height=\"", svg_height, "\">\n"
|
||||
" width=\"", icon_width_str, "\"\n"
|
||||
" height=\"", icon_height_str, "\">\n"
|
||||
" <style type=\"text/css\">\n"
|
||||
" rect,circle,path {\n"
|
||||
" fill: ", fg_string," !important;\n"
|
||||
@@ -296,8 +286,6 @@ load_symbolic_svg (const char *escaped_file_data,
|
||||
" <xi:include href=\"data:text/xml;base64,", escaped_file_data, "\"/>\n"
|
||||
"</svg>",
|
||||
NULL);
|
||||
g_free (svg_width);
|
||||
g_free (svg_height);
|
||||
|
||||
stream = g_memory_input_stream_new_from_data (data, -1, g_free);
|
||||
pixbuf = gdk_pixbuf_new_from_stream_at_scale (stream, width, height, TRUE, NULL, error);
|
||||
@@ -446,6 +434,8 @@ gtk_make_symbolic_pixbuf_from_data (const char *file_data,
|
||||
{
|
||||
const char *r_string = "rgb(255,0,0)";
|
||||
const char *g_string = "rgb(0,255,0)";
|
||||
char *icon_width_str;
|
||||
char *icon_height_str;
|
||||
GdkPixbuf *loaded;
|
||||
GdkPixbuf *pixbuf = NULL;
|
||||
int plane;
|
||||
@@ -468,6 +458,13 @@ gtk_make_symbolic_pixbuf_from_data (const char *file_data,
|
||||
}
|
||||
|
||||
escaped_file_data = g_base64_encode ((guchar *) file_data, file_len);
|
||||
icon_width_str = g_strdup_printf ("%d", icon_width);
|
||||
icon_height_str = g_strdup_printf ("%d", icon_height);
|
||||
|
||||
if (width == 0)
|
||||
width = icon_width * scale;
|
||||
if (height == 0)
|
||||
height = icon_height * scale;
|
||||
|
||||
for (plane = 0; plane < 3; plane++)
|
||||
{
|
||||
@@ -483,16 +480,16 @@ gtk_make_symbolic_pixbuf_from_data (const char *file_data,
|
||||
* channels, with the color of the fg being implicitly
|
||||
* the "rest", as all color fractions should add up to 1.
|
||||
*/
|
||||
loaded = load_symbolic_svg (escaped_file_data, width, height, scale,
|
||||
icon_width,
|
||||
icon_height,
|
||||
loaded = load_symbolic_svg (escaped_file_data, width, height,
|
||||
icon_width_str,
|
||||
icon_height_str,
|
||||
g_string,
|
||||
plane == 0 ? r_string : g_string,
|
||||
plane == 1 ? r_string : g_string,
|
||||
plane == 2 ? r_string : g_string,
|
||||
error);
|
||||
if (loaded == NULL)
|
||||
return NULL;
|
||||
goto out;
|
||||
|
||||
if (pixbuf == NULL)
|
||||
{
|
||||
@@ -512,6 +509,10 @@ gtk_make_symbolic_pixbuf_from_data (const char *file_data,
|
||||
|
||||
g_free (escaped_file_data);
|
||||
|
||||
out:
|
||||
g_free (icon_width_str);
|
||||
g_free (icon_height_str);
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
|
||||
@@ -507,8 +507,8 @@ set_attribute_value (Element *element,
|
||||
}
|
||||
|
||||
len = g_strv_length (element->attribute_names);
|
||||
element->attribute_names = g_realloc (element->attribute_names, len + 2);
|
||||
element->attribute_values = g_realloc (element->attribute_values, len + 2);
|
||||
element->attribute_names = g_realloc_n (element->attribute_names, len + 2, sizeof (char *));
|
||||
element->attribute_values = g_realloc_n (element->attribute_values, len + 2, sizeof (char *));
|
||||
element->attribute_names[len] = g_strdup (name);
|
||||
element->attribute_values[len] = g_strdup (value);
|
||||
element->attribute_names[len + 1] = NULL;
|
||||
@@ -660,6 +660,7 @@ property_has_been_removed (Element *element,
|
||||
{ "GtkBox", "pack-type", PROP_KIND_PACKING },
|
||||
{ "GtkHeaderBar", "position", PROP_KIND_PACKING },
|
||||
{ "GtkPopoverMenu", "position",PROP_KIND_PACKING },
|
||||
{ "GtkCheckButton", "draw-indicator", PROP_KIND_OBJECT },
|
||||
};
|
||||
char *canonical_name;
|
||||
gboolean found;
|
||||
|
||||
+6
-3
@@ -127,6 +127,7 @@ gtk_libdir = join_paths(gtk_prefix, get_option('libdir'))
|
||||
gtk_datadir = join_paths(gtk_prefix, get_option('datadir'))
|
||||
gtk_localedir = join_paths(gtk_prefix, get_option('localedir'))
|
||||
gtk_sysconfdir = join_paths(gtk_prefix, get_option('sysconfdir'))
|
||||
gtk_bindir = join_paths(gtk_prefix, get_option('bindir'))
|
||||
gtk_applicationsdir = join_paths(gtk_datadir, 'applications')
|
||||
gtk_schemasdir = join_paths(gtk_datadir, 'glib-2.0/schemas')
|
||||
gtk_appdatadir = join_paths(gtk_datadir, 'metainfo')
|
||||
@@ -373,7 +374,8 @@ endif
|
||||
pangocairo_dep = dependency('pangocairo', version: pango_req,
|
||||
fallback : ['pango', 'libpangocairo_dep'])
|
||||
pixbuf_dep = dependency('gdk-pixbuf-2.0', version: gdk_pixbuf_req,
|
||||
fallback : ['gdk-pixbuf', 'gdkpixbuf_dep'])
|
||||
fallback : ['gdk-pixbuf', 'gdkpixbuf_dep'],
|
||||
default_options: ['man=false'])
|
||||
epoxy_dep = dependency('epoxy', version: epoxy_req,
|
||||
fallback: ['libepoxy', 'libepoxy_dep'])
|
||||
harfbuzz_dep = dependency('harfbuzz', version: '>= 0.9', required: false,
|
||||
@@ -721,7 +723,7 @@ if cairogobj_pkg_found
|
||||
endif
|
||||
|
||||
if vulkan_pkg_found
|
||||
gdk_packages += 'vulkan'
|
||||
gdk_packages += ' vulkan'
|
||||
endif
|
||||
|
||||
pkgconf.set('GDK_PACKAGES', gdk_packages)
|
||||
@@ -787,7 +789,8 @@ if not meson.is_cross_build()
|
||||
gtk_api_version,
|
||||
gtk_binary_version,
|
||||
gtk_libdir,
|
||||
gtk_datadir)
|
||||
gtk_datadir,
|
||||
gtk_bindir)
|
||||
else
|
||||
message('Not executing post-install steps automatically when cross compiling')
|
||||
endif
|
||||
|
||||
@@ -25,11 +25,14 @@
|
||||
|
||||
#include <gst/player/gstplayer-video-renderer.h>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
struct _GtkGstPaintable
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
GdkPaintable *image;
|
||||
double pixel_aspect_ratio;
|
||||
};
|
||||
|
||||
struct _GtkGstPaintableClass
|
||||
@@ -66,7 +69,8 @@ gtk_gst_paintable_paintable_get_intrinsic_width (GdkPaintable *paintable)
|
||||
GtkGstPaintable *self = GTK_GST_PAINTABLE (paintable);
|
||||
|
||||
if (self->image)
|
||||
return gdk_paintable_get_intrinsic_width (self->image);
|
||||
return round (self->pixel_aspect_ratio *
|
||||
gdk_paintable_get_intrinsic_width (self->image));
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -88,7 +92,8 @@ gtk_gst_paintable_paintable_get_intrinsic_aspect_ratio (GdkPaintable *paintable)
|
||||
GtkGstPaintable *self = GTK_GST_PAINTABLE (paintable);
|
||||
|
||||
if (self->image)
|
||||
return gdk_paintable_get_intrinsic_aspect_ratio (self->image);
|
||||
return self->pixel_aspect_ratio *
|
||||
gdk_paintable_get_intrinsic_aspect_ratio (self->image);
|
||||
|
||||
return 0.0;
|
||||
};
|
||||
@@ -157,7 +162,8 @@ gtk_gst_paintable_new (void)
|
||||
|
||||
static void
|
||||
gtk_gst_paintable_set_paintable (GtkGstPaintable *self,
|
||||
GdkPaintable *paintable)
|
||||
GdkPaintable *paintable,
|
||||
double pixel_aspect_ratio)
|
||||
{
|
||||
gboolean size_changed;
|
||||
|
||||
@@ -165,7 +171,8 @@ gtk_gst_paintable_set_paintable (GtkGstPaintable *self,
|
||||
return;
|
||||
|
||||
if (self->image == NULL ||
|
||||
gdk_paintable_get_intrinsic_width (self->image) != gdk_paintable_get_intrinsic_width (paintable) ||
|
||||
self->pixel_aspect_ratio * gdk_paintable_get_intrinsic_width (self->image) !=
|
||||
pixel_aspect_ratio * gdk_paintable_get_intrinsic_width (paintable) ||
|
||||
gdk_paintable_get_intrinsic_height (self->image) != gdk_paintable_get_intrinsic_height (paintable) ||
|
||||
gdk_paintable_get_intrinsic_aspect_ratio (self->image) != gdk_paintable_get_intrinsic_aspect_ratio (paintable))
|
||||
size_changed = TRUE;
|
||||
@@ -173,6 +180,7 @@ gtk_gst_paintable_set_paintable (GtkGstPaintable *self,
|
||||
size_changed = FALSE;
|
||||
|
||||
g_set_object (&self->image, paintable);
|
||||
self->pixel_aspect_ratio = pixel_aspect_ratio;
|
||||
|
||||
if (size_changed)
|
||||
gdk_paintable_invalidate_size (GDK_PAINTABLE (self));
|
||||
@@ -185,6 +193,7 @@ typedef struct _SetTextureInvocation SetTextureInvocation;
|
||||
struct _SetTextureInvocation {
|
||||
GtkGstPaintable *paintable;
|
||||
GdkTexture *texture;
|
||||
double pixel_aspect_ratio;
|
||||
};
|
||||
|
||||
static void
|
||||
@@ -202,20 +211,23 @@ gtk_gst_paintable_set_texture_invoke (gpointer data)
|
||||
SetTextureInvocation *invoke = data;
|
||||
|
||||
gtk_gst_paintable_set_paintable (invoke->paintable,
|
||||
GDK_PAINTABLE (invoke->texture));
|
||||
GDK_PAINTABLE (invoke->texture),
|
||||
invoke->pixel_aspect_ratio);
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_gst_paintable_queue_set_texture (GtkGstPaintable *self,
|
||||
GdkTexture *texture)
|
||||
GdkTexture *texture,
|
||||
double pixel_aspect_ratio)
|
||||
{
|
||||
SetTextureInvocation *invoke;
|
||||
|
||||
invoke = g_slice_new0 (SetTextureInvocation);
|
||||
invoke->paintable = g_object_ref (self);
|
||||
invoke->texture = g_object_ref (texture);
|
||||
invoke->pixel_aspect_ratio = pixel_aspect_ratio;
|
||||
|
||||
g_main_context_invoke_full (NULL,
|
||||
G_PRIORITY_DEFAULT,
|
||||
|
||||
@@ -31,7 +31,8 @@ G_DECLARE_FINAL_TYPE (GtkGstPaintable, gtk_gst_paintable, GTK, GST_PAINTABLE, GO
|
||||
GdkPaintable * gtk_gst_paintable_new (void);
|
||||
|
||||
void gtk_gst_paintable_queue_set_texture (GtkGstPaintable *self,
|
||||
GdkTexture *texture);
|
||||
GdkTexture *texture,
|
||||
double pixel_aspect_ratio);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -111,9 +111,17 @@ gtk_gst_memory_format_from_video (GstVideoFormat format)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
video_frame_free (GstVideoFrame *frame)
|
||||
{
|
||||
gst_video_frame_unmap (frame);
|
||||
g_free (frame);
|
||||
}
|
||||
|
||||
static GdkTexture *
|
||||
gtk_gst_sink_texture_from_buffer (GtkGstSink *self,
|
||||
GstBuffer *buffer)
|
||||
GstBuffer *buffer,
|
||||
double *pixel_aspect_ratio)
|
||||
{
|
||||
GstVideoFrame frame;
|
||||
GdkTexture *texture;
|
||||
@@ -124,15 +132,16 @@ gtk_gst_sink_texture_from_buffer (GtkGstSink *self,
|
||||
|
||||
bytes = g_bytes_new_with_free_func (frame.data[0],
|
||||
frame.info.width * frame.info.stride[0],
|
||||
(GDestroyNotify) gst_buffer_unref,
|
||||
gst_buffer_ref (buffer));
|
||||
(GDestroyNotify) video_frame_free,
|
||||
g_memdup (&frame, sizeof (frame)));
|
||||
texture = gdk_memory_texture_new (frame.info.width,
|
||||
frame.info.height,
|
||||
gtk_gst_memory_format_from_video (GST_VIDEO_FRAME_FORMAT (&frame)),
|
||||
bytes,
|
||||
frame.info.stride[0]);
|
||||
g_bytes_unref (bytes);
|
||||
gst_video_frame_unmap (&frame);
|
||||
|
||||
*pixel_aspect_ratio = ((double) frame.info.par_n) / ((double) frame.info.par_d);
|
||||
|
||||
return texture;
|
||||
}
|
||||
@@ -142,6 +151,7 @@ gtk_gst_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
|
||||
{
|
||||
GtkGstSink *self;
|
||||
GdkTexture *texture;
|
||||
double pixel_aspect_ratio;
|
||||
|
||||
GST_TRACE ("rendering buffer:%p", buf);
|
||||
|
||||
@@ -149,10 +159,10 @@ gtk_gst_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
|
||||
texture = gtk_gst_sink_texture_from_buffer (self, buf);
|
||||
texture = gtk_gst_sink_texture_from_buffer (self, buf, &pixel_aspect_ratio);
|
||||
if (texture)
|
||||
{
|
||||
gtk_gst_paintable_queue_set_texture (self->paintable, texture);
|
||||
gtk_gst_paintable_queue_set_texture (self->paintable, texture, pixel_aspect_ratio);
|
||||
g_object_unref (texture);
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ if gstplayer_dep.found()
|
||||
'gtkgstsink.c',
|
||||
],
|
||||
c_args: extra_c_args,
|
||||
dependencies: [ libgtk_dep, gstplayer_dep ],
|
||||
dependencies: [ libm, libgtk_dep, gstplayer_dep ],
|
||||
install_dir: media_install_dir,
|
||||
install: true,
|
||||
)
|
||||
|
||||
@@ -16,8 +16,6 @@ endif
|
||||
printbackends_subdir = 'gtk-4.0/@0@/printbackends'.format(gtk_binary_version)
|
||||
printbackends_install_dir = join_paths(get_option('libdir'), printbackends_subdir)
|
||||
|
||||
cdata.set_quoted('GTK_PRINT_BACKENDS', ','.join(print_backends))
|
||||
|
||||
printbackends_args = [
|
||||
'-DGTK_COMPILATION',
|
||||
'-DGTK_DISABLE_DEPRECATION_WARNINGS',
|
||||
@@ -77,3 +75,5 @@ shared_module('printbackend-file',
|
||||
install_dir: printbackends_install_dir,
|
||||
install: true,
|
||||
)
|
||||
|
||||
cdata.set_quoted('GTK_PRINT_BACKENDS', ','.join(print_backends))
|
||||
|
||||
+448
-438
File diff suppressed because it is too large
Load Diff
+1315
-1297
File diff suppressed because it is too large
Load Diff
+4824
-3113
File diff suppressed because it is too large
Load Diff
+4402
-3058
File diff suppressed because it is too large
Load Diff
+1647
-823
File diff suppressed because it is too large
Load Diff
@@ -77,7 +77,7 @@ gdk_array(test_splice) (void)
|
||||
for (j = 0; j < add; j++)
|
||||
sum += ++additions[j];
|
||||
|
||||
gdk_array(splice) (&v, pos, remove, additions, add);
|
||||
gdk_array(splice) (&v, pos, remove, FALSE, additions, add);
|
||||
{
|
||||
gsize total = 0;
|
||||
for (j = 0; j < gdk_array(get_size) (&v); j++)
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
transform {
|
||||
/* break the transform on purpose, because
|
||||
this is valid in GSK and should result
|
||||
in nothing being drawn. */
|
||||
transform: scale(0);
|
||||
child: color {
|
||||
color: red;
|
||||
bounds: 0 0 100 100;
|
||||
}
|
||||
}
|
||||
|
||||
/* make sure the rendering has a size */
|
||||
color {
|
||||
color: transparent;
|
||||
bounds: 0 0 1 1;
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 86 B |
@@ -48,6 +48,7 @@ compare_render_tests = [
|
||||
'empty-shadow',
|
||||
'empty-texture',
|
||||
'empty-transform',
|
||||
'invalid-transform',
|
||||
'opacity_clip',
|
||||
'outset_shadow_offset_both',
|
||||
'outset_shadow_offset_x',
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
text {
|
||||
color: rgb(50,50,50);
|
||||
font: "Cantarell 11";
|
||||
glyphs: "N", 430 5, 406 8, 417 7, 772 4, 783 5, 783 5, 793 6 0 0 same-cluster;
|
||||
offset: 0 32.0186;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
text {
|
||||
color: rgb(50,50,50);
|
||||
font: "Cantarell 11";
|
||||
glyphs: "N", 430 5, 406 8, 417 7, 772 4, 783 5, 783 5, 793 6 0 0 same-cluster;
|
||||
offset: 0 32.0186;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk" version="4.0"/>
|
||||
<object class="GtkWindow" id="window1">
|
||||
<property name="child">
|
||||
<object class="GtkBox" id="box1">
|
||||
<property name="orientation">GTK_ORIENTATION_VERTICAL</property>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="checkbutton1">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="label">Check</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</interface>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkWindow" id="window1">
|
||||
<child>
|
||||
<object class="GtkBox" id="box1">
|
||||
<property name="orientation">GTK_ORIENTATION_VERTICAL</property>
|
||||
<property name="visible">1</property>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="checkbutton1">
|
||||
<property name="draw_indicator">1</property>
|
||||
<property name="hexpand">1</property>
|
||||
<property name="label">Check</property>
|
||||
<property name="visible">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
Reference in New Issue
Block a user