Commit Graph

1192 Commits

Author SHA1 Message Date
Alexander Larsson
7bee22bcb6 Avoid some more type checks for internal calls 2017-01-11 15:27:51 +01:00
Alexander Larsson
65ad2541d7 Snapshot: Only record names if inspector is recording
Otherwise we do a lot of allocations and vprintf calls which are
not used.
2017-01-11 10:22:40 +01:00
Benjamin Otte
d50b73f66d treeview: Remove gtk_tree_view_get_bin_window()
We don't want to expose GdkWindows in the public API.
2017-01-08 00:48:12 +01:00
Timm Bäder
47d4ad71fb Remove gtk_container_snapshot_child
Replace it with the already existing gtk_widget_snapshot_child.
2017-01-07 17:19:30 +01:00
Benjamin Otte
0efeaf9508 treeview: Port rest of stuff to snapshot()
The only thing still drawn with Cairo are grid lines.
2016-12-22 03:37:32 +01:00
Benjamin Otte
f1825f5eff treeview: Partially convert to snapshot()
The big fat scary bin drawing function that actually draws the cell
renderers - that one is still missing.
2016-12-22 03:37:32 +01:00
Benjamin Otte
4850271ae8 API: Remove gtk_cairo_should_draw_window()
The answer is: Yes.
2016-11-23 18:48:38 +01:00
Timm Bäder
5e06701f53 treeview: Remove style properties
Replace them with the Adwaita default values
2016-11-12 08:09:58 +01:00
Benjamin Otte
24d0baec38 API: gdk: Add gdk_window_new_popup()
... and use it.
2016-11-06 23:47:56 +01:00
Timm Bäder
846cf681e8 Remove gtk_widget_set_mapped
Let all the remaining callers chain up.
2016-11-05 11:56:36 +01:00
Benjamin Otte
5e07a31d2b gtk: Call gtk_widget_set_has_window() on every widget
Even if we just set it to the value it already had.
2016-11-02 06:54:57 +01:00
Benjamin Otte
8ea1157d38 treeview: Don't use gtk_widget_get_allocaton()
Use gtk_widget_get_allocated_width()/height() instead.
2016-11-02 06:54:57 +01:00
Benjamin Otte
8854279e2a treeview: Clip before translating
We want to clip invalidations to the bin window, not the treeview
itself.
2016-11-01 03:51:48 +01:00
Benjamin Otte
b40aeb7ab4 treeview: Clip to bin window size when drawing bin window
This ensures that the drawing does not extend the actually drawn area.

It also ensures that our math is sane, because the math assumes the clip
area cannot extend the window. After all, before GTK4 it always was like
that.

Fixes a bunch of drawing bugs when the clip area does indeed extend too
far.
2016-11-01 03:51:48 +01:00
Benjamin Otte
e1e64ac6fc treeview: Use gtk_widget_queue_draw() 2016-10-27 05:07:23 +02:00
Benjamin Otte
134165e773 treeview: Remove the pixel cache usage 2016-10-27 05:03:06 +02:00
Rico Tzschichholz
94058583dc treeview: Remove stray property enum-entry 2016-10-23 19:08:27 +02:00
Rico Tzschichholz
b5f9343ab4 treeview: Remove deprecated API 2016-10-23 18:23:59 +02:00
Timm Bäder
9992a616ef widget: Use ::measure vfunc to measure size
Add a new ::measure vfunc similar to GtkCssGadget's that widget
implementations have to override instead of the old get_preferred_width,
get_preferred_height, get_preferred_width_for_height,
get_preferred_height_for_width and
get_preferred_height_and_baseline_for_width.
2016-10-22 19:05:47 +02:00
Timm Bäder
700300eb81 treeview: Remove deprecated adjustment API 2016-10-18 00:29:19 +02:00
Timm Bäder
7b22037613 treeview: Remove unused style properties 2016-10-18 00:29:16 +02:00
Benjamin Otte
b17bdbdf97 treeview: Use gdk_window_new_child() 2016-10-18 00:22:35 +02:00
Emmanuele Bassi
5880d1b990 gtk: Cast static strings assigned to non-const variables
GtkTargetEntry.target is particularly egregious, and it should really be
constified.
2016-10-17 11:44:10 +01:00
Benjamin Otte
4df6ddad54 API: container: Remove gtk_container_set_border_width() 2016-10-16 18:18:58 +02:00
Benjamin Otte
1518fe0a8f API: stylecontext: Remove state argument from getters
The argument must always be the current state.
2016-10-16 18:18:58 +02:00
Benjamin Otte
662001b60a API: Remove ability to set visuals on windows
And with it, gtk_widget_get_visual() and gtk_widget_set_visual() are
gone.

We now always use the RGBA visual (if available) and otherwise fall back
to the system visual.
2016-10-16 18:17:21 +02:00
Matthias Clasen
29faa2db44 Redo focus handling in treeview once more
The fix for bug 767468 had some unintended side-effects. This is
an attempt at doing the same fix (don't grab focus when we are
grab-shadowed), while avoiding the breakage, by using GTK+'s
internal tracking for grab-shadowed-ness.

https://bugzilla.gnome.org/show_bug.cgi?id=770508
2016-09-11 11:47:55 -04:00
Arnaud Bonatti
533de822ba Use 'focused' everywhere.
https://bugzilla.gnome.org/show_bug.cgi?id=770624
2016-09-01 07:14:30 +02:00
Benjamin Otte
e1a03ead7a Use NULL for generic marshallers in g_signal_new()
glib will use the correct marshaller automatically. And as a side
effect, we also get all glib optimizations, like a va marshaller.
2016-08-29 16:20:54 +02:00
Carlos Garnacho
e33e23a6d9 treeview: Ensure the treeview has the implicit grab before grabbing focus
The cellrenderer signals might be taking the grab somewhere else, at which
point it's dubious we should attempt to take the keyboard focus into the
treeview.

This concretely breaks popovers triggered from cellrenderer signals on
button press, because the treeview will attempt to grab focus
inconditionally then.

https://bugzilla.gnome.org/show_bug.cgi?id=767468
2016-06-19 20:54:18 -04:00
Matthias Clasen
c4224bf9d0 treeview: fix an off-by-one error
gtk_tree_view_get_path_at_pos() mistakenly identifies the first
pixel of all but the first column in a tree view as belonging to
the previous column.

https://bugzilla.gnome.org/show_bug.cgi?id=708148
2016-06-05 22:20:38 -04:00
Matthias Clasen
d3adf47d9f treeview: Fix a rubberbanding-related crash
When starting a rubberband selection from an empty area, we could run
into crashes if the selection moves over the rows and then back out
to unpopulated area. Handle this case without crashing.

https://bugzilla.gnome.org/show_bug.cgi?id=766336
2016-05-19 16:59:10 -04:00
Matthias Clasen
449732446b treeview: Use getter for gtk-enable-animations 2016-05-01 00:40:23 -04:00
Matthias Clasen
6ae2c24bde treeview: Stop using screen width/height
Popups should always be placed relative to a monitor.
2016-04-27 23:18:16 -04:00
Matthias Clasen
b5fb9ae3b7 gtk: Port to new monitor api
Use the GdkDisplay monitor api instead of the GdkScreen one.
2016-04-27 23:18:16 -04:00
Руслан Ижбулатов
96c18db0da GtkTreeView: change child repositioning to preserve locality
If there was a piece of text in the cell, then when the edit
entry is shown for that cell, it should have a piece of text
in it roughly at the same location.

Therefore, when child widget is enlarged (child preferred
size exceeds cell size), extra width should be added by
extending either left or right edge depending on text direction.

If after that the child sticks outside of the treeivew visible region,
try to push it back inside (breaking its alignment with the
cell), again, giving preference (i.e. adjusting it last)
to either left or right edge depending on text direction.

https://bugzilla.gnome.org/show_bug.cgi?id=765471
2016-04-28 01:35:46 +00:00
Matthias Clasen
12c5ca5c01 treeview: Update drop target highlighting
Stop using the .dnd style class, and instead use the
:drop(active) pseudo state, together with .before and .after
classes.

https://bugzilla.gnome.org/show_bug.cgi?id=763808
2016-03-21 11:56:17 -04:00
Matthias Clasen
0ac71e81cf Drop some unused debug printfs
Remove some debug spew that has been ifdef'ed out for years
and does not look useful enough to keep.
2016-02-28 21:40:23 -05:00
Benjamin Otte
760b540c8c treeview: Don't make things way too high
If the size-request is larger than the dedicated size, don't increase
the dedicated size by the size request, only increase it to the
size request.
2016-02-25 04:03:41 +01:00
Benjamin Otte
9016a00edd treeview: Fix positioning of editing widgets
This looks like a thinko.
2016-02-25 04:03:41 +01:00
Colomban Wendling
a47d9a7b65 treeview: Make sure the editing widget's top left is always visible
https://bugzilla.gnome.org/show_bug.cgi?id=761838
2016-02-11 22:41:58 -05:00
Matthias Clasen
7d16b8df29 treeview: Draw background when empty
We have a function we call for drawing the empty case, but
it only renders a focus rectangle. Make it draw the background
as well.

https://bugzilla.gnome.org/show_bug.cgi?id=761309
2016-01-30 18:31:30 -05:00
Carlos Garnacho
f32a54fb70 GtkTreeView: Update prelight row after revalidating rows
It might have changed (eg. after a row being expanded, and the child
rows revalidated), so just update it here based on the last pointer
position.

Based on a patch by Maxim Reznik <reznikmm@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=760891
2016-01-22 21:18:24 +01:00
Carlos Garnacho
a5f9dc1284 GtkTreeView: Avoid device query on collapsing rows
The pointer position is queried to properly trigger the prelight
updates on the new row below it. We store the last coordinates
though, and track crossing events to unset these, so it's safe
to just update_prelight() here on these.
2016-01-22 21:18:24 +01:00
Matthias Clasen
a0d91a3a71 treeview: Use foreground color to draw dnd marker
This is still not perfect, but makes the dnd marker better visible
in HighContrastInverse.
2016-01-15 19:39:12 -05:00
Alberto Ruiz
496f0892fc introspection: This patch fixes nullable return values fixes for the following symbols in gtk
gtk_accel_group_query
  gtk_accel_group_from_accel_closure
  gtk_accel_label_get_accel_widget
  gtk_accessible_get_widget
  gtk_actionable_get_action_name
  gtk_app_chooser_get_app_info
  gtk_app_chooser_button_get_heading
  gtk_app_chooser_dialog_get_heading
  gtk_application_get_window_by_id
  gtk_assistant_get_nth_page
  gtk_binding_set_find
  gtk_builder_get_object
  gtk_builder_lookup_callback_symbol
  gtk_builder_get_application
  gtk_button_get_image
  gtk_cell_area_get_focus_from_sibling
  gtk_cell_renderer_start_editing
  gtk_cell_view_get_model
  gtk_cell_view_get_displayed_row
  gtk_clipboard_get_owner
  gtk_container_get_focus_child
  gtk_container_get_focus_vadjustment
  gtk_container_get_focus_hadjustment
  gtk_dialog_get_widget_for_response
  gtk_drag_get_source_widget
  gtk_drag_dest_get_target_list
  gtk_drag_source_get_target_list
  gtk_entry_completion_get_model
  gtk_entry_completion_compute_prefix
  gtk_expander_get_label_widget
  gtk_file_chooser_get_filename
  gtk_file_chooser_get_current_folder
  gtk_file_chooser_get_uri
  gtk_file_chooser_get_current_folder_uri
  gtk_file_chooser_get_preview_widget
  gtk_file_chooser_get_preview_file
  gtk_file_chooser_get_preview_filename
  gtk_file_chooser_get_preview_uri
  gtk_file_chooser_get_extra_widget
  gtk_file_chooser_get_filter
  gtk_file_chooser_native_get_accept_label
  gtk_file_chooser_native_get_cancel_label
  gtk_file_filter_get_name
  gtk_font_chooser_get_font_family
  gtk_font_chooser_get_font_face
  gtk_font_chooser_get_font
  gtk_font_chooser_get_font_desc
  gtk_font_chooser_get_font_map
  gtk_frame_get_label
  gtk_gesture_get_device
  gtk_gesture_get_window
  gtk_gl_area_get_error
  gtk_header_bar_get_title
  gtk_header_bar_get_subtitle
  gtk_header_bar_get_custom_title
  gtk_icon_info_get_filename
  gtk_icon_view_get_path_at_pos
  gtk_icon_view_get_model
  gtk_image_get_pixbuf
  gtk_image_get_animation
  gtk_label_get_mnemonic_widget
  gtk_label_get_attributes
  gtk_check_version
  gtk_menu_button_get_popup
  gtk_menu_button_get_menu_model
  gtk_menu_button_get_align_widget
  gtk_menu_button_get_popover
  gtk_menu_item_get_submenu
  gtk_menu_item_get_accel_path
  gtk_native_dialog_get_title
  gtk_native_dialog_get_transient_for
  gtk_notebook_get_nth_page
  gtk_notebook_get_tab_label_text
  gtk_notebook_get_menu_label
  gtk_notebook_get_menu_label_text
  gtk_notebook_get_group_name
  gtk_notebook_get_action_widget
  gtk_offscreen_window_get_surface
  gtk_offscreen_window_get_pixbuf
  gtk_paned_get_child1
  gtk_paned_get_child2
  gtk_places_sidebar_get_location
  gtk_places_sidebar_get_nth_bookmark
  gtk_plug_get_socket_window
  gtk_popover_get_default_widget
  gtk_progress_bar_get_text
  gtk_recent_filter_get_name
  gtk_recent_manager_lookup_item
  gtk_settings_get_default
  gtk_socket_get_plug_window
  gtk_stack_sidebar_get_stack
  gtk_stack_switcher_get_stack
  gtk_style_context_get_section
  gtk_style_context_get_parent
  gtk_style_context_get_frame_clock
  gtk_test_find_widget
  gtk_text_buffer_get_mark
  gtk_text_tag_table_lookup
  gtk_text_view_get_tabs
  gtk_text_view_toggle_cursor_visible
  gtk_text_view_get_window
  gtk_toolbar_get_nth_item
  gtk_tool_button_get_label
  gtk_tool_button_get_icon_name
  gtk_tool_button_get_label_widget
  gtk_tool_button_get_icon_widget
  gtk_tool_palette_get_drop_item
  gtk_tool_palette_get_drop_group
  gtk_tree_model_filter_convert_child_path_to_path
  gtk_tree_model_filter_convert_path_to_child_path
  gtk_tree_model_sort_convert_child_path_to_path
  gtk_tree_model_sort_convert_path_to_child_path
  gtk_tree_view_get_column
  gtk_tree_view_get_bin_window
  gtk_tree_view_column_get_widget
  gtk_tree_view_column_get_tree_view
  gtk_widget_get_frame_clock
  gtk_window_group_get_current_device_grab
  GtkTextBufferSerializeFunc
2016-01-08 12:18:23 +00:00
Cosimo Cecchi
64a06adfc0 treeview: don't use wide-separators/separator-height
Those style properties are on their way out; instead, use min-height
with the separator style class to obtain the height.
2016-01-03 00:42:51 -08:00
Cosimo Cecchi
2eb7e6a85a treeview: prefer positive polarity in if block 2016-01-03 00:42:51 -08:00
Carlos Garnacho
32c9db8600 GtkTreeView: Add ignore deprecation statements
We still need access to floating devices at places.
2015-12-16 19:47:07 +01:00
Matthias Clasen
2f544655f9 Revise CSS node documentation
Clarify the use of brackets in the CSS node diagrams:
[] means optional nodes or classes, <> means child widgets.
2015-12-16 10:58:47 -05:00