This part kinda worries me, since you're assigning 1 to goal in the beginning, you can remove at least half of the method
Index: src/drawer.vala =================================================================== --- src/drawer.vala (revision 43) +++ src/drawer.vala (working copy) @@ -78,11 +78,27 @@ this.timer_pending = true; } } + + public bool show_drawer ( ) { + return_if_fail( this != null ); + if (this.goal == 1) + return false; + + on_before_show(); + + this.goal = 1; + if (this.timer_pending == false) { + this.timer_id = Timeout.add( this.period, on_timer ); + this.timer_pending = true; + } + return false; + } + public uint get_close_time() { return_val_if_fail ( this != null, 0 ); return this.period * ((uint)(1 / this.step) + 1); } -} \ No newline at end of file +} Index: src/tearwebview.vala =================================================================== --- src/tearwebview.vala (revision 43) +++ src/tearwebview.vala (working copy) @@ -31,13 +31,11 @@ this.clicking = false; this.menudown = false; - this.redo_keydown = false; } public bool on_webview_keydown (Tear.BrowserWindow bw, Gdk.EventKey ev) { this.menudown = false; - this.enterdown = false; switch (ev.keyval) { case Gdk.KeySyms.F4: @@ -48,17 +46,13 @@ break; case Gdk.KeySyms.Return: - if (!redo_keydown) { - this.enterdown = true; - entertime.get_current_time(); - if (options.get_option( "wake_toolbar_shortcut_speed" ) == "short") { - last_keydown = ev; - return true; - } - } else - redo_keydown = false; + if (options.get_option( "wake_toolbar_shortcut_speed" ) == "short") + GLib.Timeout.add( 500, bw.drawer.show_drawer ); + else + GLib.Timeout.add( 1000, bw.drawer.show_drawer ); break; + case Gdk.KeySyms.Escape: if (bw.web_view.can_go_back ()) bw.web_view.go_back (); @@ -88,7 +82,7 @@ public bool on_webview_keyup (Tear.BrowserWindow bw, Gdk.EventKey ev) { - if ((ev.keyval == Gdk.KeySyms.F4) || (ev.keyval == Gdk.KeySyms.Return)) { + if (ev.keyval == Gdk.KeySyms.F4) { var newtime = TimeVal(); newtime.get_current_time(); @@ -96,25 +90,7 @@ if ((newtime.tv_sec - menutime.tv_sec) < 1.0) program.get_common_menu().popup(null, null, MenuPosition, 0, get_current_event_time()); - if (this.enterdown && options.get_option( "wake_toolbar_shortcut_speed" ) == "short") { - if ((newtime.tv_sec - entertime.tv_sec) < 0.7) - bw.drawer.set_goal( 1 ); - else { - redo_keydown = true; - this.enterdown = false; - main_do_event( (Gdk.Event) last_keydown ); - } - } else - if (this.enterdown && options.get_option( "wake_toolbar_shortcut_speed" ) == "long") - if ((newtime.tv_sec - entertime.tv_sec) > 0.5) { - bw.drawer.set_goal( 1 ); - this.menudown = false; - this.enterdown = false; - return true; - } - this.menudown = false; - this.enterdown = false; if (DEBUG) warning ( "keyup" );