Skip to content

Commit 997992c

Browse files
committed
Remove navkey support that doesn't actually need to go into libobs. Support arrow keys using key mapping API from the hotkey code.
1 parent e42a866 commit 997992c

3 files changed

Lines changed: 12 additions & 20 deletions

File tree

CMakeLists.txt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,6 @@ if (NOT GHOSTSCRIPT_INCLUDE_DIR OR NOT GHOSTSCRIPT_LIB_DIR)
4343
message("Ghostscript headers or libraries could not be found! Please ensure that Ghostscript is installed somewhere, and set the GSSourcePath and GSLibraryPath variables if necessary.")
4444
endif()
4545

46-
# Check if the libobs being referenced has support for arrow key navigation when interacting with a source.
47-
48-
set(CMAKE_REQUIRED_INCLUDES ${OBSSourcePath})
49-
50-
check_c_source_compiles("#include <obs-interaction.h>
51-
int main() { struct obs_key_event e; return e.navigation_keys; }" OBS_HAS_NAVKEY_SUPPORT)
52-
5346
configure_file(${CMAKE_SOURCE_DIR}/src/config.h.in ${CMAKE_BINARY_DIR}/config/config.h)
5447

5548
# Source

src/config.h.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
#pragma once
2-
3-
#cmakedefine OBS_HAS_NAVKEY_SUPPORT 1

src/obs-ghostscript.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include <obs-module.h>
2+
#include <obs-hotkey.h>
23
#include <util/dstr.h>
34

45
#include <stdio.h>
@@ -287,20 +288,20 @@ static void pdf_source_key_click(void *data,
287288

288289
if (!key_up)
289290
{
290-
#ifdef OBS_HAS_NAVKEY_SUPPORT
291-
switch (event->navigation_keys)
291+
enum obs_key_t key = obs_key_from_virtual_key(event->native_vkey);
292+
293+
switch (key)
292294
{
293-
case NAVKEY_DOWN:
294-
case NAVKEY_NEXTPAGE:
295-
pdf_source_change_page(context, false);
295+
case OBS_KEY_UP:
296+
case OBS_KEY_PAGEUP:
297+
pdf_source_change_page(context, true);
296298
break;
297299

298-
case NAVKEY_UP:
299-
case NAVKEY_PREVPAGE:
300-
pdf_source_change_page(context, true);
300+
case OBS_KEY_DOWN:
301+
case OBS_KEY_PAGEDOWN:
302+
pdf_source_change_page(context, false);
301303
break;
302304
}
303-
#endif
304305
}
305306
}
306307

@@ -349,8 +350,8 @@ struct obs_source_info pdf_source_info = {
349350
.get_height = pdf_source_getheight,
350351
.video_render = pdf_source_render,
351352
.get_properties = pdf_source_properties,
352-
.key_click = pdf_source_key_click,
353-
.mouse_wheel = pdf_source_mouse_wheel
353+
.key_click = pdf_source_key_click,
354+
.mouse_wheel = pdf_source_mouse_wheel
354355
};
355356

356357
OBS_DECLARE_MODULE()

0 commit comments

Comments
 (0)