2016-03-20 18:16:43 +00:00
|
|
|
/*
|
|
|
|
* x11misc.h: header file for functions that need to refer to Xlib
|
|
|
|
* data types. Has to be separate from unix.h so that we can include
|
|
|
|
* it only after including the X headers, which in turn has to be done
|
|
|
|
* after putty.h has told us whether NOT_X_WINDOWS is defined.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef NOT_X_WINDOWS
|
|
|
|
|
|
|
|
/*
|
|
|
|
* x11misc.c.
|
|
|
|
*/
|
|
|
|
void x11_ignore_error(Display *disp, unsigned char errcode);
|
|
|
|
|
Basic support for running under GDK Wayland back end.
GTK 3 PuTTY/pterm has always assumed that if it was compiled with
_support_ for talking to the raw X11 layer underneath GTK and GDK,
then it was entitled to expect that raw X11 layer to exist at all
times, i.e. that GDK_DISPLAY_XDISPLAY would return a meaningful X
display that it could do useful things with. So if you ran it over the
GDK Wayland backend, it would immediately segfault.
Modern GTK applications need to cope with multiple GDK backends at run
time. It's fine for GTK PuTTY to _contain_ the code to find and use
underlying X11 primitives like the display and the X window id, but it
should be prepared to find that it's running on Wayland (or something
else again!) so those functions don't return anything useful - in
which case it should degrade gracefully to the subset of functionality
that can be accessed through backend-independent GTK calls.
Accordingly, I've centralised the use of GDK_DISPLAY_XDISPLAY into a
support function get_x_display() in gtkmisc.c, which starts by
checking that there actually is one first. All previous direct uses of
GDK_*_XDISPLAY now go via that function, and check the result for NULL
afterwards. (To save faffing about calling that function too many
times, I'm also caching the display pointer in more places, and
passing it as an extra argument to various subfunctions, mostly in
gtkfont.c.)
Similarly, the get_windowid() function that retrieves the window id to
put in the environment of pterm's child process has to be prepared for
there not to be a window id.
This isn't a complete fix for all Wayland-related problems. The other
one I'm currently aware of is that the default font is "server:fixed",
which is a bad default now that it won't be available on all backends.
And I expect that further problems will show up with more testing. But
it's a start.
2018-05-09 08:18:20 +00:00
|
|
|
/*
|
|
|
|
* gtkmisc.c
|
|
|
|
*/
|
|
|
|
Display *get_x11_display(void);
|
|
|
|
|
2016-03-20 18:16:43 +00:00
|
|
|
#endif
|