more fixes of fullscreen toggle so -fs also works for X11

This commit is contained in:
F. Duncanh
2022-12-09 13:36:18 -05:00
parent 24f47dd943
commit a4cdfe9d58
8 changed files with 90 additions and 79 deletions

View File

@@ -237,10 +237,10 @@ optimization for the computer it is built on; when this is not the case,
as when you are packaging for a distribution, use the cmake option
<code>-DNO_MARCH_NATIVE=ON</code>.</p>
<p>If you use X11 Windows on Linux or <em>BSD, and wish to toggle in/out
of fullscreen mode with key F11, UxPlay needs to be built with a
dependence on X11. Starting with UxPlay-1.59, this will be done by
default <strong>IF</strong> the X11 development libraries are installed
and detected. Install these with
of fullscreen mode with a keypress (F11 or Alt_L+Enter) UxPlay needs to
be built with a dependence on X11. Starting with UxPlay-1.59, this will
be done by default <strong>IF</strong> the X11 development libraries are
installed and detected. Install these with
<code>sudo apt-get install libx11-dev</code>”. If GStreamer &lt; 1.20
is detected, a fix (“ZOOMFIX”) to a problem (fixed since GStreamer-1.20)
that prevents screen-sharing apps like Zoom from detecting (and sharing)
@@ -292,12 +292,14 @@ examining the GStreamer installation. If sound is not working,
<strong>alsa</strong>”“,”<strong>pulseaudio</strong>”, or
<strong>pipewire</strong>” plugins may need to be installed, depending
on how your audio is set up.</p>
<p><strong>Finally, run uxplay in a terminal window</strong>. Use Ctrl-C
(or close the window) to terminate it when done. If it is not seen by
the iOS clients drop-down “Screen Mirroring” panel, check that your
DNS-SD server (usually avahi-daemon) is running: do this in a terminal
window with <code>systemctl status avahi-daemon</code>. If this shows
the avahi-daemon is not running, control it with
<p><strong>Finally, run uxplay in a terminal window</strong>. On some
systems, you can toggle into and out of fullscreen mode with F11 or
(held-down left Alt)+Enter keys. Use Ctrl-C (or close the window) to
terminate it when done. If the UxPlay server is not seen by the iOS
clients drop-down “Screen Mirroring” panel, check that your DNS-SD
server (usually avahi-daemon) is running: do this in a terminal window
with <code>systemctl status avahi-daemon</code>. If this shows the
avahi-daemon is not running, control it with
<code>sudo systemctl [start,stop,enable,disable] avahi-daemon</code> (or
avahi-daemon.service). If UxPlay is seen, but the client fails to
connect when it is selected, there may be a firewall on the server that
@@ -641,8 +643,8 @@ an empty boundary frame of unused pixels (which would be lost in a
full-screen display that overscans, and is not displayed by gstreamer).
Recommendation: <strong>dont use this option</strong> unless there is
some special reason to use it.</p>
<p><strong>-fs</strong> uses fullscreen mode, but only works with
Wayland or VAAPI plugins.</p>
<p><strong>-fs</strong> uses fullscreen mode, but only works with X11,
Wayland or VAAPI.</p>
<p><strong>-p</strong> allows you to select the network ports used by
UxPlay (these need to be opened if the server is behind a firewall). By
itself, -p sets “legacy” ports TCP 7100, 7000, 7001, UDP 6000, 6001,
@@ -992,12 +994,11 @@ the client by the AirPlay server) to be set. The “features” code and
other settings are set in <code>UxPlay/lib/dnssdint.h</code>.</p>
<h1 id="changelog">Changelog</h1>
<p>1.59 2022-12-10 remove “ZOOMFIX” compile option and make compilation
with X11 dependence (that now provides a toggle into/out of X11
fullscreen mode with the F11 key) the default if X11 development
libraries are detected. (ZOOMFIX is then automatically applied for
GStreamer &lt; 1.20.) The cmake option -DNO_X11_DEPS now allows
compilation with no X11 dependence. Also reworked internal handling of
metadata.</p>
with X11-dependence the default if X11 development libraries are
detected (this now provides fullscreen mode with a F11 or Alt+Enter key
toggle); ZOOMFIX is automatically applied for GStreamer &lt; 1.20. The
cmake option -DNO_X11_DEPS allows compilation with no dependence on X11.
Reworked internal handling of metadata.</p>
<p>1.58 2022-10-29 Add option “-nohold” that will drop existing
connections when a new client connects. Update llhttp to v8.1.0.</p>
<p>1.57 2022-10-09 Minor fixes: (fix coredump on AUR on “stop

View File

@@ -196,7 +196,8 @@ zipfile downloads, "UxPlay" for "git clone" downloads), then follow the instruct
computer it is built on; when this is not the case, as when you are packaging
for a distribution, use the cmake option `-DNO_MARCH_NATIVE=ON`.
If you use X11 Windows on Linux or *BSD, and wish to toggle in/out of fullscreen mode with key F11,
If you use X11 Windows on Linux or *BSD, and wish to toggle in/out of fullscreen mode with a keypress
(F11 or Alt_L+Enter)
UxPlay needs to be built with a dependence on X11. Starting with UxPlay-1.59, this will be done by
default **IF** the X11 development libraries are installed and detected. Install these with
"`sudo apt-get install libx11-dev`". If GStreamer < 1.20 is detected, a fix ("ZOOMFIX") to a problem
@@ -239,7 +240,9 @@ Also install "**tools**" to get the utility gst-inspect-1.0 for
examining the GStreamer installation. If sound is not working, "**alsa**"", "**pulseaudio**",
or "**pipewire**" plugins may need to be installed, depending on how your audio is set up.
**Finally, run uxplay in a terminal window**. Use Ctrl-C (or close the window) to terminate it when done. If it is not seen by the
**Finally, run uxplay in a terminal window**. On some systems, you can toggle into and out of fullscreen mode
with F11 or (held-down left Alt)+Enter keys. Use Ctrl-C (or close the window)
to terminate it when done. If the UxPlay server is not seen by the
iOS client's drop-down "Screen Mirroring" panel, check that your DNS-SD
server (usually avahi-daemon) is running: do this in a terminal window
with ```systemctl status avahi-daemon```.
@@ -533,7 +536,7 @@ Options:
Recommendation: **don't use this option** unless there is some special
reason to use it.
**-fs** uses fullscreen mode, but only works with Wayland or VAAPI plugins.
**-fs** uses fullscreen mode, but only works with X11, Wayland or VAAPI.
**-p** allows you to select the network ports used by UxPlay (these need
to be opened if the server is behind a firewall). By itself, -p sets
@@ -824,11 +827,11 @@ The "features" code and other settings are set in `UxPlay/lib/dnssdint.h`.
# Changelog
1.59 2022-12-10 remove "ZOOMFIX" compile option and make compilation with X11 dependence (that now
provides a toggle into/out of X11 fullscreen mode with the F11 key) the default if
X11 development libraries are detected. (ZOOMFIX is then automatically applied for
GStreamer < 1.20.) The cmake option -DNO_X11_DEPS now allows compilation with no X11
dependence. Also reworked internal handling of metadata.
1.59 2022-12-10 remove "ZOOMFIX" compile option and make compilation with X11-dependence the
default if X11 development libraries are detected (this now provides fullscreen mode
with a F11 or Alt+Enter key toggle); ZOOMFIX is automatically applied
for GStreamer < 1.20. The cmake option -DNO_X11_DEPS allows compilation with no
dependence on X11. Reworked internal handling of metadata.
1.58 2022-10-29 Add option "-nohold" that will drop existing connections when a new client connects.
Update llhttp to v8.1.0.

View File

@@ -234,16 +234,16 @@ packaging for a distribution, use the cmake option
`-DNO_MARCH_NATIVE=ON`.
If you use X11 Windows on Linux or *BSD, and wish to toggle in/out of
fullscreen mode with key F11, UxPlay needs to be built with a dependence
on X11. Starting with UxPlay-1.59, this will be done by default **IF**
the X11 development libraries are installed and detected. Install these
with "`sudo apt-get install libx11-dev`". If GStreamer \< 1.20 is
detected, a fix ("ZOOMFIX") to a problem (fixed since GStreamer-1.20)
that prevents screen-sharing apps like Zoom from detecting (and sharing)
an X11 UxPlay window will also be made. If you wish to build UxPlay
*without\* any X11 dependence, use the cmake option `-DNO_X11_DEPS=ON`
(this is not necessary if the X11 development libraries are not
installed).
fullscreen mode with a keypress (F11 or Alt_L+Enter) UxPlay needs to be
built with a dependence on X11. Starting with UxPlay-1.59, this will be
done by default **IF** the X11 development libraries are installed and
detected. Install these with "`sudo apt-get install libx11-dev`". If
GStreamer \< 1.20 is detected, a fix ("ZOOMFIX") to a problem (fixed
since GStreamer-1.20) that prevents screen-sharing apps like Zoom from
detecting (and sharing) an X11 UxPlay window will also be made. If you
wish to build UxPlay *without\* any X11 dependence, use the cmake option
`-DNO_X11_DEPS=ON` (this is not necessary if the X11 development
libraries are not installed).
1. `sudo apt-get install libssl-dev libplist-dev`". (unless you need to
build OpenSSL and libplist from source).
@@ -284,10 +284,12 @@ gst-inspect-1.0 for examining the GStreamer installation. If sound is
not working, "**alsa**"","**pulseaudio**", or "**pipewire**" plugins may
need to be installed, depending on how your audio is set up.
**Finally, run uxplay in a terminal window**. Use Ctrl-C (or close the
window) to terminate it when done. If it is not seen by the iOS client's
drop-down "Screen Mirroring" panel, check that your DNS-SD server
(usually avahi-daemon) is running: do this in a terminal window with
**Finally, run uxplay in a terminal window**. On some systems, you can
toggle into and out of fullscreen mode with F11 or (held-down left
Alt)+Enter keys. Use Ctrl-C (or close the window) to terminate it when
done. If the UxPlay server is not seen by the iOS client's drop-down
"Screen Mirroring" panel, check that your DNS-SD server (usually
avahi-daemon) is running: do this in a terminal window with
`systemctl status avahi-daemon`. If this shows the avahi-daemon is not
running, control it with
`sudo systemctl [start,stop,enable,disable] avahi-daemon` (or
@@ -646,8 +648,7 @@ display that overscans, and is not displayed by gstreamer).
Recommendation: **don't use this option** unless there is some special
reason to use it.
**-fs** uses fullscreen mode, but only works with Wayland or VAAPI
plugins.
**-fs** uses fullscreen mode, but only works with X11, Wayland or VAAPI.
**-p** allows you to select the network ports used by UxPlay (these need
to be opened if the server is behind a firewall). By itself, -p sets
@@ -1022,12 +1023,11 @@ other settings are set in `UxPlay/lib/dnssdint.h`.
# Changelog
1.59 2022-12-10 remove "ZOOMFIX" compile option and make compilation
with X11 dependence (that now provides a toggle into/out of X11
fullscreen mode with the F11 key) the default if X11 development
libraries are detected. (ZOOMFIX is then automatically applied for
GStreamer \< 1.20.) The cmake option -DNO_X11_DEPS now allows
compilation with no X11 dependence. Also reworked internal handling of
metadata.
with X11-dependence the default if X11 development libraries are
detected (this now provides fullscreen mode with a F11 or Alt+Enter key
toggle); ZOOMFIX is automatically applied for GStreamer \< 1.20. The
cmake option -DNO_X11_DEPS allows compilation with no dependence on X11.
Reworked internal handling of metadata.
1.58 2022-10-29 Add option "-nohold" that will drop existing connections
when a new client connects. Update llhttp to v8.1.0.

View File

@@ -46,7 +46,7 @@ typedef enum videoflip_e {
typedef struct video_renderer_s video_renderer_t;
void video_renderer_init (logger_t *logger, const char *server_name, videoflip_t videoflip[2], const char *parser,
const char *decoder, const char *converter, const char *videosink);
const char *decoder, const char *converter, const char *videosink, const bool *fullscreen);
void video_renderer_start ();
void video_renderer_stop ();
void video_renderer_render_buffer (raop_ntp_t *ntp, unsigned char* data, int data_len, uint64_t pts, int nal_count);

View File

@@ -26,6 +26,7 @@
#include "x_display_fix.h"
static bool fullscreen = false;
static bool using_x11 = false;
static bool alt_keypress = false;
#endif
struct video_renderer_s {
@@ -119,7 +120,7 @@ void video_renderer_size(float *f_width_source, float *f_height_source, float *f
}
void video_renderer_init(logger_t *render_logger, const char *server_name, videoflip_t videoflip[2], const char *parser,
const char *decoder, const char *converter, const char *videosink) {
const char *decoder, const char *converter, const char *videosink, const bool *initial_fullscreen) {
GError *error = NULL;
GstCaps *caps = NULL;
logger = render_logger;
@@ -164,6 +165,7 @@ void video_renderer_init(logger_t *render_logger, const char *server_name, vide
g_assert(renderer->sink);
#ifdef X_DISPLAY_FIX
fullscreen = *initial_fullscreen;
renderer->server_name = server_name;
renderer->gst_window = NULL;
bool x_display_fix = false;
@@ -222,9 +224,10 @@ void video_renderer_render_buffer(raop_ntp_t *ntp, unsigned char* data, int data
#ifdef X_DISPLAY_FIX
if (renderer->gst_window && !(renderer->gst_window->window)) {
get_x_window(renderer->gst_window, renderer->server_name);
if (renderer->gst_window && ! using_x11) {
logger_log(logger, LOGGER_INFO, "\n*** X11 Windows detected: Use key F11 to toggle in/out of full-screen mode\n");
if (renderer->gst_window->window) {
logger_log(logger, LOGGER_INFO, "\n*** X11 Windows: Use key F11 or (left Alt)+Enter to toggle full-screen mode\n");
using_x11 = true;
set_fullscreen(renderer->gst_window, &fullscreen);
}
}
#endif
@@ -310,13 +313,20 @@ gboolean gstreamer_pipeline_bus_callback(GstBus *bus, GstMessage *message, gpoin
switch (e_type) {
case GST_NAVIGATION_EVENT_KEY_PRESS:
if (gst_navigation_event_parse_key_event (event, &key)) {
if (strcmp (key, "F11") == 0) {
if ((strcmp (key, "F11") == 0) || (alt_keypress && strcmp (key, "Return") == 0)) {
fullscreen = !(fullscreen);
set_fullscreen(renderer->gst_window->display, renderer->gst_window->window,
renderer->server_name, &fullscreen);
set_fullscreen(renderer->gst_window, &fullscreen);
} else if (strcmp (key, "Alt_L") == 0) {
alt_keypress = true;
}
}
break;
case GST_NAVIGATION_EVENT_KEY_RELEASE:
if (gst_navigation_event_parse_key_event (event, &key)) {
if (strcmp (key, "Alt_L") == 0) {
alt_keypress = false;;
}
}
break;
default:
break;
}

View File

@@ -77,29 +77,26 @@ void get_x_window(X11_Window_t * X11, const char * name) {
}
#endif
}
void set_fullscreen(Display* dpy, Window win, const char * name, bool* fullscreen)
{
// *fullscreen = !(*fullscreen);
void set_fullscreen(X11_Window_t * X11, bool * fullscreen) {
XClientMessageEvent msg = {
.type = ClientMessage,
.display = dpy,
.window = win,
.message_type = XInternAtom(dpy, "_NET_WM_STATE", True),
.display = X11->display,
.window = X11->window,
.message_type = XInternAtom(X11->display, "_NET_WM_STATE", True),
.format = 32,
.data = { .l = {
*fullscreen,
XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", True),
XInternAtom(X11->display, "_NET_WM_STATE_FULLSCREEN", True),
None,
0,
1
}}
};
Window root = XDefaultRootWindow(dpy);
win = enum_windows(name, dpy, root, 0);
if (win) {
XSendEvent(dpy, XRootWindow(dpy, XDefaultScreen(dpy)), False, SubstructureRedirectMask | SubstructureNotifyMask, (XEvent*) &msg);
XSync(dpy, False);
if (X11->window) {
XSendEvent(X11->display, XRootWindow(X11->display, XDefaultScreen(X11->display)),
False, SubstructureRedirectMask | SubstructureNotifyMask, (XEvent*) &msg);
XSync(X11->display, False);
}
}

View File

@@ -18,7 +18,7 @@ UxPlay 1.59: An open\-source AirPlay mirroring server based on RPiPlay
.TP
\fB\-o\fR Set display "overscanned" mode on (not usually needed)
.TP
\fB-fs\fR Full-screen (only with Wayland and VAAPI plugins)
\fB-fs\fR Full-screen (only works with X11, Wayland and VAAPI)
.TP
\fB\-p\fR Use legacy ports UDP 6000:6001:7011 TCP 7000:7001:7100
.TP
@@ -95,20 +95,20 @@ UxPlay 1.59: An open\-source AirPlay mirroring server based on RPiPlay
.TP
\fB\-vdmp\fR [n] Dump h264 video output to "fn.h264"; fn="videodump", change
.IP
with "-vdmp [n] filename". If [n] is given, file fn.x.h264
with "-vdmp [n] filename". If [n] is given, file fn.x.h264
.IP
x=1,2,.. opens whenever a new SPS/PPS NAL arrives, and <=n
x=1,2,.. opens whenever a new SPS/PPS NAL arrives, and <=n
.IP
NAL units are dumped.
NAL units are dumped.
.PP
.TP
\fB\-admp\fR [n] Dump audio output to "fn.x.fmt", fmt ={aac, alac, aud}, x
.IP
=1,2,..; fn="audiodump"; change with "-admp [n] filename".
=1,2,..; fn="audiodump"; change with "-admp [n] filename".
.IP
x increases when audio format changes. If n is given, <= n
x increases when audio format changes. If n is given, <= n
.IP
audio packets are dumped. "aud"= unknown format.
audio packets are dumped. "aud"= unknown format.
.PP
.TP
\fB\-d\fR Enable debug logging

View File

@@ -388,7 +388,7 @@ static void print_info (char *name) {
printf("-nh Do not add \"@hostname\" at the end of the AirPlay server name\n");
printf("-s wxh[@r]Set display resolution [refresh_rate] default 1920x1080[@60]\n");
printf("-o Set display \"overscanned\" mode on (not usually needed)\n");
printf("-fs Full-screen (only with Wayland and VAAPI plugins)\n");
printf("-fs Full-screen (only works with X11, Wayland and VAAPI)\n");
printf("-p Use legacy ports UDP 6000:6001:7011 TCP 7000:7001:7100\n");
printf("-p n Use TCP and UDP ports n,n+1,n+2. range %d-%d\n", LOWEST_ALLOWED_PORT, HIGHEST_PORT);
printf(" use \"-p n1,n2,n3\" to set each port, \"n1,n2\" for n3 = n2+1\n");
@@ -863,7 +863,7 @@ int main (int argc, char *argv[]) {
if (use_video) {
video_renderer_init(render_logger, server_name.c_str(), videoflip, video_parser.c_str(),
video_decoder.c_str(), video_converter.c_str(), videosink.c_str());
video_decoder.c_str(), video_converter.c_str(), videosink.c_str(), &fullscreen);
video_renderer_start();
}
@@ -907,7 +907,7 @@ int main (int argc, char *argv[]) {
if (use_video && close_window) {
video_renderer_destroy();
video_renderer_init(render_logger, server_name.c_str(), videoflip, video_parser.c_str(),
video_decoder.c_str(), video_converter.c_str(), videosink.c_str());
video_decoder.c_str(), video_converter.c_str(), videosink.c_str(), &fullscreen);
video_renderer_start();
}
if (reset_loop) goto reconnect;