Commit Graph

257 Commits

Author SHA1 Message Date
Benjamin Otte
fc2ce5a925 gdk: Make GdkContentFormats immutable 2017-11-20 23:13:10 +01:00
Benjamin Otte
9a6ec4e959 contentformats: Rename GtkTargetList
It's now called GdkContentsFormat
2017-11-20 23:12:33 +01:00
Matthias Clasen
a8531605db Some more interning
This avoids more strdups at startup.
2017-11-18 08:18:11 -05: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
Benjamin Otte
4c4e914806 gdk: Replace GDK_NONE with NULL 2017-11-15 19:07:17 +01: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
Benjamin Otte
723bf44887 calendar: Fix for GTK4 changes 2017-11-10 14:56:42 +01:00
Benjamin Otte
43c212ac28 build: Enable -Wswitch-enum and -Wswitch-default
This patch makes that work using 1 of 2 options:

1. Add all missing enums to the switch statement
  or
2. Cast the switch argument to a uint to avoid having to do that (mostly
   for GdkEventType).

I even found a bug while doing that: clearing a GtkImage with a surface
did not notify thae surface property.

The reason for enabling this flag even though it is tedious at times is
that it is very useful when adding values to an enum, because it makes
GTK immediately warn about all the switch statements where this enum is
relevant.
And I expect changes to enums to be frequent during the GTK4 development
cycle.
2017-10-06 21:23:39 +02:00
Carlos Garnacho
b31029457b gtkcalendar: Use scroll event controller 2017-09-19 18:40:50 +02:00
Carlos Garnacho
ff187eeb17 calendar: Update to using GdkEvent API 2017-09-19 18:39:02 +02:00
Timm Bäder
054df8e6ec calendar: Stop using ::button-{press,release}-event 2017-09-13 17:37:25 +02:00
Daniel Boles
881d7c6442 Calendar: Add default case to appease Coverity
CID 1432024 (#1 of 1): Uninitialized scalar variable (UNINIT)
2. uninit_use_in_call: Using uninitialized value rect.x when calling
calendar_arrow_rectangle.

Add a default case to the switch which will bail out with
g_assert_not_reached(), which should reassure Coverity that the method
is always called with a valid value that is handled in the switch.
2017-08-01 20:15:14 +01: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
f520700b13 calendar: Remove all input windows
and simultaneously fix input! \o/
2017-07-19 21:27:15 -04:00
Timm Bäder
61dd8f92b8 calendar: Remove style properties
Hardcode the default values until someone comes and fixes the actual
widget.
2017-07-19 21:27:14 -04:00
Timm Bäder
55fc120134 calendar: Remove custom css background and border drawing 2017-07-19 21:27:12 -04:00
Timm Bäder
60e053f52a Remove calls to gtk_widget_set_allocation
gtk_widget_size_allocate_with_baselines does it automatically now.
2017-07-19 21:27:12 -04:00
Timm Bäder
2cd1a984cf set clip of more widgets 2017-07-19 21:27:11 -04: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
53f0c2626e calendar: Fix else branch indentations 2017-03-18 07:07:06 +01:00
Benjamin Otte
87497ca2e1 snapshot: Rename gtk_snapshot_translate_2d()
It's now called gtk_snapshot_offset().
2017-01-13 14:37:48 +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
6cc08d60ef calendar: Implement snapshot() 2016-12-23 12:07:22 +01:00
Benjamin Otte
4850271ae8 API: Remove gtk_cairo_should_draw_window()
The answer is: Yes.
2016-11-23 18:48:38 +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
4b92c0bb88 calendar: Use gdk_window_new_input() 2016-10-18 00:22:35 +02:00
Benjamin Otte
1518fe0a8f API: stylecontext: Remove state argument from getters
The argument must always be the current state.
2016-10-16 18:18:58 +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
6ac7b54378 dnd: Move GtkDragDest to a separate file
This follows what was done for GtkDragSource in
415030d25f and shaves another
500 lines off gtkdnd.c.
2016-03-25 15:37:20 -04:00
Benjamin Otte
c76424a842 calendar: Remove duplicate flags value
http://www.viva64.com/en/b/0383/
2016-03-20 05:27:19 +01:00
Matthias Clasen
ab5ebf6199 calendar: Fix drag highlight problems
Don't propagate :drop(active) to components.
2016-03-11 08:34:01 -05: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
2182fe7d9d Don't pass widget state flags to GtkStyleContext API 2015-11-22 17:11:35 +01:00
Matthias Clasen
2c2fd5c8c5 calendar: Add an element name
This will allow us to drop hardcoded type names in the theme.
2015-10-28 06:35:33 -04: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
b9bced693a Remove some unused data 2015-08-09 23:39:14 +02:00
Emmanuele Bassi
b46fdb2d13 calendar: Handle invalid dates
GtkCalendar can have an invalid date — mostly at initialization. This
means that GDateTime construction may fail. We need to handle that case
gracefully, like the old code did.

This fixes the `notify` test suite, which started failing with:

/Notification/GtkCalendar:
GLib-CRITICAL **: g_date_time_get_day_of_week: assertion 'datetime != NULL' failed

inside the Continuous builder.
2015-01-02 23:15:55 +00:00
Matthias Clasen
d216d89d6f GtkCalendar: Slightly change overflow behaviour
If the first of the month was falling on a Sunday, we would not
render any days of the previous month, and instead show two weeks
of the next month at the bottom. Improve this by showing one week
of each.

https://bugzilla.gnome.org/show_bug.cgi?id=301835
2014-12-23 21:49:21 -05:00
Matthias Clasen
6ae93f5c46 GtkCalendar: Use GDateTime for calculations
Instead of old copy-paste code, use GDateTime to determine week
numbers and days of week.
2014-12-23 20:28:49 -05:00
Benjamin Otte
d3c147a62d stylecontext: Split render functions out into gtkrender.[ch] 2014-10-03 06:18:05 +02:00
Matthias Clasen
7b2e526c3a GtkCalendar: deal better with a large allocation
When allocated more than the requested height, GtkCalendar
was 'falling apart'. Not only was the main part rendered
at the far end of the allocation, clicking on days was
broken in this scenario.

Fix this by always placing the main part directly under
the header and day names.

https://bugzilla.gnome.org/show_bug.cgi?id=737670
2014-10-01 20:09:10 -04:00
Matthias Clasen
b46cef1809 Trivial formatting fix 2014-10-01 19:52:04 -04:00
Matthias Clasen
09551bf37a Fix a typo 2014-10-01 19:30:12 -04:00
Matthias Clasen
d5c56ea780 GtkCalendar: Use G_PARAM_EXPLICIT_NOTIFY
And make sure we correctly notify for all properties.
2014-06-09 13:30:53 -04:00
Matthias Clasen
53b37b8f71 Fix GtkCalendar drawing
A gtk_widget_get_allocation call was unintentionally
dropped in 5cb43c70f7.
2014-05-14 20:38:55 -04:00
Cosimo Cecchi
0ff3f16da1 calendar: don't use focus-line-width 2014-05-09 11:02:44 -07:00
Cosimo Cecchi
5cb43c70f7 calendar: simplify code
Always use the newly introduced get_component_paddings() instead of
doing the work manually every time.
2014-05-09 11:02:44 -07:00
Cosimo Cecchi
1e66a7ccdb calendar: use CSS paddings instead of focus pad for day/week areas
focus-padding is going away.
2014-05-09 11:02:44 -07:00
Carlos Garnacho
efb4f2db50 calendar: grab focus first, emit signals after
It may be unusual, but handlers of day-selected may want to transfer
focus somewhere else, without getting it reset back right after by/to
the calendar. This makes popovers demo work on the calendar again, for
one...
2014-03-07 02:50:27 +01:00