Commit Graph

583 Commits

Author SHA1 Message Date
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
Benjamin Otte
dd3f2ec987 notebook: Remove last traces of regions
Now that we don't use regions anymore, there's no need to update
anything when the regions change.
2015-10-22 16:42:47 +02:00
Benjamin Otte
f713bcd742 notebook: Set reorderable-page style class properly
Set it when the reorderable state changes, not just when rendering.
2015-10-22 16:42:47 +02:00
Benjamin Otte
a4e86341e4 notebook: Set active state properly
Don't update it on save/restore, actually set it when it changes.
2015-10-22 16:42:47 +02:00
Benjamin Otte
541926089a notebook: Set prelight state properly
Don't update it on save/restore, actually set it when it changes.
2015-10-22 16:42:47 +02:00
Benjamin Otte
3392d53f61 notebook: Use CssNodes instead of regions
This almost makes CSS work again with notebooks.
2015-10-22 16:42:47 +02:00
Benjamin Otte
01f7711307 notebook: Move style_context_save() into function
This is for future changes.
2015-10-22 16:42:47 +02:00
Alexander Larsson
d5f1754981 gtk: Stop setting GDK_EXPOSURE_MASK on random widgets
These days exposure happens only on the native windows (generally the
toplevel window) and is propagated down recursively. The expose event
is only useful for backwards compat, and in fact, for double buffered
widgets we totally ignore the event (and non-double buffering breaks
on wayland).

So, by not setting the mask we avoid emitting these events and then
later ignoring them.

We still keep it on eventbox, fixed and layout as these are used
in weird ways that want backwards compat.
2015-09-14 11:01:13 +02:00
Matthias Clasen
f4b53d4b0c notebook: Drop use of G_DISABLE_CHECKS
Rewrite the one check that the G_DISABLE_CHECKS macro was used for
in terms of g_return_if_fail.
2015-09-09 06:32:46 -04:00
Matthias Clasen
838d5beff7 notebook: Convert to g_object_notify_by_pspec 2015-09-08 08:07:33 -04:00
Benjamin Otte
4daac59941 notebook: Don't needlessly cast in macros
That way we disable typechecks done by the compiler and won't notice
when we pass the wrong values to the macro. And that's bad.
2015-09-07 14:33:50 +02:00
Benjamin Otte
f138efa59a notebook: Remove unused macros 2015-09-07 14:33:40 +02:00
Carlos Garnacho
3e60650fa8 notebook: Fix assert in ::drag-motion
The drag destination might be empty, we shouldn't be checking whether
it contains pages at all. Instead, check the source notebook, which
ought to have a selected page if you're dragging something from there.

https://bugzilla.gnome.org/show_bug.cgi?id=749893
2015-05-26 18:05:36 +02:00
Benjamin Otte
0529e15d61 notebook: Protect against invalid allocations
A widget can be mapped but not have a size allocated yet. In that case
avoid computing a broken rectangle.

https://bugzilla.gnome.org/show_bug.cgi?id=746301
2015-03-18 15:14:47 +01:00
Matthias Clasen
c7672699e9 Don't pass invalid rectangles to cairo
This causes pixman warnings, or worse.
Clearly, something is not quite right here, if we end up
redrawing tabs at a time when the allocation is set to (1, 1).
For now, avoid straining the error handling in the lower layers.

https://bugzilla.gnome.org/show_bug.cgi?id=746301
2015-03-16 12:51:56 -04:00
Philip Withnall
d65ccf96ee gtknotebook: Add more non-NULL checks for cur_page
These were not spotted by scan-build, but from some brief mental
reasoning could potentially be problem areas.

https://bugzilla.gnome.org/show_bug.cgi?id=712760
2015-03-11 11:24:29 +00:00
Benjamin Otte
9e2cdce58e notebook: Fix boolean check
Commit c352093bde swapped the condition
when turning it into a return_if_fail().
2015-03-10 13:23:06 +01:00
Philip Withnall
c352093bde gtknotebook: Fix potential use of uninitialised variables
Found by scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=712760
2015-03-10 07:32:19 +00:00
Philip Withnall
51971d56bc gtknotebook: Remove dead variable assignments
Found by scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=712760
2015-03-09 13:41:37 +00:00
Philip Withnall
c7f5f10853 gtknotebook: Fix a potential NULL pointer dereference
Found by scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=712760
2015-03-09 13:41:37 +00:00
Matthias Clasen
8d7a235a04 notebook: Add api to complete tab dnd from the outside
This is necessary to avoid unwanted drag cancel animations,
now that GtkNotebook is careful about cancelling a drag
when the dragged tab disappears unexpectedly.
2015-02-12 17:33:10 -05:00
Matthias Clasen
3fc21b4f3f notebook: Protect removal-from-within
When a tab is dropped, we have to remove it from the notebook to
insert it elsewhere. This is expected part of the tab dnd operation,
and we need to differentiate it from 'spontaneous' removals which
cause us to cancel the drag operation.
2015-01-30 10:13:28 -05:00
Matthias Clasen
63104944a3 notebook: Make dnd safe against tab disappearance
when the dragged tab is being removed during the drag operation,
we need to cancel the drag. To do so, we have to keep around
a reference to the drag context.

This should fix
https://bugzilla.gnome.org/show_bug.cgi?id=732051
2015-01-30 10:13:15 -05:00
Matthias Clasen
3a05d9b5a0 notebook: Make reordering safe for tab disappearance
If the dragged tab is removed during reordering, we need to
call gtk_notebook_stop_reorder(), to clean up and bring the
remaining tabs back in order.
2015-01-30 09:39:26 -05:00
Matthias Clasen
5127136723 GtkNotebook: Be a bit more safe against cur_page being NULL
https://bugzilla.gnome.org/show_bug.cgi?id=477454
2014-12-22 10:52:54 -05:00
Jasper St. Pierre
a78b18c565 Revert part of "gtknotebook: Optimize GtkStyleContext usage"
This reverts part of commit c71e213134.
This part was unfinished and was pushed simply to avoid the warnings.
2014-11-25 11:21:21 -08:00
Jasper St. Pierre
c71e213134 gtknotebook: Optimize GtkStyleContext usage 2014-11-25 11:05:49 -08:00
Benjamin Otte
cde81e169b notebook: Don't unset state flags on child removal
We don't set any state flags, so we shouldn't unset any either.
2014-07-19 23:48:06 +02:00