Commit Graph

610 Commits

Author SHA1 Message Date
Benjamin Otte
0e48216c48 notebook: Identify existence of arrows differently
Instead of having gbooleans in the priv struct, just look at the
existence of priv->arrow_node[i].
2016-01-11 17:05:23 +01:00
Benjamin Otte
a12e1328e9 notebook: Convert tab nodes to gadgets
The code does many bad things, so we get a lot of warning spew. Ignore
this for now, fixes will follow.
2016-01-11 17:05:23 +01:00
Benjamin Otte
d780ce3ff3 notebook: Assume tab allocations always change
This causes more redraws, but saves a bunch of code.
2016-01-11 17:05:23 +01:00
Benjamin Otte
7e0c7f7deb notebook: Remove weird hack where the current page was special-cased
I don't even know what it does, but it assumed that the current page was
always as large or larger than any other page. And that isn't true.
2016-01-11 17:05:23 +01:00
Benjamin Otte
a9320d93f6 notebook: Replace redraw_tabs() with gadget_queue_draw(tabs_gadget) 2016-01-11 17:05:23 +01:00
Benjamin Otte
f83c1fedbc notebook: Don't queue redraw of tabs junction
There is no junction anymore, so don't try to redraw it.
2016-01-11 17:05:23 +01:00
Benjamin Otte
e1722baf57 notebook: Convert tabs node to a gadget
And in turn, convert the header gadget to a box gadget.
2016-01-11 17:05:23 +01:00
Benjamin Otte
acc534ebfa boxgadget: Add
Adds a GtkBoxGadget that is a Gadget that behaves like a GtkBox.

Use this gadget to implement the notebook base gadget.
2016-01-11 17:05:23 +01:00
Benjamin Otte
749855c1d1 notebook: Remove unused function call 2016-01-11 17:05:23 +01:00
Benjamin Otte
70b9aacfc2 notebook: Simplify event window position computation
The event window should overlay the header gadget, so just return its
position.
2016-01-11 17:05:23 +01:00
Benjamin Otte
ad245e0226 notebook: Introduce gtk_notebook_has_current_page()
GtkNotebook does not switch the current page if all pages are hidden. So
it may be that no visible page exsits, but there still is a current
page set.

We culd clear the current page, but I'm unsure about backwards
compatibility.

So instead, this new function handles that case.
2016-01-11 17:05:23 +01:00
Benjamin Otte
0d72055b89 notebook: Use gtk_container_class_handle_border_width() 2016-01-11 17:05:23 +01:00
Benjamin Otte
f34059c3b6 notebook: Convert header node to a gadget
This allows reworking the content node to do real height-for-width.

The content node also takes care of border width, but we might want to
have the toplevel do it or just get rid of it.
2016-01-11 17:05:22 +01:00
Benjamin Otte
e27551ddb2 notebook: Add a stack gadget
The stack gadget contains all the child widgets.
2016-01-11 17:05:22 +01:00
Benjamin Otte
c03fed4840 notebook: Remove extra calls to gtk_notebook_pages_allocate()
The function is called during size_allocate() and doesn't need to be
called elsewhere, as all other callers call queue_resize() already.
2016-01-11 17:05:22 +01:00
Benjamin Otte
33b6e30f68 notebook: Remove unnessecary gtk_widget_set_mapped()
We chain up, and the chainedup function calls this for us.
2016-01-11 17:05:22 +01:00
Benjamin Otte
dc4148c4e2 notebook: Simplify gtk_notebook_map()
We set visibility on our children properly, so we can simply chain up
and let the GtkContainer implementation do the mapping of children.
2016-01-11 17:05:22 +01:00
Benjamin Otte
22398ef459 notebook: Remove irrelevant case
The page is never the current page, because it was just created and the
current page wasn't changed yet.
2016-01-11 17:05:22 +01:00
Benjamin Otte
0e528ec74e notebook: No page switching in size request code
We have page switching under control now, we don't need to check every
get_preferred_size() call.
2016-01-11 17:05:22 +01:00
Benjamin Otte
1190efebce notebook: Set the current page when none is set
This case happens when you gtk_widget_show_all (notebook).
2016-01-11 17:05:22 +01:00
Benjamin Otte
0045e57e96 notebook: Draw the same things, no matter the show-border value
show-border modifies the "frame" style class on the notebook node, but
not what we actually draw.
2016-01-11 17:05:22 +01:00
Benjamin Otte
fd9ffe5d57 notebook: Turn the base notebook into a gadget 2016-01-11 17:05:22 +01:00
Benjamin Otte
92089ee29e notebook: Draw tab label while drawing tab
Instead of having special case code doing it.
2016-01-11 17:05:22 +01:00
Benjamin Otte
3d980da405 notebook: Don't translate before painting notebook
This will allow us to draw children directly from within the notebook
drawing code, which will remove a bunch of special casing.
2016-01-11 17:05:22 +01:00
Benjamin Otte
93dc364b02 notebook: Deprecate and stop supporting has-tab-gap style property 2016-01-11 17:05:22 +01:00
Benjamin Otte
71cc212eb5 notebook: Ignore and deprecate style properties
Deprecate initial-gap, tab-curvature and tab-overlap properties. All
their features can be achieved using CSS.

This CSS achieves the same effect as a 10px initial gap:
  notebook header {
    margin-left: 10px;
    margin-right: 10px;
  }

A tab overlap of 10px can be achieved via:
  notebook tabs {
    margin-left: 10px;
  }
  notebook tab {
    margin-left: -10px;
  }

And tab curvature is essentially the same as padding or border on a tab.
2016-01-11 17:03:07 +01: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
Benjamin Otte
35e98dce9b notebook: Sync menu labels with page list in visibile_cb
It's where it changes. Size requests have nothing to do with that.
2015-12-19 06:13:56 +01:00
Benjamin Otte
c3548328f7 notebook: Don't allocate during size requests
wat?
2015-12-19 06:13:56 +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
Carlos Garnacho
91b5497d69 GtkNotebook: Use gdk_seat_grab()
https://bugzilla.gnome.org/show_bug.cgi?id=759309
2015-12-15 00:32:56 +01:00
Benjamin Otte
971a277419 cssnode: Change style-changed signal
Instead of having old and new style, now have a GtkCssStyleChange opaque
object that will compute the changes you are interested in for you.

This simplifies change signal handlers quite a bit and avoids lots of
repeated computation in every signal handler.
2015-12-12 02:16:04 +01:00
Carlos Garnacho
c0477c2c52 GtkNotebook: Use gdouble in coordinate calculations
Otherwise rounding errors fool the "tab under coordinates" checks on
crossing events, which will be triggered close enough to the window
rectangle if the pointer moves slowly enough.

With this, the tab_prelight() function correctly figures out we've
moved the pointer outside the tab area when called in
gtk_notebook_leave_notify().

https://bugzilla.gnome.org/show_bug.cgi?id=759091
2015-12-07 17:40:01 +01:00
Matthias Clasen
4faef48410 notebook: Chain up in direction_changed
We do this everywhere else.
2015-11-13 06:41:14 -05:00
Matthias Clasen
c283315466 notebook: Update CSS docs
The .header style class is no longer used.
2015-11-09 13:33:58 -05:00
Matthias Clasen
4802b515e4 notebook: Use CSS nodes for arrows
This converts the drawing of scroll arrows to use separate CSS
nodes.
2015-11-08 21:08:38 -05:00
Matthias Clasen
5686853c6e notebook: redo notebook styling
Add a header node, and put positional classes on it.
2015-11-08 21:08:38 -05:00
Benjamin Otte
e5ef7dc681 notebook: Fix copy/paste error
This is from the recent commit 2a1a483ede
2015-11-07 03:29:44 +01:00
Benjamin Otte
2a1a483ede notebook: Query the right node's padding 2015-11-06 18:59:15 +01:00
Matthias Clasen
e440050134 Fix the build 2015-10-24 17:04:38 -04:00
Matthias Clasen
f1b7560938 notebook: Document css nodes and style class
This will have to be updates as we do further changes to the
way GtkNotebook does its rendering.
2015-10-24 10:54:56 -04:00
Matthias Clasen
8917ee5373 notebook: Drop unneeded code
We no longer need to set the position classes on the main css node,
since they are already set on the per-tab subnodes.
2015-10-24 10:39:18 -04:00
Matthias Clasen
f194b9608a notebook: Use the element name notebook
Switch GtkNotebook from using the .notebook style class to
using the element name notebook for its main css node.
2015-10-24 10:39:18 -04:00
Matthias Clasen
e2bfe9e95a notebook: Cosmetic cleanup 2015-10-24 10:39:17 -04:00
Benjamin Otte
6cf7c03334 notebook: On drag window hide, fix css nodes 2015-10-22 20:29:10 +02:00
Benjamin Otte
ed574408f2 notebook: Remove "prelight-page" class
Instead, just use the "tab:hover" selector
2015-10-22 16:42:48 +02:00
Benjamin Otte
182f9a7f39 notebook: Remove "active-page" class
Instead, just use the "tab:active" selector
2015-10-22 16:42:48 +02:00
Benjamin Otte
2720d97db3 notebook: Remove funciton by folding it into callers 2015-10-22 16:42:48 +02:00
Benjamin Otte
acd63a6019 notebook: Refactor internal function
Don't return the state anymore as the function doesn't even look at the
state. Instead, make the callers that need the state query it manually.
2015-10-22 16:42:48 +02:00
Benjamin Otte
7b9844288a notebook: Make tab positions permanent
... on the tab CssNodes.
2015-10-22 16:42:48 +02:00