[gnote] Use bit-wise operations to test modifier masks (Ctrl/Alt)
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Use bit-wise operations to test modifier masks (Ctrl/Alt)
- Date: Tue, 4 Jun 2013 19:40:45 +0000 (UTC)
commit ff40f8e1b70224c4b772ae831bff2584e7da7dc5
Author: Luc Pionchon <pionchon luc gmail com>
Date: Tue Jun 4 07:16:41 2013 +0300
Use bit-wise operations to test modifier masks (Ctrl/Alt)
Fixes Bug 701555.
src/addins/tableofcontent/NEWS | 3 +++
.../tableofcontent/tableofcontentnoteaddin.cpp | 7 ++++---
2 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/addins/tableofcontent/NEWS b/src/addins/tableofcontent/NEWS
index 06ab2cf..f68bad1 100644
--- a/src/addins/tableofcontent/NEWS
+++ b/src/addins/tableofcontent/NEWS
@@ -4,6 +4,9 @@ NEWS for Add-in: Table of Content
(NOTE: little release manual:
update NEWS + .desktop version/enabled=false + help topic status/pkgversion ==> commit -m "version x.y")
+== 0.11
+- fix: use bit-wise operations to test modifier masks (Ctrl/Alt)
+
== 0.10
- fix: header-2 arrow, 2 chars does not match with some fonts.
diff --git a/src/addins/tableofcontent/tableofcontentnoteaddin.cpp
b/src/addins/tableofcontent/tableofcontentnoteaddin.cpp
index d69b307..6a04393 100644
--- a/src/addins/tableofcontent/tableofcontentnoteaddin.cpp
+++ b/src/addins/tableofcontent/tableofcontentnoteaddin.cpp
@@ -295,11 +295,12 @@ bool TableofcontentNoteAddin::on_key_pressed(GdkEventKey *ev)
switch(ev->keyval) {
case GDK_KEY_1:
- if (ev->state == (GDK_CONTROL_MASK | GDK_MOD1_MASK)) {// Ctrl-Alt-1
+ if (ev->state & Gdk::CONTROL_MASK
+ && ev->state & Gdk::MOD1_MASK ) {// Ctrl-Alt-1
on_toc_popup_activated();
return true;
}
- else if (ev->state == GDK_CONTROL_MASK) { // Ctrl-1
+ else if (ev->state & Gdk::CONTROL_MASK) { // Ctrl-1
on_level_1_activated ();
return true;
}
@@ -309,7 +310,7 @@ bool TableofcontentNoteAddin::on_key_pressed(GdkEventKey *ev)
break;
case GDK_KEY_2:
- if (ev->state == GDK_CONTROL_MASK) { // Ctrl-2
+ if (ev->state & Gdk::CONTROL_MASK) { // Ctrl-2
on_level_2_activated ();
return true;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]