~admicos/moonlander

df98b1ceed2dc35c161c6440a429b539c38acd41 — Ecmel Berk Canlier 3 days ago a36dc52
ui: Fix mouse side buttons

They now work on all content types!
2 files changed, 23 insertions(+), 20 deletions(-)

M moonlander/src/ui/mod.rs
M moonlander/src/ui/tab.rs
M moonlander/src/ui/mod.rs => moonlander/src/ui/mod.rs +22 -0
@@ 32,6 32,7 @@ pub enum Msg {
    AboutWindow,
    CurrentTabInfo(TabInfo),
    KeyPress(gdk::EventKey),
    Clicked(gdk::EventButton),

    Error {
        component: String,


@@ 250,6 251,26 @@ Details:
                    self.model.header.emit(HeaderMsg::FocusBar);
                }
            }

            Msg::Clicked(event) => {
                match event.get_button() {
                    // mouse left
                    8 => {
                        self.model
                            .coordinator
                            .emit(TabCoordinatorMsg::CurrentTabMsg(TabMsg::GoBack));
                    }

                    // mouse right
                    9 => {
                        self.model
                            .coordinator
                            .emit(TabCoordinatorMsg::CurrentTabMsg(TabMsg::GoForward));
                    }

                    _ => {}
                };
            }
        }
    }



@@ 297,6 318,7 @@ Details:
            },

            key_press_event(_, e) => (Msg::KeyPress(e.clone()), Inhibit(false)),
            button_release_event(_, e) => (Msg::Clicked(e.clone()), Inhibit(false)),
        }
    }
}

M moonlander/src/ui/tab.rs => moonlander/src/ui/tab.rs +1 -20
@@ 38,7 38,6 @@ pub enum Msg {

    // internal
    LinkClick(String, bool), // string: address, bool: is_newtab
    Clicked(gdk::EventButton),
    Error { title: String, trace: String },
}



@@ 113,9 112,7 @@ impl Widget for Tab {
    }

    view! {
        gtk::Box {
            button_release_event(_, e) => (Msg::Clicked(e.clone()), Inhibit(false)),
        }
        gtk::Box {}
    }
}



@@ 233,22 230,6 @@ impl Tab {
                });
            }

            Msg::Clicked(event) => {
                match event.get_button() {
                    // mouse left
                    8 => {
                        self.model.relm.stream().emit(Msg::GoBack);
                    }

                    // mouse right
                    9 => {
                        self.model.relm.stream().emit(Msg::GoForward);
                    }

                    _ => {}
                };
            }

            Msg::Redirect(address) => {
                self.model.redirect_count += 1;