Commit Graph

104 Commits

Author SHA1 Message Date
Timm Bäder
93df23d962 Remove some more gtk_widget_get_content_size uses 2017-12-04 12:42:52 +01:00
Benjamin Otte
9a6ec4e959 contentformats: Rename GtkTargetList
It's now called GdkContentsFormat
2017-11-20 23:12:33 +01:00
Benjamin Otte
c863ac0f90 dnd: Remove GtkTargetEntry and GtkTargetFlags
warning: We don't do any same-app checks anymore so you currently can
copy local data into external apps.

This will be fixed later.
2017-11-20 23:12:33 +01:00
Matthias Clasen
ffd6baec42 gtk: Intern css names
This avoids a bunch of strdups at startup.
2017-11-17 22:49:57 -05:00
Benjamin Otte
3f5178dc21 selection: Remove the info uint
Instead of allowing people to pass a uint user-data, insist on them
comparing mime types.

The user data was a uint instead of a pointer anyway, so uniqueness
could not be guaranteed and it caused more issues than it was worth.
And that's ignoring the fact that it basically wasn't used.
2017-11-16 22:59:43 +01:00
Matthias Clasen
dbfaa99107 image: Remove icon-size argument from icon setters
Instead, add a function gtk_image_set_icon_size() for the cases where
overriding the icon size is necessary.

Treat icon sizes the same way as pixel sizes, too. So gtk_image_clear()
no longer unsets the icon size.
2017-11-15 14:22:17 -05:00
Benjamin Otte
5a1a11bcde dnd: Make GtkDragDest and GtkDragSource use GtkTargetList
This gets rid of GtkTargetEntry in the API and consistently uses
GtkTargetList.
2017-11-15 19:07:17 +01:00
Carlos Garnacho
7d196db4c0 gtkcolorswatch: Remove enter/leave event handlers
Those just maintained prelight state, which is already managed internally.
2017-09-19 18:40:50 +02:00
Carlos Garnacho
df4b0340a6 colorswatch: Update to using GdkEvent API 2017-09-19 18:39:02 +02:00
Timm Bäder
9f3f640c0d widget: Remove gtk_widget_get_border_allocation 2017-08-14 12:22:39 +02:00
Timm Bäder
36ab70ddf5 widget: Add baseline and out_clip parameters to size-allocate
Since setting a clip is mandatory for almost all widgets, we can as well
change the size-allocate signature to include a out_clip parameter, just
like GtkCssGadget did. And since we now always propagate baselines, we
might as well pass that one on to size-allocate.

This way we can also make sure to transform the clip returned from
size-allocate to parent-coordinates, i.e. the same coordinate space
priv->allocation is in.
2017-07-19 21:27:16 -04:00
Timm Bäder
3dc6d240b3 Fix a few allocation coordinates & sizes 2017-07-19 21:27:15 -04:00
Timm Bäder
d5167eb61c colorswatch: Replace IconHelper with GtkImage 2017-07-19 21:27:13 -04:00
Timm Bäder
7f965a04ea colorswatch: Remove gadget usage 2017-07-19 21:27:11 -04:00
Carlos Garnacho
de3e20107a gtkcolorswatch: Remove input window
It's not necessary to receive events anymore.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
a72404dd5a gtk: Mass delete all GtkWidget event mask API
We now rely on toplevels receiving and forwarding all the events
the windowing should be able to handle. Event masks are no longer a
way to determine whether an event is deliverable ot a widget.

Events will always be delivered in the three captured/target/bubbled
phases, widgets can now just attach GtkEventControllers and let those
handle the events.
2017-05-25 16:25:58 +02:00
Timm Bäder
ea897c6df4 Remove gtk_widget_show_all 2017-01-20 21:37:04 +01:00
Benjamin Otte
6055028c96 snapshot: Rename append APIs
Instead of having gtk_snapshot_append_foo_node(), just have
gtk_snapshot_append_foo(). Nobody needs to know that this internally
uses nodes.
2017-01-13 04:46:09 +01:00
Benjamin Otte
b58de2d16c snapshot: Redo pop() API
gtk_snapshot_pop() => removed
gtk_snapshot_pop_and_append() => gtk_snapshot_pop()

So now there is no way to get a rendernode out of the snapshotting API
until you gtk_snapshot_finish().
2017-01-13 03:38:36 +01:00
Benjamin Otte
0dbdf0c428 gadget: Remove gtk_css_gadget_draw()
And with it, remove the draw func from custom gadgets, that has been
NULL everywhere.

All gadgets are snapshot now.
2016-12-20 18:01:12 +01:00
Benjamin Otte
613194a246 colorswatch: Implement snapshot 2016-12-20 18:01:12 +01:00
Benjamin Otte
4d9eedafcd roundedbox: Add gtk_rounded_boxes_init_for_style()
Instead of making people intiialize a rectangle and then applying border
radius manually, provide a constructor that does it for them.
While doing that, also allow people to instead request the padding box
or the content box.

Refactor all relevant code to use this new constructor.
2016-12-20 18:01:12 +01:00
Benjamin Otte
da207c9fdd snapshot: Add a snapshot function to GtkCssCustomGadget 2016-11-15 17:48:45 +01:00
Benjamin Otte
0508526658 colorswatch: Readd accidentally removed call 2016-11-03 01:15:08 +01:00
Benjamin Otte
32a5729d18 gtk: Chain up in realize()
... instead of copy/paste from gtk_widget_real_realize.
2016-11-02 07:16:08 +01: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
Benjamin Otte
0f2d983ea9 colorswatch: Use gdk_window_new_input() 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
Timm Bäder
a985e62b25 Use gtk_popover_popdown/popup where appropriate
https://bugzilla.gnome.org/show_bug.cgi?id=769706
2016-08-16 11:49:26 -04:00
Matthias Clasen
bbd94b5a9f gtk: Strip newlines from g_warning and g_error
g_logv adds one for us already.
2016-02-28 12:23:12 -05:00
Timm Bäder
2929621d05 colorswatch: Remove unused constant 2016-02-04 13:32:34 +01:00
Matthias Clasen
1f65f1b746 color swatch: Use right allocation for window
Generally, input-only windows that correspond to CSS boxes
should be sized to the border allocation of the gadget.
2016-01-13 14:00:10 -05:00
Matthias Clasen
ea4cff1ea4 Use convenience API that was introduced recently
Use gtk_css_gadget_set_state in all the places where we previously
were getting a node from a gadget, just to call gtk_css_node_set_state.
2016-01-13 00:19:31 -05:00
Cosimo Cecchi
f2685ddf5e colorswatch: don't apply padding twice
Instead of taking the border and manually removing it from the
allocation, render our background over all the border allocation box, as
that's more correct and does not take padding into account twice.
2016-01-08 14:58:25 -08:00
Matthias Clasen
5b3001b6d5 colorswatch: Fix the overlay
I misunderstood what the overlay is good for: We need to allocate
it the full size of the widget. since we are using it to render
a background gradient *over* the application-rendered color.

At the same time, save some 100 lines of code by using an icon
helper as gadget, instead of handling the icon manually.
2016-01-07 19:20:55 -05:00
Matthias Clasen
1b3bb244b6 color swatch: Fix up rendering
gtk_render_content_path is expecting the full box dimensions,
not just the content area. So, add the border before calling it.

Note it is still possible to have some separation between the
color and the border, by setting padding.
2016-01-07 18:38:31 -05:00
Matthias Clasen
8ecba89991 color swatch: Remove a stray frame
When using a gadget, the border is free, no need to call
gtk_render_frame ourselves.
2016-01-07 14:08:26 -05:00
Matthias Clasen
c376e82702 colorswatch: Convert to gadgets
Use gadgets for the widget and the overlay.
2015-12-15 08:41:16 -05:00
Benjamin Otte
3513e5e87b Chain up in state_flags_changed
When introducing handlers for state_flags_changed in the node
transitions, chaining up was forgotten.
2015-12-02 04:36:31 +01:00
Timm Bäder
c28be30ac1 colorswatch: Don't pass _GENERIC_FALLBACK to API that doesn't support it 2015-11-09 17:13:19 +01:00
Matthias Clasen
dfedda3dee color editor: Redo the non-activatable color swatch
Use a .activatable style class on the color swatch and tie the
hover effect to it. The color editor simply removes this class
now to get an inert color swatch.

This is more flexible and lets us avoid referring to the
GtkColorEditor type in the theme.
2015-10-30 22:19:07 -04:00
Matthias Clasen
5ec9b330b3 swatch fixup 2015-10-30 21:43:50 -04:00
Matthias Clasen
e5d3c8dbae color swatch: Convert to CSS nodes
Convert GtkColorSwatch to use the two elements colorswatch and
image.
2015-10-30 21:29:46 -04:00
Matthias Clasen
d3475f7a72 color chooser: Render icons sharp at scale 2
We need to load the icons at the right scale, and render them
to a surface with the right scale too.

https://bugzilla.gnome.org/show_bug.cgi?id=756195
2015-10-07 23:19:32 -04:00
Matthias Clasen
66f0bdee0a Intern all signal names beforehand
This avoids pointless allocations
2015-09-12 12:50:39 -04:00
Matthias Clasen
e34ab3561f color chooser: Use a popover for the context menu
It works just as well here as it does in the file chooser, and
this lets us unify the right-click and long-press behavior a bit.
We used to switch directly to the editor on long-press, now we
can show the popover, just as we do on right-click.
2015-08-04 22:59:58 -04:00
Matthias Clasen
98a3fac6ab Add a way to avoid menu on color swatches 2015-06-13 21:56:41 -04:00
Matthias Clasen
e1ff15549b GtkColorSwatch: Avoid style context underflow
The last change accidentally removed the later restore, and
left the earlier, so we ended up with a restore-save sequence.
Thankfully, GtkStyleContext warns about this.
2014-10-12 18:15:23 -04:00
Benjamin Otte
0a31609201 colorswatch: Remove unneeded save/restore
for both style context and cairo context.
2014-10-12 04:16:44 +02:00
Benjamin Otte
e82093fc14 colorswatch: Use a better name for the overlay
Name it .overlay and not .image
2014-10-08 13:20:03 +02:00