Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unbreak build without X11 libraries #177

Closed
wants to merge 2 commits into from
Closed

Unbreak build without X11 libraries #177

wants to merge 2 commits into from

Conversation

jbeich
Copy link

@jbeich jbeich commented Jun 3, 2023

Some distros may target only Wayland either by default or via user configuration (e.g., Gentoo, FreeBSD, maybe NixPkgs). When GTK is built without X11 support GDK_WINDOWING_X11 isn't defined.

src/input.c:253:8: warning: implicit declaration of function 'GDK_IS_X11_DISPLAY' is invalid in C99 [-Wimplicit-function-declaration]
          if (GDK_IS_X11_DISPLAY(data->display)) {
              ^
src/input.c:254:22: warning: implicit declaration of function 'gdk_x11_device_get_id' is invalid in C99 [-Wimplicit-function-declaration]
              gint dev_id = gdk_x11_device_get_id(device);
                            ^
src/input.c:257:8: error: use of undeclared identifier 'XIDeviceInfo'
              XIDeviceInfo* devinfo;
              ^
src/input.c:257:22: error: use of undeclared identifier 'devinfo'
              XIDeviceInfo* devinfo;
                            ^
src/input.c:260:8: error: use of undeclared identifier 'devinfo'
              devinfo = XIQueryDevice(GDK_DISPLAY_XDISPLAY(data->display),
              ^
src/input.c:260:18: warning: implicit declaration of function 'XIQueryDevice' is invalid in C99 [-Wimplicit-function-declaration]
              devinfo = XIQueryDevice(GDK_DISPLAY_XDISPLAY(data->display),
                        ^
src/input.c:260:32: warning: implicit declaration of function 'GDK_DISPLAY_XDISPLAY' is invalid in C99 [-Wimplicit-function-declaration]
              devinfo = XIQueryDevice(GDK_DISPLAY_XDISPLAY(data->display),
                                      ^
src/input.c:264:18: error: use of undeclared identifier 'devinfo'
                  kbd_dev_id = devinfo->attachment;
                               ^
src/input.c:265:8: warning: implicit declaration of function 'XIFreeDeviceInfo' is invalid in C99 [-Wimplicit-function-declaration]
              XIFreeDeviceInfo(devinfo);
              ^
src/input.c:265:25: error: use of undeclared identifier 'devinfo'
              XIFreeDeviceInfo(devinfo);
                               ^
src/input.c:269:9: error: unknown type name 'XIEventMask'; did you mean 'GdkEventMask'?
                      XIEventMask mask;
                      ^~~~~~~~~~~
                      GdkEventMask
/usr/include/gtk-3.0/gdk/gdktypes.h:455:3: note: 'GdkEventMask' declared here
} GdkEventMask;
  ^
src/input.c:271:13: error: member reference base type 'GdkEventMask' is not a structure or union
                      mask.mask = bits;
                      ~~~~^~~~~
src/input.c:272:13: error: member reference base type 'GdkEventMask' is not a structure or union
                      mask.mask_len = sizeof(bits);
                      ~~~~^~~~~~~~~
src/input.c:274:9: warning: implicit declaration of function 'XISetMask' is invalid in C99 [-Wimplicit-function-declaration]
                      XISetMask(bits, XI_KeyPress);
                      ^
src/input.c:274:25: error: use of undeclared identifier 'XI_KeyPress'
                      XISetMask(bits, XI_KeyPress);
                                      ^
src/input.c:275:25: error: use of undeclared identifier 'XI_KeyRelease'
                      XISetMask(bits, XI_KeyRelease);
                                      ^
src/input.c:277:9: error: use of undeclared identifier 'XIGrabModifiers'
                      XIGrabModifiers modifiers[] = {{XIAnyModifier, 0}};
                      ^
src/input.c:280:9: warning: implicit declaration of function 'gdk_x11_display_error_trap_push' is invalid in C99 [-Wimplicit-function-declaration]
                      gdk_x11_display_error_trap_push(data->display);
                      ^
src/input.c:286:9: warning: implicit declaration of function 'XIGrabKeycode' is invalid in C99 [-Wimplicit-function-declaration]
                          if(XIGrabKeycode(GDK_DISPLAY_XDISPLAY(data->display),
                             ^
src/input.c:289:9: warning: implicit declaration of function 'GDK_WINDOW_XID' is invalid in C99 [-Wimplicit-function-declaration]
                                           GDK_WINDOW_XID(data->root),
                                           ^
src/input.c:290:9: error: use of undeclared identifier 'GrabModeAsync'
                                           GrabModeAsync,
                                           ^
src/input.c:291:9: error: use of undeclared identifier 'GrabModeAsync'
                                           GrabModeAsync,
                                           ^
src/input.c:292:9: error: use of undeclared identifier 'True'
                                           True,
                                           ^
src/input.c:295:9: error: use of undeclared identifier 'modifiers'
                                           modifiers) != 0) {
                                           ^
src/input.c:314:9: warning: implicit declaration of function 'XIGrabKeycode' is invalid in C99 [-Wimplicit-function-declaration]
                          if(XIGrabKeycode(GDK_DISPLAY_XDISPLAY(data->display),
                             ^
src/input.c:317:9: warning: implicit declaration of function 'GDK_WINDOW_XID' is invalid in C99 [-Wimplicit-function-declaration]
                                           GDK_WINDOW_XID(data->root),
                                           ^
src/input.c:318:9: error: use of undeclared identifier 'GrabModeAsync'
                                           GrabModeAsync,
                                           ^
src/input.c:319:9: error: use of undeclared identifier 'GrabModeAsync'
                                           GrabModeAsync,
                                           ^
src/input.c:320:9: error: use of undeclared identifier 'True'
                                           True,
                                           ^
src/input.c:323:9: error: use of undeclared identifier 'modifiers'
                                           modifiers) != 0) {
                                           ^
src/input.c:337:9: warning: implicit declaration of function 'XSync' is invalid in C99 [-Wimplicit-function-declaration]
                      XSync(GDK_DISPLAY_XDISPLAY(data->display), False);
                      ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
@jbeich jbeich marked this pull request as draft June 3, 2023 14:13
libX11 and libXi are not used when GTK is built without X11 support.
@jbeich jbeich marked this pull request as ready for review June 3, 2023 14:24
@bk138
Copy link
Owner

bk138 commented Jun 4, 2023

I don't think the app will work without X11 at all - did you test this at runtime?

@jbeich
Copy link
Author

jbeich commented Jun 4, 2023

Indeed:

$ gromit-mpx 
(gromit-mpx:56156): Gtk-WARNING **: cannot open display: :0

gromit-mpx/src/main.c

Lines 1042 to 1045 in cff41dd

/*
we run okay under XWayland, but not native Wayland
*/
gdk_set_allowed_backends ("x11");

@jbeich jbeich closed this Jun 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants