camera: fix the build without X11

This commit is contained in:
Pierre Pronchery 2024-07-30 18:00:23 +02:00
parent 6c390be503
commit 26a9af0ed7

View File

@ -30,8 +30,10 @@
#include <locale.h> #include <locale.h>
#include <libintl.h> #include <libintl.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#if GTK_CHECK_VERSION(3, 0, 0) #if defined(GDK_WINDOWING_X11)
# include <gtk/gtkx.h> # if GTK_CHECK_VERSION(3, 0, 0)
# include <gtk/gtkx.h>
# endif
#endif #endif
#include <System.h> #include <System.h>
#include "camera.h" #include "camera.h"
@ -67,7 +69,9 @@ static int _usage(void);
/* camera */ /* camera */
static int _camera_embedded(char const * device, int hflip, int vflip, static int _camera_embedded(char const * device, int hflip, int vflip,
int ratio, char const * overlay); int ratio, char const * overlay);
#if defined(GDK_WINDOWING_X11)
static void _embedded_on_embedded(gpointer data); static void _embedded_on_embedded(gpointer data);
#endif
static int _camera(int embedded, char const * device, int hflip, int vflip, static int _camera(int embedded, char const * device, int hflip, int vflip,
int ratio, char const * overlay) int ratio, char const * overlay)
@ -95,6 +99,16 @@ static int _camera(int embedded, char const * device, int hflip, int vflip,
static int _camera_embedded(char const * device, int hflip, int vflip, static int _camera_embedded(char const * device, int hflip, int vflip,
int ratio, char const * overlay) int ratio, char const * overlay)
{ {
#if !defined(GDK_WINDOWING_X11)
(void) device;
(void) hflip;
(void) vflip;
(void) ratio;
(void) overlay;
error_set_code(-ENOSYS, "%s", strerror(ENOSYS));
return -1;
#else
GtkWidget * window; GtkWidget * window;
GtkWidget * widget; GtkWidget * widget;
Camera * camera; Camera * camera;
@ -127,14 +141,17 @@ static int _camera_embedded(char const * device, int hflip, int vflip,
camera_delete(camera); camera_delete(camera);
gtk_widget_destroy(window); gtk_widget_destroy(window);
return 0; return 0;
#endif
} }
#if defined(GDK_WINDOWING_X11)
static void _embedded_on_embedded(gpointer data) static void _embedded_on_embedded(gpointer data)
{ {
GtkWidget * widget = data; GtkWidget * widget = data;
gtk_widget_show(widget); gtk_widget_show(widget);
} }
#endif
/* error */ /* error */