From 5edaf43d4b627d31a16d084893614965a3359da7 Mon Sep 17 00:00:00 2001 From: Paolo Borelli Date: Sun, 3 Sep 2023 11:21:37 +0200 Subject: [PATCH] Properly use the Propagation values In the shuffle from Inhibit(bool), to ControlFlow, to Propagtaion we ended up flipping some value. In particular in the widget subclass code and in the example. --- examples/cairo_test/main.rs | 4 ++-- examples/cairo_threads/main.rs | 4 ++-- examples/clipboard_simple/main.rs | 2 +- examples/gtk_builder_basics/main.rs | 2 +- examples/gtk_builder_signal/main.rs | 2 +- examples/gtk_test/main.rs | 6 ++--- examples/multi_window/main.rs | 4 ++-- examples/progress_tracker/main.rs | 2 +- examples/transparent_main_window/main.rs | 2 +- gtk/src/subclass/socket.rs | 2 +- gtk/src/subclass/widget.rs | 30 ++++++++++++------------ 11 files changed, 30 insertions(+), 30 deletions(-) diff --git a/examples/cairo_test/main.rs b/examples/cairo_test/main.rs index 18e743f539a..92723015ebb 100644 --- a/examples/cairo_test/main.rs +++ b/examples/cairo_test/main.rs @@ -57,7 +57,7 @@ fn build_ui(application: >k::Application) { cr.arc(0.5 + eye_dx, eye_y, 0.05, 0.0, PI * 2.); cr.fill().expect("Invalid cairo surface state"); - glib::Propagation::Stop + glib::Propagation::Proceed }); drawable(application, 500, 500, |_, cr| { @@ -82,7 +82,7 @@ fn build_ui(application: >k::Application) { cr.arc(0.27, 0.65, 0.02, 0.0, PI * 2.); cr.fill().expect("Invalid cairo surface state"); - glib::Propagation::Stop + glib::Propagation::Proceed }); } diff --git a/examples/cairo_threads/main.rs b/examples/cairo_threads/main.rs index 87428cf8eea..6dc269e17fa 100644 --- a/examples/cairo_threads/main.rs +++ b/examples/cairo_threads/main.rs @@ -104,7 +104,7 @@ fn build_ui(application: >k::Application) { // Whenever the drawing area has to be redrawn, render the latest images in the correct // locations area.connect_draw( - glib::clone!(@weak workspace => @default-return glib::Propagation::Stop, move |_, cr| { + glib::clone!(@weak workspace => @default-return glib::Propagation::Proceed, move |_, cr| { let (ref images, ref origins, _) = *workspace; for (image, origin) in images.iter().zip(origins.iter()) { @@ -113,7 +113,7 @@ fn build_ui(application: >k::Application) { }); } - glib::Propagation::Stop + glib::Propagation::Proceed }), ); diff --git a/examples/clipboard_simple/main.rs b/examples/clipboard_simple/main.rs index af70e99ac27..518949549c5 100644 --- a/examples/clipboard_simple/main.rs +++ b/examples/clipboard_simple/main.rs @@ -22,7 +22,7 @@ fn build_ui(application: >k::Application) { window.set_title("gtk::Clipboard Simple Example"); window.connect_delete_event(|window, _| { window.close(); - glib::Propagation::Stop + glib::Propagation::Proceed }); // Create the button grid diff --git a/examples/gtk_builder_basics/main.rs b/examples/gtk_builder_basics/main.rs index 08c0bf3d4e1..696d5f7e886 100644 --- a/examples/gtk_builder_basics/main.rs +++ b/examples/gtk_builder_basics/main.rs @@ -26,7 +26,7 @@ fn build_ui(application: >k::Application) { dialog.connect_delete_event(|dialog, _| { dialog.hide(); - glib::Propagation::Proceed + glib::Propagation::Stop }); bigbutton.connect_clicked(glib::clone!(@weak dialog => move |_| dialog.show_all())); diff --git a/examples/gtk_builder_signal/main.rs b/examples/gtk_builder_signal/main.rs index d3b562e9a19..7547006e711 100644 --- a/examples/gtk_builder_signal/main.rs +++ b/examples/gtk_builder_signal/main.rs @@ -14,7 +14,7 @@ fn build_ui(application: >k::Application) { .expect("Couldn't get messagedialog1"); dialog.connect_delete_event(|dialog, _| { dialog.hide(); - glib::Propagation::Proceed + glib::Propagation::Stop }); builder.connect_signals(move |_, handler_name| { diff --git a/examples/gtk_test/main.rs b/examples/gtk_test/main.rs index 908cdf0ca54..d5f9e5f9df1 100644 --- a/examples/gtk_test/main.rs +++ b/examples/gtk_test/main.rs @@ -155,7 +155,7 @@ fn build_ui(application: >k::Application) { button_about.connect_clicked(move |x| about_clicked(x, &dialog)); window.connect_key_press_event( - glib::clone!(@weak entry => @default-return glib::Propagation::Stop, move |_, key| { + glib::clone!(@weak entry => @default-return glib::Propagation::Proceed, move |_, key| { let keyval = key.keyval(); let keystate = key.state(); @@ -166,7 +166,7 @@ fn build_ui(application: >k::Application) { println!("You pressed Ctrl!"); } - glib::Propagation::Stop + glib::Propagation::Proceed }), ); @@ -182,7 +182,7 @@ fn about_clicked(button: &Button, dialog: &AboutDialog) { // as otherwise we can't show it again a second time. dialog.connect_delete_event(|dialog, _| { dialog.hide(); - glib::Propagation::Proceed + glib::Propagation::Stop }); println!("Authors: {:?}", dialog.authors()); diff --git a/examples/multi_window/main.rs b/examples/multi_window/main.rs index 50e6ee66d9f..04f9f16fa0b 100644 --- a/examples/multi_window/main.rs +++ b/examples/multi_window/main.rs @@ -98,9 +98,9 @@ fn create_sub_window( window.set_default_size(400, 200); window.connect_delete_event( - glib::clone!(@weak windows => @default-return glib::Propagation::Stop, move |_, _| { + glib::clone!(@weak windows => @default-return glib::Propagation::Proceed, move |_, _| { windows.borrow_mut().remove(&id); - glib::Propagation::Stop + glib::Propagation::Proceed }), ); diff --git a/examples/progress_tracker/main.rs b/examples/progress_tracker/main.rs index 5ea3a1bc4a5..ff1545c1e91 100644 --- a/examples/progress_tracker/main.rs +++ b/examples/progress_tracker/main.rs @@ -130,7 +130,7 @@ impl Widgets { window.set_default_size(500, 250); window.connect_delete_event(move |window, _| { window.close(); - glib::Propagation::Stop + glib::Propagation::Proceed }); Self { diff --git a/examples/transparent_main_window/main.rs b/examples/transparent_main_window/main.rs index f49e979206f..fe4fb45c14c 100644 --- a/examples/transparent_main_window/main.rs +++ b/examples/transparent_main_window/main.rs @@ -46,5 +46,5 @@ fn draw(_window: &ApplicationWindow, ctx: &cairo::Context) -> glib::Propagation ctx.set_source_rgba(1.0, 0.0, 0.0, 0.4); ctx.set_operator(cairo::Operator::Screen); ctx.paint().expect("Invalid cairo surface state"); - glib::Propagation::Stop + glib::Propagation::Proceed } diff --git a/gtk/src/subclass/socket.rs b/gtk/src/subclass/socket.rs index 15b3cd4b484..1452e92a566 100644 --- a/gtk/src/subclass/socket.rs +++ b/gtk/src/subclass/socket.rs @@ -45,7 +45,7 @@ pub trait SocketImplExt: ObjectSubclass + sealed::Sealed { .to_glib_none() .0)) } else { - glib::Propagation::Stop + glib::Propagation::Proceed } } } diff --git a/gtk/src/subclass/widget.rs b/gtk/src/subclass/widget.rs index b9423fc9b3b..8a55d451958 100644 --- a/gtk/src/subclass/widget.rs +++ b/gtk/src/subclass/widget.rs @@ -319,7 +319,7 @@ pub trait WidgetImplExt: ObjectSubclass + sealed::Sealed { ev_glib, )) } else { - Propagation::Stop + Propagation::Proceed } } } @@ -334,7 +334,7 @@ pub trait WidgetImplExt: ObjectSubclass + sealed::Sealed { ev_glib, )) } else { - Propagation::Stop + Propagation::Proceed } } } @@ -391,7 +391,7 @@ pub trait WidgetImplExt: ObjectSubclass + sealed::Sealed { ev_glib, )) } else { - Propagation::Stop + Propagation::Proceed } } } @@ -406,7 +406,7 @@ pub trait WidgetImplExt: ObjectSubclass + sealed::Sealed { ev_glib, )) } else { - Propagation::Stop + Propagation::Proceed } } } @@ -421,7 +421,7 @@ pub trait WidgetImplExt: ObjectSubclass + sealed::Sealed { ev_glib, )) } else { - Propagation::Stop + Propagation::Proceed } } } @@ -436,7 +436,7 @@ pub trait WidgetImplExt: ObjectSubclass + sealed::Sealed { ev_glib, )) } else { - Propagation::Stop + Propagation::Proceed } } } @@ -460,7 +460,7 @@ pub trait WidgetImplExt: ObjectSubclass + sealed::Sealed { ev_glib, )) } else { - Propagation::Stop + Propagation::Proceed } } } @@ -587,7 +587,7 @@ pub trait WidgetImplExt: ObjectSubclass + sealed::Sealed { time, )) } else { - Propagation::Stop + Propagation::Proceed } } } @@ -614,7 +614,7 @@ pub trait WidgetImplExt: ObjectSubclass + sealed::Sealed { result.into_glib(), )) } else { - Propagation::Stop + Propagation::Proceed } } } @@ -650,7 +650,7 @@ pub trait WidgetImplExt: ObjectSubclass + sealed::Sealed { time, )) } else { - Propagation::Stop + Propagation::Proceed } } } @@ -664,7 +664,7 @@ pub trait WidgetImplExt: ObjectSubclass + sealed::Sealed { cr.to_glib_none().0, )) } else { - Propagation::Stop + Propagation::Proceed } } } @@ -799,7 +799,7 @@ pub trait WidgetImplExt: ObjectSubclass + sealed::Sealed { mut_override(event.to_glib_none().0), )) } else { - Propagation::Stop + Propagation::Proceed } } } @@ -813,7 +813,7 @@ pub trait WidgetImplExt: ObjectSubclass + sealed::Sealed { mut_override(event.to_glib_none().0), )) } else { - Propagation::Stop + Propagation::Proceed } } } @@ -827,7 +827,7 @@ pub trait WidgetImplExt: ObjectSubclass + sealed::Sealed { mut_override(event.to_glib_none().0), )) } else { - Propagation::Stop + Propagation::Proceed } } } @@ -841,7 +841,7 @@ pub trait WidgetImplExt: ObjectSubclass + sealed::Sealed { mut_override(event.to_glib_none().0), )) } else { - Propagation::Stop + Propagation::Proceed } } }