aboutsummaryrefslogtreecommitdiffstats
path: root/pugl/detail
diff options
context:
space:
mode:
Diffstat (limited to 'pugl/detail')
-rw-r--r--pugl/detail/implementation.c7
-rw-r--r--pugl/detail/mac.m2
-rw-r--r--pugl/detail/types.h2
-rw-r--r--pugl/detail/win.c2
-rw-r--r--pugl/detail/x11.c2
5 files changed, 9 insertions, 6 deletions
diff --git a/pugl/detail/implementation.c b/pugl/detail/implementation.c
index 45e21c5..7eeba01 100644
--- a/pugl/detail/implementation.c
+++ b/pugl/detail/implementation.c
@@ -29,7 +29,7 @@ static PuglHints
puglDefaultHints(void)
{
static const PuglHints hints = {
- 2, 0, 4, 4, 4, 4, 24, 8, 0, true, true, false
+ 2, 0, 4, 4, 4, 4, 24, 8, 0, true, true, false, false
};
return hints;
}
@@ -97,6 +97,9 @@ puglInitWindowHint(PuglView* view, PuglWindowHint hint, int value)
case PUGL_RESIZABLE:
view->hints.resizable = value;
break;
+ case PUGL_IGNORE_KEY_REPEAT:
+ view->hints.ignoreKeyRepeat = value;
+ break;
}
}
@@ -208,7 +211,7 @@ puglLeaveContext(PuglView* view, bool drawing)
void
puglIgnoreKeyRepeat(PuglView* view, bool ignore)
{
- view->ignoreKeyRepeat = ignore;
+ puglInitWindowHint(view, PUGL_IGNORE_KEY_REPEAT, ignore);
}
void
diff --git a/pugl/detail/mac.m b/pugl/detail/mac.m
index ce82d78..e3568f5 100644
--- a/pugl/detail/mac.m
+++ b/pugl/detail/mac.m
@@ -330,7 +330,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type)
- (void) keyDown:(NSEvent*)event
{
- if (puglview->ignoreKeyRepeat && [event isARepeat]) {
+ if (puglview->hints.ignoreKeyRepeat && [event isARepeat]) {
return;
}
diff --git a/pugl/detail/types.h b/pugl/detail/types.h
index 0cf9a99..60f7682 100644
--- a/pugl/detail/types.h
+++ b/pugl/detail/types.h
@@ -52,6 +52,7 @@ typedef struct {
int double_buffer;
bool use_compat_profile;
bool resizable;
+ bool ignoreKeyRepeat;
} PuglHints;
/** Cross-platform view definition. */
@@ -73,7 +74,6 @@ struct PuglViewImpl {
int min_aspect_y;
int max_aspect_x;
int max_aspect_y;
- bool ignoreKeyRepeat;
bool visible;
};
diff --git a/pugl/detail/win.c b/pugl/detail/win.c
index 6e176b6..5922769 100644
--- a/pugl/detail/win.c
+++ b/pugl/detail/win.c
@@ -360,7 +360,7 @@ initCharEvent(PuglEvent* event, PuglView* view, WPARAM wParam, LPARAM lParam)
static bool
ignoreKeyEvent(PuglView* view, LPARAM lParam)
{
- return view->ignoreKeyRepeat && (lParam & (1 << 30));
+ return view->hints.ignoreKeyRepeat && (lParam & (1 << 30));
}
static RECT
diff --git a/pugl/detail/x11.c b/pugl/detail/x11.c
index 32f1393..d014b2e 100644
--- a/pugl/detail/x11.c
+++ b/pugl/detail/x11.c
@@ -506,7 +506,7 @@ puglProcessEvents(PuglView* view)
XNextEvent(impl->display, &xevent);
if (xevent.type == KeyRelease) {
// Ignore key repeat if necessary
- if (view->ignoreKeyRepeat &&
+ if (view->hints.ignoreKeyRepeat &&
XEventsQueued(impl->display, QueuedAfterReading)) {
XEvent next;
XPeekEvent(impl->display, &next);