Matthias Clasen
cb43af090b
notebook: Fix a misplaced tab label
...
Sometimes default tab labels ("Page <n>") get created on-demand,
and in that case, we were forgetting to put them below the tab
node in the CSS node tree. The visible result of this is that the
heuristics for when to give notebooks background in Adwaita fail
in some cases. So, make sure to always place the label below the
tab node.
2016-02-15 10:38:13 -05:00
Matthias Clasen
bb15c53966
notebook: fix arrow states
...
Some code was confusing 0 with ARROW_NONE, causing us to not properly
update the state of the arrow gadgets.
2016-02-11 06:47:28 -05:00
Timm Bäder
c5369356e8
Various documentation fixes
...
Always have Since: annotations at the very bottom, use the correct
ClassName::signal-name/ClassName:property-name syntax, fix a few typos
in type names, wrong function names, non-existing type names, etc.
2016-02-08 22:56:52 +01:00
Carlos Garcia Campos
feabf35371
notebook: Do not reorder tabs after a grab notify if there isn't an ongoing reorder operation
...
This broke in f535251507
that removed
during_reorder in favor of using the current operation, but removed the
check from gtk_notebook_stop_reorder().
2016-02-02 19:02:53 +01:00
Matthias Clasen
2cf983eb30
notebook: Document CSS node order
2016-01-22 23:14:09 -05:00
Carlos Garnacho
6c1bee2377
GtkNotebook: Unify two private variables
...
Button state was being kept in two separate variables, which lead
to slight confusions in DnD that caused the notebook to ignore the
first click after DnD happened from (within) it. Unify these two
into one, which helps us keep better track of the really pressed
buttons.
2016-01-20 19:57:23 +01:00
Benjamin Otte
f535251507
notebook: Get rid of during_reorder variable
...
Use operation == OPERATION_REORDER instead.
2016-01-20 17:37:37 +01:00
Benjamin Otte
c162a0cca8
notebook: Properly hide drag window
...
Move code to properly reinsert the tab label to where it belongs.
The if has the distinction between reparented-to-dnd-window and
just-changed-the-gdk-window-to-draw-to right there.
https://bugzilla.gnome.org/show_bug.cgi?id=760754
2016-01-20 17:37:37 +01:00
Benjamin Otte
099662998a
notebook: Get rid of during_detach member
...
use operation == OPERATION_DETACH instead.
2016-01-20 17:37:37 +01:00
Matthias Clasen
bb92428112
notebook: Implement rtl flipping for CSS nodes
...
Use gtk_box_gadget_reverse_children and gtk_css_node_reverse_children
to flip the children of the header_gadget and the tabs_gadget when
appropriate.
Add new CSS node tests to verify that the node order is updated
as expected in all cases.
2016-01-19 21:40:47 -05:00
Benjamin Otte
3281d1a284
notebook: Don't crash when dnd'ing tabs out
...
https://bugzilla.gnome.org/show_bug.cgi?id=760754
2016-01-18 15:39:02 +01:00
Matthias Clasen
44d94a4aeb
Trivial formatting fix
2016-01-17 15:35:14 -05:00
Matthias Clasen
6bf9715ce4
notebook: show tabs when asked to
...
gtk_notebook_set_show_tabs must make the header gadget
visible when show_tabs is TRUE, not the other way around.
https://bugzilla.gnome.org/show_bug.cgi?id=760596
2016-01-17 14:35:58 -05:00
Benjamin Otte
6e4d65d227
notebook: Destroy gadgets after chaining up
...
While chaining up, we might still call into the notebook code. And that
code expects the gadgets to be there.
https://bugzilla.gnome.org/show_bug.cgi?id=760640
2016-01-15 16:22:22 +01:00
Matthias Clasen
87171469b7
box gadget: Implement cross-axis alignment
...
So far, the box gadget is always allocating all children the
full size in the cross axis. This behavior corresponds to the
align-items: stretch behavior in
https://www.w3.org/TR/css-flexbox-1/#align-items-property
This commit implements the other modes described there.
While widgets have halign/valign properties that we can use for
this, the API for inserting gadgets has to change to take an
extra align parameter. All callers have been updated to pass
GTK_ALIGN_FILL, since that corresponds to the previous behavior.
https://bugzilla.gnome.org/show_bug.cgi?id=760668
2016-01-15 09:43:12 -05:00
Cosimo Cecchi
897126ae2b
notebook: fix a GCC warning
2016-01-13 08:30:02 -08:00
Matthias Clasen
93aac8a86c
notebook: Document the .dnd style class
...
We should aim to document all style classes that themes
can encounter during the normal operation of a widget.
2016-01-13 00:24:40 -05:00
Ben Iofel
7e5952c4ea
GTK Notebook: use the right enum type
2016-01-11 19:16:36 -05:00
Matthias Clasen
32eda187ee
Actually deprecate GtkNotebook::has-tab-gap
2016-01-11 13:58:37 -05:00
Matthias Clasen
990be25d63
notebook: Update CSS node docs
...
The stack node is new.
2016-01-11 13:55:23 -05:00
Benjamin Otte
3a8dc01ed2
notebook: Don't reparent tab label when drag stops
...
Use the same unrealize + set_parent_window() trick that we used in
6d5edd18cf
when dragging starts.
2016-01-11 17:52:38 +01:00
Benjamin Otte
b917a0b155
notebook: Add .dnd style class to tabs during reorder
2016-01-11 17:46:15 +01:00
Benjamin Otte
6d5edd18cf
notebook: Don't unparent tab label for drag
...
When a tab drag starts, we need to move the tab label into the drag
window via gtk_widget_set_parent_window().
If we don't unparent, but just unrealize the widget, we don't lose the
cssnode position.
2016-01-11 17:06:46 +01:00
Benjamin Otte
fdc13f315b
notebook: Don't limit motion notify framerate
...
We have a frameclock for that these days.
In particular, this limiting worked at 45fps when monitors are all 60fps.
2016-01-11 17:06:46 +01:00
Benjamin Otte
8020d5f93a
notebook: Don't store gadget allocation twice
...
If we care about a gadget's allocation, we can ask it. There's no need
to store it in GtkNotebookPage.allocation.
2016-01-11 17:05:24 +01:00
Benjamin Otte
2ef3b01442
notebook: No need to recompute remaining space
...
The value is correct.
In particular, subtracting width on notebooks with tabs on left/right is
a very bad idea.
2016-01-11 17:05:24 +01:00
Benjamin Otte
4c083f8182
notebook: Port arrows to be gadgets
...
Also deprecate the arrow-spacing style property.
2016-01-11 17:05:24 +01:00
Benjamin Otte
326fda1b0e
notebook: Pass full allocation instead of min and max value
2016-01-11 17:05:24 +01:00
Benjamin Otte
96f0cf7677
notebook: Pass allocation as argument
...
... instead of querying it later.
2016-01-11 17:05:23 +01:00
Benjamin Otte
6b8c191096
notebook: Simplify allocation code
2016-01-11 17:05:23 +01:00
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