[gnome-documents/wip/ui-changes] preview: don't activate fullscreen on double click
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents/wip/ui-changes] preview: don't activate fullscreen on double click
- Date: Fri, 30 Nov 2012 23:16:48 +0000 (UTC)
commit d06e6d0c72917f27c6650b9dfc0831b60fe1afe2
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Fri Nov 30 18:15:31 2012 -0500
preview: don't activate fullscreen on double click
And wait for the double click time before popping up controls.
src/preview.js | 32 ++++++++++++++++++++++++++------
1 files changed, 26 insertions(+), 6 deletions(-)
---
diff --git a/src/preview.js b/src/preview.js
index 6439cba..1607c1c 100644
--- a/src/preview.js
+++ b/src/preview.js
@@ -47,6 +47,7 @@ const PreviewView = new Lang.Class({
this._model = null;
this._jobFind = null;
this._controlsVisible = false;
+ this._clickTime = 0;
Global.modeController.connect('fullscreen-changed',
Lang.bind(this, this._onFullscreenChanged));
@@ -123,7 +124,9 @@ const PreviewView = new Lang.Class({
},
_flipControlsState: function() {
+ this._controlsFlipId = 0;
this._controlsVisible = !this._controlsVisible;
+
if (this._controlsVisible) {
if (Global.modeController.getFullscreen())
this._fsToolbar.show();
@@ -132,6 +135,8 @@ const PreviewView = new Lang.Class({
this._fsToolbar.hide();
this._thumbBar.hide();
}
+
+ return false;
},
_onFullscreenChanged: function() {
@@ -173,16 +178,31 @@ const PreviewView = new Lang.Class({
return false;
},
+ _cancelControlsFlip: function() {
+ if (this._controlsFlipId != 0) {
+ Mainloop.source_remove(this._controlsFlipId);
+ this._controlsFlipId = 0;
+ }
+ },
+
+ _ensureControlsFlip: function() {
+ if (this._controlsFlipId)
+ return;
+
+ let settings = Gtk.Settings.get_default();
+ let doubleClick = settings.gtk_double_click_time;
+
+ this._controlsFlipId = Mainloop.timeout_add(doubleClick, Lang.bind(this, this._flipControlsState));
+ },
+
_onButtonPressEvent: function(widget, event) {
let button = event.get_button()[1];
let clickCount = event.get_click_count()[1];
- if (button == 1 && clickCount == 2) {
- Global.modeController.toggleFullscreen();
- return true;
- }
-
- this._flipControlsState();
+ if (button == 1 && clickCount == 1)
+ this._ensureControlsFlip();
+ else
+ this._cancelControlsFlip();
return false;
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]