summaryrefslogtreecommitdiff
path: root/gtk/gtkwidget.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2017-10-06 21:19:42 +0200
committerBenjamin Otte <otte@redhat.com>2017-10-06 21:23:39 +0200
commit43c212ac28f5f80e10c49590e569b6450098743f (patch)
treeae5210d90f79d313d3b4c88c88f5e00b87405e0e /gtk/gtkwidget.c
parent2ac66328a3edc0838c19b49fcb9468c473936c9c (diff)
downloadgtk+-43c212ac28f5f80e10c49590e569b6450098743f.tar.gz
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.
Diffstat (limited to 'gtk/gtkwidget.c')
-rw-r--r--gtk/gtkwidget.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 3b425cb22a..51e39c3555 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -5777,6 +5777,9 @@ effective_align (GtkAlign align,
return direction == GTK_TEXT_DIR_RTL ? GTK_ALIGN_END : GTK_ALIGN_START;
case GTK_ALIGN_END:
return direction == GTK_TEXT_DIR_RTL ? GTK_ALIGN_START : GTK_ALIGN_END;
+ case GTK_ALIGN_FILL:
+ case GTK_ALIGN_CENTER:
+ case GTK_ALIGN_BASELINE:
default:
return align;
}
@@ -5792,6 +5795,7 @@ adjust_for_align (GtkAlign align,
{
case GTK_ALIGN_BASELINE:
case GTK_ALIGN_FILL:
+ default:
/* change nothing */
break;
case GTK_ALIGN_START:
@@ -6695,7 +6699,7 @@ event_window_is_still_viewable (const GdkEvent *event)
* at the last moment, since the event may have been queued
* up behind other events, held over a recursive main loop, etc.
*/
- switch (event->type)
+ switch ((guint) event->type)
{
case GDK_EXPOSE:
case GDK_MOTION_NOTIFY:
@@ -6762,7 +6766,7 @@ gtk_widget_event_internal (GtkWidget *widget,
return TRUE;
/* Non input events get handled right away */
- switch (event->type)
+ switch ((guint) event->type)
{
case GDK_VISIBILITY_NOTIFY:
case GDK_EXPOSE:
@@ -6820,6 +6824,17 @@ gtk_widget_emit_event_signals (GtkWidget *widget,
switch (event->type)
{
+ case GDK_DRAG_ENTER:
+ case GDK_DRAG_LEAVE:
+ case GDK_DRAG_MOTION:
+ case GDK_DRAG_STATUS:
+ case GDK_DROP_START:
+ case GDK_DROP_FINISHED:
+ case GDK_CLIENT_EVENT:
+ case GDK_SETTING:
+ case GDK_OWNER_CHANGE:
+ case GDK_DAMAGE:
+ case GDK_EVENT_LAST:
case GDK_TOUCHPAD_SWIPE:
case GDK_TOUCHPAD_PINCH:
case GDK_PAD_BUTTON_PRESS:
@@ -7267,6 +7282,7 @@ gtk_widget_real_keynav_failed (GtkWidget *widget,
case GTK_DIR_DOWN:
case GTK_DIR_LEFT:
case GTK_DIR_RIGHT:
+ default:
break;
}