Ignore key down repeat events in inspector window
Ignore key press events that happen when a key is held down.
This commit is contained in:
parent
4811f92c39
commit
de9403f9fe
@ -83,7 +83,7 @@ InspectorBuffer::~InspectorBuffer() {
|
||||
// return deg;
|
||||
//}
|
||||
|
||||
Inspector::Inspector () : currImage(nullptr), scaled(false), scale(1.0), zoomScale(1.0), zoomScaleBegin(1.0), active(false), pinned(false), dirty(false)
|
||||
Inspector::Inspector () : currImage(nullptr), scaled(false), scale(1.0), zoomScale(1.0), zoomScaleBegin(1.0), active(false), pinned(false), dirty(false), keyDown(false)
|
||||
{
|
||||
set_name("Inspector");
|
||||
|
||||
@ -152,6 +152,8 @@ void Inspector::hideWindow()
|
||||
|
||||
bool Inspector::on_key_release(GdkEventKey *event)
|
||||
{
|
||||
keyDown = false;
|
||||
|
||||
if (!window)
|
||||
return false;
|
||||
|
||||
@ -172,6 +174,12 @@ bool Inspector::on_key_press(GdkEventKey *event)
|
||||
if (!window)
|
||||
return false;
|
||||
|
||||
if (keyDown) {
|
||||
return true;
|
||||
}
|
||||
|
||||
keyDown = true;
|
||||
|
||||
switch (event->keyval) {
|
||||
case GDK_KEY_z:
|
||||
case GDK_KEY_F:
|
||||
@ -203,6 +211,8 @@ bool Inspector::on_key_press(GdkEventKey *event)
|
||||
return true;
|
||||
}
|
||||
|
||||
keyDown = false;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -55,6 +55,7 @@ private:
|
||||
bool dirty;
|
||||
bool initialized;
|
||||
bool fullscreen; // window is shown in fullscreen mode
|
||||
bool keyDown;
|
||||
|
||||
sigc::connection delayconn;
|
||||
Glib::ustring next_image_path;
|
||||
|
Loading…
x
Reference in New Issue
Block a user