Commit Graph

662 Commits

Author SHA1 Message Date
Benjamin Otte
ef1ba12037 notebook: Use gtk_widget_queue_draw() 2016-10-27 05:07:23 +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
b88a0bb682 notebook: Remove deprecated public API 2016-10-18 00:29:16 +02:00
Benjamin Otte
c78568b4dd notebook: Use gdk_window_new_child() and gdk_window_new_input() 2016-10-18 00:22:35 +02:00
Emmanuele Bassi
6a9be60a16 notebook: Remove redundant variable declarations
We're already declaring notebook and priv at the top of the function,
and assigning them to the same values.
2016-10-17 11:44:11 +01: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
Timm Bäder
999d45b4e8 Remove various unused style properties 2016-10-16 18:17:21 +02:00
Timm Bäder
601839c825 Remove various sizing related style properties 2016-10-16 18:17:21 +02:00
Benjamin Otte
eace2cf421 API: Remove gdk_window_set_background()
Backgrounds are always transparent black.
2016-10-16 18:17:21 +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
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
Matthias Clasen
ae636ba0c2 notebook: Update arrow state when switching pages
Otherwise, we may end up showing clickable arrows that don't
do anything.

https://bugzilla.gnome.org/show_bug.cgi?id=770332
2016-08-24 14:10:35 -04:00
William Hua
8701e34f74 port to new gtk_menu_popup_at_* () functions
https://bugzilla.gnome.org/show_bug.cgi?id=756579
2016-07-19 09:38:54 -04:00
Matthias Clasen
ca43f6ee28 notebook: Free gadgets in finalize
This is the right place for this.
2016-06-05 20:00:43 -04:00
Carlos Soriano
ddb0740a21 gtknotebook: avoid tab dnd from content
Before commit 6c1bee2377 we were setting an attribute of GtkNotebook
to track the pressed button if the pressed button happened on the
tab itself.
Later in the motion handling code we were checking whether the private
pressed button attribute was set or not in order to handle a tab dnd
or not.

In commit 6c1bee2377 the code changed and set the pressed button
variable unconditionally, which means, a motion event from within the
tab content triggered a tab reordering.

This happened only if the children hierarchy have a widget that bubbles
up both button press event, which sets the private pressed button
attribute; and motion events, which started the tab dnd checking the
private pressed button attribute.
A widget that experienced the regression was GtkListBox.

In order to fix it, set the button pressed variable only when it press
the tab itself, not the content.

https://bugzilla.gnome.org/show_bug.cgi?id=764395
2016-05-02 13:17:48 +02:00
Matthias Clasen
2148708917 box gadget: Redo expand flag handling
We only keep one align flag per child, so it seems odd to
keep separate h/v expand flags. Just keep one expand flag
and interpret it according to orientation. Allow setting
the expand flag for child widgets too, though, so we can
make widget expand without interfering with the recursive
widget expand flag.

Update all callers.

Use the new possibility of expanding child widgets to make
the label of check and radio buttons expand. This fixes
unexpected behavior of these widgets in RTL in some places.

https://bugzilla.gnome.org/show_bug.cgi?id=765742
2016-04-28 21:59:34 -04:00
Carlos Garnacho
160a4fe5ac GtkNotebook: Make tab DnD use application/x-rootwindow-drop again
Besides the ::drag-failed handling in order to trigger the window creation
hook, add some handling of the application/x-rootwindow-drop mimetype, so
the same effect is achieved if the tab could be dropped in a destination
accepting this mimetype.

https://bugzilla.gnome.org/show_bug.cgi?id=763387
2016-03-14 16:16:32 +01:00
Benjamin Otte
61f5562f9f notebook: Tell everyone we reordered stuff
Fixes keybindings for reordering actually emitting signals and properly
updating CSS/the screen.
2016-02-29 23:17:00 +01:00
Benjamin Otte
a74bb0dec4 notebook: Reallocate tab gadgets when we reorder them
Otherwise they stay in their position and don't cause a redraw. Which
really confuses Epiphany users apparently.

https://bugzilla.gnome.org/show_bug.cgi?id=762720
2016-02-29 22:00:03 +01:00
Benjamin Otte
245d217e06 boxgadget: Add ability to draw children in reverse
This is necessary for GtkNotebook so that the stack is always drawn
before the header.
And that is necessary so that the active tab can use negative
margins to overdraw the border of the stack to create a gap and
simulate old GTK2-style visuals for notebooks.
2016-02-27 03:59:20 +01:00
Benjamin Otte
cdb1cda68b notebook: The active tab is now :checked
:active is reserved for "mouse button down on node", so we have to use
something else. And stack switcher and radio buttons use :checked for
the active widget, so it makes sense to use :checked for the active tab,
too.

Themes have been adapted.

TODO: Implement :active for tabs.
2016-02-27 03:48:46 +01:00
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