-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make
Gdk::ModifierType#none?
work when there's hidden reserved valu…
…es in the flag.
- Loading branch information
Showing
4 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
require "./spec_helper" | ||
|
||
describe Gdk::ModifierType do | ||
it "can be generated from value with internal data" do | ||
flag = Gdk::ModifierType.new(16) | ||
flag.none?.should eq(true) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
require "spec" | ||
require "../src/gtk4" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
namespace: Gdk | ||
version: "4.0" | ||
include: | ||
- modifier_type.cr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module Gdk | ||
enum ModifierType | ||
def none? | ||
# From GDK docs: | ||
# | ||
# Note that GDK may add internal values to events which include reserved values such as | ||
# GDK_MODIFIER_RESERVED_13_MASK. Your code should preserve and ignore them. You can use | ||
# GDK_MODIFIER_MASK to remove all reserved values. | ||
# | ||
# We need this so `.none?` works as expected when there's hidden values in the enum | ||
(value & MODIFIER_MASK).zero? | ||
end | ||
end | ||
end |