简体   繁体   English

放大 Linux:简单 X11 windows 无法共享

[英]Zoom on Linux: simple X11 windows can't be shared

I'm using the Zoom video conference system on Ubuntu 20.04 with Gnome and X11 (not Wayland).我在 Ubuntu 20.04 和 Gnome 和 X11(不是 Wayland)上使用 Zoom 视频会议系统。

I wrote an application which directly uses X11 instructions ( XCreateSimpleWindow() ) to open a window.我编写了一个应用程序,它直接使用 X11 指令 ( XCreateSimpleWindow() ) 打开 window。 This window cannot be shared on Zoom;此 window 无法在 Zoom 上共享; it simply doesn't appear on the list of windows that can selected for sharing (my terminals, editors, web browsers appear in the list).它根本没有出现在可以选择共享的 windows 列表中(我的终端、编辑器、web 浏览器出现在列表中)。 It can be shared with "Share Screen Portion", though.不过,它可以与“共享屏幕部分”共享。

Does anyone know what qualities a window must have such that it can be shared in Zoom?有谁知道 window 必须具备哪些品质才能在 Zoom 中共享? Does my code have to register the window with some Linux / Gnome instance?我的代码是否必须将 window 注册到一些 Linux / Gnome 实例? Are there any requirements for event handling in my application?我的应用程序中的事件处理是否有任何要求?

Thanks a lot for your help!非常感谢你的帮助!

I think, I found a solution.我想,我找到了解决办法。 Apparently, Zoom only considers a window for sharing if the X11 property _NET_WM_NAME is set.显然,如果设置了 X11 属性_NET_WM_NAME ,Zoom 只会考虑使用 window 进行共享。 Here's how I do it from C++ (plain X11 code):以下是我从 C++ (普通 X11 代码)执行此操作的方法:

  // set _NET_WM_NAME: without this, the window is not visible for Zoom screen sharing
  // from https://gist.github.com/mattn/105615
  Atom net_wm_name_atom = XInternAtom(dsp, "_NET_WM_NAME", 0);
  Atom utf8_string_atom = XInternAtom(dsp, "UTF8_STRING", 0);
  const char *net_wm_name = "something";
  XChangeProperty(dsp, win, net_wm_name_atom, utf8_string_atom, 8, PropModeReplace,
          (unsigned char*) net_wm_name, strlen(net_wm_name));
  
  // map window to screen
  XMapWindow(dsp, win);

Now the window is no longer invisible for Zoom which means it appears in the list of windows which can be selected for screen sharing.现在 window 不再对 Zoom 不可见,这意味着它出现在 windows 列表中,可以选择用于屏幕共享。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM