mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-12-14 20:18:14 +00:00
Compare commits
77 Commits
dmabuf-tes
...
dxgi-hlsl
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6625cd733a | ||
|
|
b41840b010 | ||
|
|
2f36aaff5c | ||
|
|
200b7b732c | ||
|
|
eeea24ebfb | ||
|
|
54066094bd | ||
|
|
c5923b9b4d | ||
|
|
bde2eef175 | ||
|
|
e0bdd869d6 | ||
|
|
ccd0a0bcf9 | ||
|
|
742e41c2c3 | ||
|
|
3ed71a09f4 | ||
|
|
12d051d8c0 | ||
|
|
a6a6b8779a | ||
|
|
ad65561511 | ||
|
|
6b65c7e339 | ||
|
|
646f5b1be8 | ||
|
|
128a8938c6 | ||
|
|
2e515657dd | ||
|
|
1cf8e8c846 | ||
|
|
df5c648377 | ||
|
|
78df2073ff | ||
|
|
844a37a276 | ||
|
|
e658c2e0a2 | ||
|
|
b2ec60d2dc | ||
|
|
e6aa2b85a9 | ||
|
|
a3045e0b4a | ||
|
|
9cadb64942 | ||
|
|
82607a7d6f | ||
|
|
8d90c9c2a5 | ||
|
|
24d4fce17c | ||
|
|
8dba4b6c0b | ||
|
|
193977895b | ||
|
|
219c73edbe | ||
|
|
6522920ea1 | ||
|
|
e32b292cc1 | ||
|
|
53525847fd | ||
|
|
9d66a68403 | ||
|
|
07bcc54732 | ||
|
|
dab5618a6d | ||
|
|
ad43969c1a | ||
|
|
99333a03c1 | ||
|
|
45318aa653 | ||
|
|
f84165ac66 | ||
|
|
e4a8424fad | ||
|
|
880d8042a4 | ||
|
|
a629d24dc3 | ||
|
|
7c1bb13d70 | ||
|
|
9d5c543a53 | ||
|
|
063a859de1 | ||
|
|
4f4cf2be7d | ||
|
|
9759b5aa8f | ||
|
|
bbd0c7a99b | ||
|
|
c11748a76f | ||
|
|
d6b26b0eb1 | ||
|
|
fd0cc6aa10 | ||
|
|
80b9bda59d | ||
|
|
0c176acf94 | ||
|
|
0c3dce3ca6 | ||
|
|
3c85957b99 | ||
|
|
77ddcfe489 | ||
|
|
d228ef135e | ||
|
|
0afcf2c2ce | ||
|
|
75da66a090 | ||
|
|
11676d3d56 | ||
|
|
b13682a9ef | ||
|
|
642634293d | ||
|
|
01f9c2bfb5 | ||
|
|
9385b2de7a | ||
|
|
d2f7667fae | ||
|
|
cfef966603 | ||
|
|
4f09d5b771 | ||
|
|
b7b302334c | ||
|
|
28e74a73a4 | ||
|
|
996e1b2f7a | ||
|
|
0ee5751b3a | ||
|
|
e067db7bb4 |
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
@@ -1,4 +1,4 @@
|
||||
# Jonathan Rubenstein (JJRcop)
|
||||
# - Primary documentation manager. Does not require direct approval for every
|
||||
# - change, but should be consulted for large additions and changes.
|
||||
docs/ jrubcop@gmail.com
|
||||
/doc/ jrubcop@gmail.com
|
||||
|
||||
6
.github/workflows/build.yml
vendored
6
.github/workflows/build.yml
vendored
@@ -97,7 +97,7 @@ jobs:
|
||||
make -j$(nproc)
|
||||
|
||||
host-windows-cross:
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
@@ -183,8 +183,8 @@ jobs:
|
||||
sudo apt-get update
|
||||
- name: Install docs dependencies
|
||||
run: |
|
||||
sudo apt-get install python3-sphinx python3-sphinx-rtd-theme
|
||||
sudo pip3 install sphinxcontrib-spelling
|
||||
sudo apt-get install python3-sphinx python3-sphinx-rtd-theme \
|
||||
python3-sphinxcontrib.spelling
|
||||
- name: Build docs
|
||||
run: |
|
||||
cd doc
|
||||
|
||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -10,3 +10,8 @@ module/modules.order
|
||||
*/build
|
||||
__pycache__
|
||||
*.py[co]
|
||||
*/.vs
|
||||
idd/Debug
|
||||
idd/x64
|
||||
idd/LGIdd/x64
|
||||
idd/LGIdd/Debug
|
||||
|
||||
2
AUTHORS
2
AUTHORS
@@ -65,3 +65,5 @@ Leonard Fricke <leonard.fricke98@gmail.com> (Leo1998)
|
||||
David Meier <meier_david_91@hotmail.com> (Kenny.ch)
|
||||
Daniel Cordero <looking-glass@0xdc.io> (0xdc)
|
||||
esi <git@esibun.net> (esibun)
|
||||
MakiseKurisu <saberconer@gmail.com> (MakiseKurisu)
|
||||
Zenithal <i@zenithal.me> (ZenithalHourlyRate)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -17,6 +17,10 @@ add_library(displayserver_X11 STATIC
|
||||
x11.c
|
||||
atoms.c
|
||||
clipboard.c
|
||||
cursor.c
|
||||
|
||||
wm/default.c
|
||||
wm/i3.c
|
||||
)
|
||||
|
||||
add_definitions(-D GLX_GLXEXT_PROTOTYPES)
|
||||
@@ -24,9 +28,10 @@ add_definitions(-D GLX_GLXEXT_PROTOTYPES)
|
||||
target_link_libraries(displayserver_X11
|
||||
PkgConfig::DISPLAYSERVER_X11
|
||||
lg_common
|
||||
lg_resources
|
||||
)
|
||||
|
||||
target_include_directories(displayserver_X11
|
||||
PRIVATE
|
||||
src
|
||||
.
|
||||
)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
105
client/displayservers/X11/cursor.c
Normal file
105
client/displayservers/X11/cursor.c
Normal file
@@ -0,0 +1,105 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., 59
|
||||
* Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "cursor.h"
|
||||
#include "common/util.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
struct MemFile
|
||||
{
|
||||
const char * data;
|
||||
int size;
|
||||
int pos;
|
||||
};
|
||||
|
||||
static int x11cursor_read(XcursorFile *file, unsigned char * buf, int len)
|
||||
{
|
||||
struct MemFile * f = (struct MemFile *)file->closure;
|
||||
|
||||
if (f->pos == f->size)
|
||||
return 0;
|
||||
|
||||
len = min(f->size - f->pos, len);
|
||||
memcpy(buf, f->data + f->pos, len);
|
||||
f->pos += len;
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
static int x11cursor_write(XcursorFile *file, unsigned char * buf, int len)
|
||||
{
|
||||
errno = -EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int x11cursor_seek(XcursorFile *file, long offset, int whence)
|
||||
{
|
||||
struct MemFile * f = (struct MemFile *)file->closure;
|
||||
long target;
|
||||
|
||||
switch(whence)
|
||||
{
|
||||
case SEEK_SET:
|
||||
target = offset;
|
||||
break;
|
||||
|
||||
case SEEK_CUR:
|
||||
target = f->pos + offset;
|
||||
break;
|
||||
|
||||
case SEEK_END:
|
||||
target = f->size + offset;
|
||||
break;
|
||||
|
||||
default:
|
||||
errno = -EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (target < 0 || target > f->size)
|
||||
{
|
||||
errno = -EINVAL;
|
||||
return -1;
|
||||
}
|
||||
f->pos = target;
|
||||
return target;
|
||||
}
|
||||
|
||||
XcursorImages * x11cursor_load(const char * cursor, int size)
|
||||
{
|
||||
struct MemFile closure =
|
||||
{
|
||||
.data = cursor,
|
||||
.size = size,
|
||||
.pos = 0
|
||||
};
|
||||
|
||||
XcursorFile f =
|
||||
{
|
||||
.closure = &closure,
|
||||
.read = x11cursor_read,
|
||||
.write = x11cursor_write,
|
||||
.seek = x11cursor_seek
|
||||
};
|
||||
|
||||
return XcursorXcFileLoadAllImages(&f);
|
||||
}
|
||||
29
client/displayservers/X11/cursor.h
Normal file
29
client/displayservers/X11/cursor.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., 59
|
||||
* Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _H_X11DS_CURSOR_
|
||||
#define _H_X11DS_CURSOR_
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xcursor/Xcursor.h>
|
||||
|
||||
XcursorImages * x11cursor_load(const char * cursor, int size);
|
||||
|
||||
#endif
|
||||
39
client/displayservers/X11/wm.h
Normal file
39
client/displayservers/X11/wm.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., 59
|
||||
* Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _H_X11DS_WM_
|
||||
#define _H_X11DS_WM_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef struct X11WM
|
||||
{
|
||||
void (*setup)(void);
|
||||
bool (*init)(void);
|
||||
void (*deinit)(void);
|
||||
void (*setFullscreen)(bool enable);
|
||||
}
|
||||
X11WM;
|
||||
|
||||
extern X11WM X11WM_Default;
|
||||
extern X11WM X11WM_i3;
|
||||
|
||||
#endif
|
||||
71
client/displayservers/X11/wm/default.c
Normal file
71
client/displayservers/X11/wm/default.c
Normal file
@@ -0,0 +1,71 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., 59
|
||||
* Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _H_X11DS_WM_DEFAULT_
|
||||
#define _H_X11DS_WM_DEFAULT_
|
||||
|
||||
#include "wm.h"
|
||||
#include "x11.h"
|
||||
#include "atoms.h"
|
||||
|
||||
static void wm_default_setup(void)
|
||||
{
|
||||
}
|
||||
|
||||
static bool wm_default_init(void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static void wm_default_deinit(void)
|
||||
{
|
||||
}
|
||||
|
||||
static void wm_default_setFullscreen(bool enable)
|
||||
{
|
||||
XEvent e =
|
||||
{
|
||||
.xclient = {
|
||||
.type = ClientMessage,
|
||||
.send_event = true,
|
||||
.message_type = x11atoms._NET_WM_STATE,
|
||||
.format = 32,
|
||||
.window = x11.window,
|
||||
.data.l = {
|
||||
enable ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE,
|
||||
x11atoms._NET_WM_STATE_FULLSCREEN,
|
||||
0
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
XSendEvent(x11.display, DefaultRootWindow(x11.display), False,
|
||||
SubstructureNotifyMask | SubstructureRedirectMask, &e);
|
||||
};
|
||||
|
||||
X11WM X11WM_Default =
|
||||
{
|
||||
.setup = wm_default_setup,
|
||||
.init = wm_default_init,
|
||||
.deinit = wm_default_deinit,
|
||||
.setFullscreen = wm_default_setFullscreen
|
||||
};
|
||||
|
||||
#endif
|
||||
194
client/displayservers/X11/wm/i3.c
Normal file
194
client/displayservers/X11/wm/i3.c
Normal file
@@ -0,0 +1,194 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., 59
|
||||
* Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _H_X11DS_WM_DEFAULT_
|
||||
#define _H_X11DS_WM_DEFAULT_
|
||||
|
||||
#include "wm.h"
|
||||
#include "x11.h"
|
||||
#include "atoms.h"
|
||||
#include "common/debug.h"
|
||||
#include "common/option.h"
|
||||
#include "common/util.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
|
||||
static struct Option options[] =
|
||||
{
|
||||
// app options
|
||||
{
|
||||
.module = "i3",
|
||||
.name = "globalFullScreen",
|
||||
.description = "Use i3's global full screen feature (spans all monitors)",
|
||||
.type = OPTION_TYPE_BOOL,
|
||||
.value.x_bool = false,
|
||||
},
|
||||
{0}
|
||||
};
|
||||
|
||||
struct i3state
|
||||
{
|
||||
int sock;
|
||||
bool globalFullScreen;
|
||||
};
|
||||
|
||||
static struct i3state i3;
|
||||
|
||||
static void wm_i3_setup(void)
|
||||
{
|
||||
option_register(options);
|
||||
}
|
||||
|
||||
static bool wm_i3_init(void)
|
||||
{
|
||||
memset(&i3, 0, sizeof(i3));
|
||||
|
||||
i3.globalFullScreen = option_get_bool("i3", "globalFullScreen");
|
||||
|
||||
FILE * fd = popen("i3 --get-socketpath", "r");
|
||||
if (!fd)
|
||||
return false;
|
||||
|
||||
struct sockaddr_un addr = { .sun_family = AF_UNIX };
|
||||
char path[sizeof(addr.sun_path)];
|
||||
int pathLen;
|
||||
if ((pathLen = fread(path, 1, sizeof(path), fd)) <= 0)
|
||||
{
|
||||
pclose(fd);
|
||||
return false;
|
||||
}
|
||||
pclose(fd);
|
||||
|
||||
if(path[pathLen-1] == '\n')
|
||||
--pathLen;
|
||||
path[pathLen] = '\0';
|
||||
|
||||
i3.sock = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
if (i3.sock < 0)
|
||||
{
|
||||
DEBUG_ERROR("Failed to create socket for i3 IPC");
|
||||
return false;
|
||||
}
|
||||
|
||||
strncpy(addr.sun_path, path, sizeof(addr.sun_path));
|
||||
if (connect(i3.sock, (struct sockaddr *)&addr, sizeof(addr)) < 0)
|
||||
{
|
||||
DEBUG_ERROR("Failed to connect to the i3 IPC socket");
|
||||
perror("connect");
|
||||
goto err_socket;
|
||||
}
|
||||
|
||||
DEBUG_INFO("i3 IPC Connected");
|
||||
return true;
|
||||
|
||||
err_socket:
|
||||
close(i3.sock);
|
||||
return false;
|
||||
}
|
||||
|
||||
static void wm_i3_deinit(void)
|
||||
{
|
||||
close(i3.sock);
|
||||
}
|
||||
|
||||
static void wm_i3_setFullscreen(bool enable)
|
||||
{
|
||||
if (!i3.globalFullScreen)
|
||||
{
|
||||
X11WM_Default.setFullscreen(enable);
|
||||
return;
|
||||
}
|
||||
|
||||
struct i3Msg
|
||||
{
|
||||
char magic[6];
|
||||
uint32_t length;
|
||||
uint32_t type;
|
||||
char payload[0];
|
||||
}
|
||||
__attribute__((packed));
|
||||
|
||||
#define I3_IPC_TYPE_RUN_COMMAND 0
|
||||
|
||||
char cmd[128];
|
||||
int cmdLen = snprintf(cmd, sizeof(cmd),
|
||||
"[id=%lu] fullscreen toggle global",
|
||||
x11.window);
|
||||
|
||||
struct i3Msg *msg = alloca(sizeof(struct i3Msg) + cmdLen);
|
||||
memcpy(msg->magic, "i3-ipc", 6);
|
||||
msg->length = cmdLen;
|
||||
msg->type = I3_IPC_TYPE_RUN_COMMAND;
|
||||
memcpy(msg->payload, cmd, cmdLen);
|
||||
|
||||
int msgSize = sizeof(*msg) + msg->length;
|
||||
char * buf = (char *)msg;
|
||||
while(msgSize)
|
||||
{
|
||||
int wrote = write(i3.sock, buf, msgSize);
|
||||
if (wrote <= 0)
|
||||
{
|
||||
DEBUG_WARN("i3 IPC communication failure");
|
||||
return;
|
||||
}
|
||||
|
||||
buf += wrote;
|
||||
msgSize -= wrote;
|
||||
}
|
||||
|
||||
if ((msgSize = read(i3.sock, msg, sizeof(*msg))) < 0)
|
||||
{
|
||||
DEBUG_WARN("i3 IPC read failure");
|
||||
return;
|
||||
}
|
||||
|
||||
if (memcmp(msg->magic, "i3-ipc", 6) != 0 ||
|
||||
msg->type != I3_IPC_TYPE_RUN_COMMAND)
|
||||
{
|
||||
DEBUG_WARN("i3 IPC unexpected reply");
|
||||
return;
|
||||
}
|
||||
|
||||
// read and discard the payload
|
||||
while(msg->length)
|
||||
{
|
||||
int len = read(i3.sock, cmd, min(msg->length, sizeof(cmd)));
|
||||
if (len <= 0)
|
||||
{
|
||||
DEBUG_WARN("i3 IPC failed to read payload");
|
||||
return;
|
||||
}
|
||||
msg->length -= len;
|
||||
}
|
||||
};
|
||||
|
||||
X11WM X11WM_i3 =
|
||||
{
|
||||
.setup = wm_i3_setup,
|
||||
.init = wm_i3_init,
|
||||
.deinit = wm_i3_deinit,
|
||||
.setFullscreen = wm_i3_setFullscreen
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
@@ -23,7 +23,11 @@
|
||||
#include "x11.h"
|
||||
#include "atoms.h"
|
||||
#include "clipboard.h"
|
||||
#include "cursor.h"
|
||||
|
||||
#include "resources/icondata.h"
|
||||
#include "resources/no-input-cursor/16.xcur.h"
|
||||
#include "resources/no-input-cursor/32.xcur.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
@@ -53,10 +57,6 @@
|
||||
#include "common/event.h"
|
||||
#include "util.h"
|
||||
|
||||
#define _NET_WM_STATE_REMOVE 0
|
||||
#define _NET_WM_STATE_ADD 1
|
||||
#define _NET_WM_STATE_TOGGLE 2
|
||||
|
||||
struct X11DSState x11;
|
||||
|
||||
struct MwmHints
|
||||
@@ -166,6 +166,8 @@ static void x11DoPresent(uint64_t msc)
|
||||
|
||||
static void x11Setup(void)
|
||||
{
|
||||
X11WM_Default.setup();
|
||||
X11WM_i3 .setup();
|
||||
}
|
||||
|
||||
static bool x11Probe(void)
|
||||
@@ -230,6 +232,8 @@ static void x11CheckEWMHSupport(void)
|
||||
DEBUG_INFO("EWMH-complient window manager detected: %s", wmName);
|
||||
x11.ewmhSupport = true;
|
||||
|
||||
if (strcmp(wmName, "i3") == 0)
|
||||
x11.wm = &X11WM_i3;
|
||||
|
||||
XFree(wmName);
|
||||
out_supported:
|
||||
@@ -270,8 +274,9 @@ static bool x11Init(const LG_DSInitParams params)
|
||||
memset(&x11, 0, sizeof(x11));
|
||||
x11.xValuator = -1;
|
||||
x11.yValuator = -1;
|
||||
x11.display = XOpenDisplay(NULL);
|
||||
x11.display = XOpenDisplay(NULL);
|
||||
x11.jitRender = params.jitRender;
|
||||
x11.wm = &X11WM_Default;
|
||||
|
||||
XSetWindowAttributes swa =
|
||||
{
|
||||
@@ -369,6 +374,16 @@ static bool x11Init(const LG_DSInitParams params)
|
||||
// check for Extended Window Manager Hints support
|
||||
x11CheckEWMHSupport();
|
||||
|
||||
if (!x11.wm->init())
|
||||
{
|
||||
x11.wm = &X11WM_Default;
|
||||
if (!x11.wm->init())
|
||||
{
|
||||
DEBUG_ERROR("Failed to initialize the X11 window manager subsystem");
|
||||
goto fail_window;
|
||||
}
|
||||
}
|
||||
|
||||
if (x11atoms._NET_WM_PID)
|
||||
{
|
||||
pid_t pid = getpid();
|
||||
@@ -476,7 +491,7 @@ static bool x11Init(const LG_DSInitParams params)
|
||||
if (XIQueryVersion(x11.display, &major, &minor) != Success)
|
||||
{
|
||||
DEBUG_ERROR("Failed to query the XInput version");
|
||||
return false;
|
||||
goto fail_window;
|
||||
}
|
||||
|
||||
DEBUG_INFO("X11 XInput %d.%d in use", major, minor);
|
||||
@@ -615,29 +630,17 @@ static bool x11Init(const LG_DSInitParams params)
|
||||
XFreePixmap(x11.display, temp);
|
||||
}
|
||||
|
||||
/* create the square cursor */
|
||||
{
|
||||
static char data[] = { 0x07, 0x05, 0x07 };
|
||||
static char mask[] = { 0xff, 0xff, 0xff };
|
||||
XcursorImages * images;
|
||||
if (params.largeCursorDot)
|
||||
images = x11cursor_load(b_no_input_cursor_32_xcur,
|
||||
b_no_input_cursor_32_xcur_size);
|
||||
else
|
||||
images = x11cursor_load(b_no_input_cursor_16_xcur,
|
||||
b_no_input_cursor_16_xcur_size);
|
||||
|
||||
Colormap cmap = DefaultColormap(x11.display, DefaultScreen(x11.display));
|
||||
XColor colors[2] =
|
||||
{
|
||||
{ .pixel = BlackPixelOfScreen(DefaultScreenOfDisplay(x11.display)) },
|
||||
{ .pixel = WhitePixelOfScreen(DefaultScreenOfDisplay(x11.display)) }
|
||||
};
|
||||
|
||||
XQueryColors(x11.display, cmap, colors, 2);
|
||||
|
||||
Pixmap img = XCreateBitmapFromData(x11.display, x11.window, data, 3, 3);
|
||||
Pixmap msk = XCreateBitmapFromData(x11.display, x11.window, mask, 3, 3);
|
||||
|
||||
x11.cursors[LG_POINTER_SQUARE] = XCreatePixmapCursor(x11.display, img, msk,
|
||||
&colors[0], &colors[1], 1, 1);
|
||||
|
||||
XFreePixmap(x11.display, img);
|
||||
XFreePixmap(x11.display, msk);
|
||||
}
|
||||
x11.cursors[LG_POINTER_SQUARE] =
|
||||
XcursorImagesLoadCursor(x11.display, images);
|
||||
XcursorImagesDestroy(images);
|
||||
|
||||
/* initialize the rest of the cursors */
|
||||
const char * cursorLookup[LG_POINTER_COUNT] = {
|
||||
@@ -781,6 +784,7 @@ static void x11Free(void)
|
||||
if (x11.keysyms)
|
||||
XFree(x11.keysyms);
|
||||
|
||||
x11.wm->deinit();
|
||||
XCloseDisplay(x11.display);
|
||||
}
|
||||
|
||||
@@ -1964,24 +1968,7 @@ static void x11SetFullscreen(bool fs)
|
||||
if (x11.fullscreen == fs)
|
||||
return;
|
||||
|
||||
XEvent e =
|
||||
{
|
||||
.xclient = {
|
||||
.type = ClientMessage,
|
||||
.send_event = true,
|
||||
.message_type = x11atoms._NET_WM_STATE,
|
||||
.format = 32,
|
||||
.window = x11.window,
|
||||
.data.l = {
|
||||
fs ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE,
|
||||
x11atoms._NET_WM_STATE_FULLSCREEN,
|
||||
0
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
XSendEvent(x11.display, DefaultRootWindow(x11.display), False,
|
||||
SubstructureNotifyMask | SubstructureRedirectMask, &e);
|
||||
x11.wm->setFullscreen(fs);
|
||||
}
|
||||
|
||||
static bool x11GetFullscreen(void)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "interface/displayserver.h"
|
||||
#include "common/thread.h"
|
||||
#include "common/types.h"
|
||||
#include "wm.h"
|
||||
|
||||
enum Modifiers
|
||||
{
|
||||
@@ -48,11 +49,16 @@ enum Modifiers
|
||||
|
||||
#define MOD_COUNT (MOD_SUPER_RIGHT + 1)
|
||||
|
||||
#define _NET_WM_STATE_REMOVE 0
|
||||
#define _NET_WM_STATE_ADD 1
|
||||
#define _NET_WM_STATE_TOGGLE 2
|
||||
|
||||
struct X11DSState
|
||||
{
|
||||
Display * display;
|
||||
Window window;
|
||||
XVisualInfo * visual;
|
||||
X11WM * wm;
|
||||
|
||||
int minKeycode, maxKeycode;
|
||||
int symsPerKeycode;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
@@ -90,6 +90,7 @@ typedef struct LG_DSInitParams
|
||||
bool resizable;
|
||||
bool borderless;
|
||||
bool maximize;
|
||||
bool largeCursorDot;
|
||||
|
||||
// if true the renderer requires an OpenGL context
|
||||
bool opengl;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
@@ -72,6 +72,8 @@ LG_RendererRotate;
|
||||
typedef struct LG_RendererFormat
|
||||
{
|
||||
FrameType type; // frame type
|
||||
bool hdr; // if the frame is HDR or not
|
||||
bool hdrPQ; // if the HDR content is PQ mapped
|
||||
unsigned int screenWidth; // actual width of the host
|
||||
unsigned int screenHeight; // actual height of the host
|
||||
unsigned int frameWidth; // width of frame transmitted
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
@@ -50,6 +50,10 @@ struct DesktopShader
|
||||
GLint uScaleAlgo;
|
||||
GLint uNVGain;
|
||||
GLint uCBMode;
|
||||
GLint uIsHDR;
|
||||
GLint uMapHDRtoSDR;
|
||||
GLint uMapHDRGain;
|
||||
GLint uMapHDRPQ;
|
||||
};
|
||||
|
||||
struct EGL_Desktop
|
||||
@@ -64,6 +68,8 @@ struct EGL_Desktop
|
||||
|
||||
// internals
|
||||
int width, height;
|
||||
bool hdr;
|
||||
bool hdrPQ;
|
||||
LG_RendererRotate rotate;
|
||||
|
||||
bool useSpice;
|
||||
@@ -83,6 +89,11 @@ struct EGL_Desktop
|
||||
bool useDMA;
|
||||
LG_RendererFormat format;
|
||||
|
||||
// map HDR content to SDR
|
||||
bool mapHDRtoSDR;
|
||||
int peakLuminance;
|
||||
int maxCLL;
|
||||
|
||||
EGL_PostProcess * pp;
|
||||
_Atomic(bool) processFrame;
|
||||
};
|
||||
@@ -108,11 +119,15 @@ static bool egl_initDesktopShader(
|
||||
return false;
|
||||
}
|
||||
|
||||
shader->uTransform = egl_shaderGetUniform(shader->shader, "transform" );
|
||||
shader->uDesktopSize = egl_shaderGetUniform(shader->shader, "desktopSize");
|
||||
shader->uScaleAlgo = egl_shaderGetUniform(shader->shader, "scaleAlgo" );
|
||||
shader->uNVGain = egl_shaderGetUniform(shader->shader, "nvGain" );
|
||||
shader->uCBMode = egl_shaderGetUniform(shader->shader, "cbMode" );
|
||||
shader->uTransform = egl_shaderGetUniform(shader->shader, "transform" );
|
||||
shader->uDesktopSize = egl_shaderGetUniform(shader->shader, "desktopSize" );
|
||||
shader->uScaleAlgo = egl_shaderGetUniform(shader->shader, "scaleAlgo" );
|
||||
shader->uNVGain = egl_shaderGetUniform(shader->shader, "nvGain" );
|
||||
shader->uCBMode = egl_shaderGetUniform(shader->shader, "cbMode" );
|
||||
shader->uIsHDR = egl_shaderGetUniform(shader->shader, "isHDR" );
|
||||
shader->uMapHDRtoSDR = egl_shaderGetUniform(shader->shader, "mapHDRtoSDR" );
|
||||
shader->uMapHDRGain = egl_shaderGetUniform(shader->shader, "mapHDRGain" );
|
||||
shader->uMapHDRPQ = egl_shaderGetUniform(shader->shader, "mapHDRPQ" );
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -181,6 +196,10 @@ bool egl_desktopInit(EGL * egl, EGL_Desktop ** desktop_, EGLDisplay * display,
|
||||
desktop->scaleAlgo = option_get_int("egl", "scale" );
|
||||
desktop->useDMA = useDMA;
|
||||
|
||||
desktop->mapHDRtoSDR = option_get_bool("egl", "mapHDRtoSDR" );
|
||||
desktop->peakLuminance = option_get_int ("egl", "peakLuminance");
|
||||
desktop->maxCLL = option_get_int ("egl", "maxCLL" );
|
||||
|
||||
if (!egl_postProcessInit(&desktop->pp))
|
||||
{
|
||||
DEBUG_ERROR("Failed to initialize the post process manager");
|
||||
@@ -271,6 +290,28 @@ void egl_desktopConfigUI(EGL_Desktop * desktop)
|
||||
}
|
||||
igSliderInt("##nvgain", &desktop->nvGain, 0, desktop->nvMax, format, 0);
|
||||
igPopItemWidth();
|
||||
|
||||
bool mapHDRtoSDR = desktop->mapHDRtoSDR;
|
||||
int peakLuminance = desktop->peakLuminance;
|
||||
int maxCLL = desktop->maxCLL;
|
||||
|
||||
igSeparator();
|
||||
igCheckbox("Map HDR content to SDR", &mapHDRtoSDR);
|
||||
igSliderInt("Peak Luminance", &peakLuminance, 1, 10000,
|
||||
"%d nits",
|
||||
ImGuiInputTextFlags_CharsDecimal);
|
||||
igSliderInt("Max content light level", &maxCLL, 1, 10000,
|
||||
"%d nits", ImGuiInputTextFlags_CharsDecimal);
|
||||
|
||||
if (mapHDRtoSDR != desktop->mapHDRtoSDR ||
|
||||
peakLuminance != desktop->peakLuminance ||
|
||||
maxCLL != desktop->maxCLL)
|
||||
{
|
||||
desktop->mapHDRtoSDR = mapHDRtoSDR;
|
||||
desktop->peakLuminance = max(1, peakLuminance);
|
||||
desktop->maxCLL = max(1, maxCLL);
|
||||
app_invalidateWindow(true);
|
||||
}
|
||||
}
|
||||
|
||||
bool egl_desktopSetup(EGL_Desktop * desktop, const LG_RendererFormat format)
|
||||
@@ -303,6 +344,8 @@ bool egl_desktopSetup(EGL_Desktop * desktop, const LG_RendererFormat format)
|
||||
|
||||
desktop->width = format.frameWidth;
|
||||
desktop->height = format.frameHeight;
|
||||
desktop->hdr = format.hdr;
|
||||
desktop->hdrPQ = format.hdrPQ;
|
||||
|
||||
if (!egl_textureSetup(
|
||||
desktop->texture,
|
||||
@@ -454,6 +497,9 @@ bool egl_desktopRender(EGL_Desktop * desktop, unsigned int outputWidth,
|
||||
desktop->useDMA && texture == desktop->texture ?
|
||||
&desktop->dmaShader : &desktop->shader;
|
||||
|
||||
const float mapHDRGain =
|
||||
desktop->maxCLL / desktop->peakLuminance;
|
||||
|
||||
EGL_Uniform uniforms[] =
|
||||
{
|
||||
{
|
||||
@@ -481,6 +527,26 @@ bool egl_desktopRender(EGL_Desktop * desktop, unsigned int outputWidth,
|
||||
.type = EGL_UNIFORM_TYPE_1I,
|
||||
.location = shader->uCBMode,
|
||||
.f = { desktop->cbMode }
|
||||
},
|
||||
{
|
||||
.type = EGL_UNIFORM_TYPE_1I,
|
||||
.location = shader->uIsHDR,
|
||||
.i = { desktop->hdr }
|
||||
},
|
||||
{
|
||||
.type = EGL_UNIFORM_TYPE_1I,
|
||||
.location = shader->uMapHDRtoSDR,
|
||||
.i = { desktop->mapHDRtoSDR }
|
||||
},
|
||||
{
|
||||
.type = EGL_UNIFORM_TYPE_1F,
|
||||
.location = shader->uMapHDRGain,
|
||||
.f = { mapHDRGain }
|
||||
},
|
||||
{
|
||||
.type = EGL_UNIFORM_TYPE_1I,
|
||||
.location = shader->uMapHDRPQ,
|
||||
.f = { desktop->hdrPQ }
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
@@ -202,6 +202,27 @@ static struct Option egl_options[] =
|
||||
.type = OPTION_TYPE_BOOL,
|
||||
.value.x_bool = true
|
||||
},
|
||||
{
|
||||
.module = "egl",
|
||||
.name = "mapHDRtoSDR",
|
||||
.description = "Map HDR content to the SDR color space",
|
||||
.type = OPTION_TYPE_BOOL,
|
||||
.value.x_bool = true
|
||||
},
|
||||
{
|
||||
.module = "egl",
|
||||
.name = "peakLuminance",
|
||||
.description = "The peak luminance level in nits for HDR to SDR mapping",
|
||||
.type = OPTION_TYPE_INT,
|
||||
.value.x_int = 250,
|
||||
},
|
||||
{
|
||||
.module = "egl",
|
||||
.name = "maxCLL",
|
||||
.description = "Maximum content light level in nits for HDR to SDR mapping",
|
||||
.type = OPTION_TYPE_INT,
|
||||
.value.x_int = 10000,
|
||||
},
|
||||
|
||||
{0}
|
||||
};
|
||||
@@ -748,7 +769,7 @@ static bool egl_renderStartup(LG_Renderer * renderer, bool useDMA)
|
||||
|
||||
EGLint attr[] =
|
||||
{
|
||||
EGL_BUFFER_SIZE , 24,
|
||||
EGL_BUFFER_SIZE , 30,
|
||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
|
||||
EGL_SAMPLE_BUFFERS , maxSamples > 0 ? 1 : 0,
|
||||
EGL_SAMPLES , maxSamples,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
@@ -226,7 +226,7 @@ bool egl_shaderCompile(EGL_Shader * this, const char * vertex_code,
|
||||
}
|
||||
|
||||
const int diff = (strlen(replace) - strlen(search)) * instances;
|
||||
char * newCode = malloc(fragment_size + diff);
|
||||
char * newCode = malloc(fragment_size + diff + 1);
|
||||
if (!newCode)
|
||||
{
|
||||
DEBUG_ERROR("Out of memory");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -9,6 +9,7 @@ precision highp float;
|
||||
#define EGL_SCALE_MAX 3
|
||||
|
||||
#include "color_blind.h"
|
||||
#include "hdr.h"
|
||||
|
||||
in vec2 uv;
|
||||
out vec4 color;
|
||||
@@ -19,6 +20,10 @@ uniform int scaleAlgo;
|
||||
|
||||
uniform float nvGain;
|
||||
uniform int cbMode;
|
||||
uniform bool isHDR;
|
||||
uniform bool mapHDRtoSDR;
|
||||
uniform float mapHDRGain;
|
||||
uniform bool mapHDRPQ;
|
||||
|
||||
void main()
|
||||
{
|
||||
@@ -38,6 +43,9 @@ void main()
|
||||
}
|
||||
}
|
||||
|
||||
if (isHDR && mapHDRtoSDR)
|
||||
color.rgb = mapToSDR(color.rgb, mapHDRGain, mapHDRPQ);
|
||||
|
||||
if (cbMode > 0)
|
||||
color = cbTransform(color, cbMode);
|
||||
|
||||
|
||||
108
client/renderers/EGL/shader/hdr.h
Normal file
108
client/renderers/EGL/shader/hdr.h
Normal file
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
_______ _____ __ __ ____ __
|
||||
/ ____(_)___ ___ ____ ___ ____ _ / ___// /_ ____ _____/ /__ _____ / __ \____ ______/ /__
|
||||
/ / / / __ \/ _ \/ __ `__ \/ __ `/ \__ \/ __ \/ __ `/ __ / _ \/ ___/ / /_/ / __ `/ ___/ //_/
|
||||
/ /___/ / / / / __/ / / / / / /_/ / ___/ / / / / /_/ / /_/ / __/ / / ____/ /_/ / /__/ ,<
|
||||
\____/_/_/ /_/\___/_/ /_/ /_/\__,_/ /____/_/ /_/\__,_/\__,_/\___/_/ /_/ \__,_/\___/_/|_|
|
||||
http://en.sbence.hu/ Shader: Try to get the SDR part of HDR content
|
||||
*/
|
||||
|
||||
/**
|
||||
* Translated to GLSL, original source is:
|
||||
* https://github.com/VoidXH/Cinema-Shader-Pack
|
||||
*/
|
||||
|
||||
// Configuration ---------------------------------------------------------------
|
||||
const float knee = 0.75; // Compressor knee position
|
||||
const float ratio = 4.0; // Compressor ratio: 1 = disabled, <1 = expander
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// Precalculated values
|
||||
const float compressor = 1.0 / ratio;
|
||||
|
||||
// PQ constants
|
||||
const float m1inv = 16384.0 / 2610.0;
|
||||
const float m2inv = 32.0 / 2523.0;
|
||||
const float c1 = 3424.0 / 4096.0;
|
||||
const float c2 = 2413.0 / 128.0;
|
||||
const float c3 = 2392.0 / 128.0;
|
||||
|
||||
float minGain(vec3 pixel) { return min(pixel.r, min(pixel.g, pixel.b)); }
|
||||
float maxGain(vec3 pixel) { return max(pixel.r, max(pixel.g, pixel.b)); }
|
||||
float midGain(vec3 pixel)
|
||||
{
|
||||
return pixel.r < pixel.g ?
|
||||
(pixel.r < pixel.b ?
|
||||
min(pixel.g, pixel.b) : // min = r
|
||||
min(pixel.r, pixel.g)) : // min = b
|
||||
(pixel.g < pixel.b ?
|
||||
min(pixel.r, pixel.b) : // min = g
|
||||
min(pixel.r, pixel.g)); // min = b
|
||||
}
|
||||
|
||||
vec3 compress(vec3 pixel)
|
||||
{
|
||||
float maxGain = maxGain(pixel);
|
||||
return pixel * (maxGain < knee ? maxGain :
|
||||
knee + max(maxGain - knee, 0.0) * compressor) / maxGain;
|
||||
}
|
||||
|
||||
vec3 fixClip(vec3 pixel)
|
||||
{
|
||||
// keep the (mid - min) / (max - min) ratio
|
||||
float preMin = minGain(pixel);
|
||||
float preMid = midGain(pixel);
|
||||
float preMax = maxGain(pixel);
|
||||
vec3 clip = clamp(pixel, 0.0, 1.0);
|
||||
float postMin = minGain(clip);
|
||||
float postMid = midGain(clip);
|
||||
float postMax = maxGain(clip);
|
||||
float ratio = (preMid - preMin) / (preMax - preMin);
|
||||
float newMid = ratio * (postMax - postMin) + postMin;
|
||||
return vec3(clip.r != postMid ? clip.r : newMid,
|
||||
clip.g != postMid ? clip.g : newMid,
|
||||
clip.b != postMid ? clip.b : newMid);
|
||||
}
|
||||
|
||||
// Returns luminance in nits
|
||||
vec3 pq2lin(vec3 pq, float gain)
|
||||
{
|
||||
vec3 p = pow(pq, vec3(m2inv));
|
||||
vec3 d = max(p - c1, vec3(0.0)) / (c2 - c3 * p);
|
||||
return pow(d, vec3(m1inv)) * gain;
|
||||
}
|
||||
|
||||
vec3 srgb2lin(vec3 c)
|
||||
{
|
||||
vec3 v = c / 12.92;
|
||||
vec3 v2 = pow((c + vec3(0.055)) / 1.055, vec3(2.4));
|
||||
vec3 threshold = vec3(0.04045);
|
||||
vec3 result = mix(v, v2, greaterThanEqual(c, threshold));
|
||||
return result;
|
||||
}
|
||||
|
||||
vec3 lin2srgb(vec3 c)
|
||||
{
|
||||
vec3 v = c * 12.92;
|
||||
vec3 v2 = pow(c, vec3(1.0/2.4)) * 1.055 - 0.055;
|
||||
vec3 threshold = vec3(0.0031308);
|
||||
vec3 result = mix(v, v2, greaterThanEqual(c, threshold));
|
||||
return result;
|
||||
}
|
||||
|
||||
// in linear space
|
||||
vec3 bt2020to709(vec3 bt2020)
|
||||
{
|
||||
return vec3(
|
||||
bt2020.r * 1.6605 + bt2020.g * -0.5876 + bt2020.b * -0.0728,
|
||||
bt2020.r * -0.1246 + bt2020.g * 1.1329 + bt2020.b * -0.0083,
|
||||
bt2020.r * -0.0182 + bt2020.g * -0.1006 + bt2020.b * 1.1187);
|
||||
}
|
||||
|
||||
vec3 mapToSDR(vec3 color, float gain, bool pq)
|
||||
{
|
||||
if (pq)
|
||||
color = pq2lin(color.rgb, gain);
|
||||
color = bt2020to709(color);
|
||||
return lin2srgb(compress(color));
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
@@ -109,6 +109,7 @@ static bool egl_texFBUpdate(EGL_Texture * texture, const EGL_TexUpdate * update)
|
||||
rectsFramebufferToBuffer(
|
||||
damage->rects,
|
||||
damage->count,
|
||||
texture->format.bpp,
|
||||
parent->buf[parent->bufIndex].map,
|
||||
texture->format.stride,
|
||||
texture->format.height,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
@@ -53,7 +53,7 @@ bool egl_texUtilGetFormat(const EGL_TexSetup * setup, EGL_TexFormat * fmt)
|
||||
fmt->format = GL_RGBA;
|
||||
fmt->intFormat = GL_RGB10_A2;
|
||||
fmt->dataType = GL_UNSIGNED_INT_2_10_10_10_REV;
|
||||
fmt->fourcc = DRM_FORMAT_BGRA1010102;
|
||||
fmt->fourcc = DRM_FORMAT_BGRA2101010;
|
||||
break;
|
||||
|
||||
case EGL_PF_RGBA16F:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
@@ -64,7 +64,7 @@ void egl_texUtilUnmapBuffer(EGL_TexBuffer * buffer);
|
||||
((uint32_t)(c) << 16) | ((uint32_t)(d) << 24))
|
||||
#define DRM_FORMAT_ARGB8888 fourcc_code('A', 'R', '2', '4')
|
||||
#define DRM_FORMAT_ABGR8888 fourcc_code('A', 'B', '2', '4')
|
||||
#define DRM_FORMAT_BGRA1010102 fourcc_code('B', 'A', '3', '0')
|
||||
#define DRM_FORMAT_BGRA2101010 fourcc_code('A', 'B', '3', '0')
|
||||
#define DRM_FORMAT_ABGR16161616F fourcc_code('A', 'B', '4', 'H')
|
||||
|
||||
#define DRM_FORMAT_MOD_VENDOR_NONE 0
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
@@ -95,6 +95,9 @@ void app_updateCursorPos(double x, double y)
|
||||
|
||||
void app_handleFocusEvent(bool focused)
|
||||
{
|
||||
if (g_state.focused == focused)
|
||||
return;
|
||||
|
||||
g_state.focused = focused;
|
||||
|
||||
// release any imgui buttons/keys if we lost focus
|
||||
@@ -126,6 +129,9 @@ void app_handleFocusEvent(bool focused)
|
||||
if (g_params.minimizeOnFocusLoss)
|
||||
g_state.ds->minimize();
|
||||
}
|
||||
else
|
||||
if (g_params.captureOnFocus)
|
||||
core_setGrab(true);
|
||||
|
||||
g_cursor.realign = true;
|
||||
g_state.ds->realignPointer();
|
||||
@@ -656,8 +662,6 @@ MsgBoxHandle app_msgBox(const char * caption, const char * fmt, ...)
|
||||
MsgBoxHandle handle = overlayMsg_show(caption, NULL, NULL, fmt, args);
|
||||
va_end(args);
|
||||
|
||||
core_updateOverlayState();
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
@@ -669,8 +673,6 @@ MsgBoxHandle app_confirmMsgBox(const char * caption,
|
||||
MsgBoxHandle handle = overlayMsg_show(caption, callback, opaque, fmt, args);
|
||||
va_end(args);
|
||||
|
||||
core_updateOverlayState();
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
@@ -432,7 +432,8 @@ void audio_playbackStop(void)
|
||||
|
||||
void audio_playbackVolume(int channels, const uint16_t volume[])
|
||||
{
|
||||
if (!audio.audioDev || !audio.audioDev->playback.volume)
|
||||
if (!audio.audioDev || !audio.audioDev->playback.volume ||
|
||||
!g_params.audioSyncVolume)
|
||||
return;
|
||||
|
||||
// store the values so we can restore the state if the stream is restarted
|
||||
@@ -887,7 +888,8 @@ void audio_recordToggleKeybind(int sc, void * opaque)
|
||||
|
||||
void audio_recordVolume(int channels, const uint16_t volume[])
|
||||
{
|
||||
if (!audio.audioDev || !audio.audioDev->record.volume)
|
||||
if (!audio.audioDev || !audio.audioDev->record.volume ||
|
||||
!g_params.audioSyncVolume)
|
||||
return;
|
||||
|
||||
// store the values so we can restore the state if the stream is restarted
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
@@ -295,8 +295,22 @@ static struct Option options[] =
|
||||
.type = OPTION_TYPE_BOOL,
|
||||
.value.x_bool = false,
|
||||
},
|
||||
{
|
||||
.module = "win",
|
||||
.name = "requestActivation",
|
||||
.description = "Request activation when attention is needed",
|
||||
.type = OPTION_TYPE_BOOL,
|
||||
.value.x_bool = true
|
||||
},
|
||||
|
||||
// input options
|
||||
{
|
||||
.module = "input",
|
||||
.name = "captureOnFocus",
|
||||
.description = "Enable capture mode when the window becomes focused",
|
||||
.type = OPTION_TYPE_BOOL,
|
||||
.value.x_bool = false
|
||||
},
|
||||
{
|
||||
.module = "input",
|
||||
.name = "grabKeyboard",
|
||||
@@ -485,6 +499,13 @@ static struct Option options[] =
|
||||
.type = OPTION_TYPE_BOOL,
|
||||
.value.x_bool = true
|
||||
},
|
||||
{
|
||||
.module = "spice",
|
||||
.name = "largeCursorDot",
|
||||
.description = "Use a larger version of the \"dot\" cursor",
|
||||
.type = OPTION_TYPE_BOOL,
|
||||
.value.x_bool = false
|
||||
},
|
||||
|
||||
// audio options
|
||||
{
|
||||
@@ -517,6 +538,13 @@ static struct Option options[] =
|
||||
.type = OPTION_TYPE_BOOL,
|
||||
.value.x_bool = true
|
||||
},
|
||||
{
|
||||
.module = "audio",
|
||||
.name = "syncVolume",
|
||||
.description = "Synchronize the volume level with the guest",
|
||||
.type = OPTION_TYPE_BOOL,
|
||||
.value.x_bool = true
|
||||
},
|
||||
{0}
|
||||
};
|
||||
|
||||
@@ -620,27 +648,28 @@ bool config_load(int argc, char * argv[])
|
||||
g_params.framePollInterval = option_get_int ("app" , "framePollInterval" );
|
||||
g_params.allowDMA = option_get_bool ("app" , "allowDMA" );
|
||||
|
||||
g_params.windowTitle = option_get_string("win", "title" );
|
||||
g_params.autoResize = option_get_bool ("win", "autoResize" );
|
||||
g_params.allowResize = option_get_bool ("win", "allowResize" );
|
||||
g_params.keepAspect = option_get_bool ("win", "keepAspect" );
|
||||
g_params.forceAspect = option_get_bool ("win", "forceAspect" );
|
||||
g_params.dontUpscale = option_get_bool ("win", "dontUpscale" );
|
||||
g_params.intUpscale = option_get_bool ("win", "intUpscale" );
|
||||
g_params.shrinkOnUpscale = option_get_bool ("win", "shrinkOnUpscale" );
|
||||
g_params.borderless = option_get_bool ("win", "borderless" );
|
||||
g_params.fullscreen = option_get_bool ("win", "fullScreen" );
|
||||
g_params.maximize = option_get_bool ("win", "maximize" );
|
||||
g_params.fpsMin = option_get_int ("win", "fpsMin" );
|
||||
g_params.ignoreQuit = option_get_bool ("win", "ignoreQuit" );
|
||||
g_params.noScreensaver = option_get_bool ("win", "noScreensaver" );
|
||||
g_params.autoScreensaver = option_get_bool ("win", "autoScreensaver" );
|
||||
g_params.showAlerts = option_get_bool ("win", "alerts" );
|
||||
g_params.quickSplash = option_get_bool ("win", "quickSplash" );
|
||||
g_params.overlayDim = option_get_bool ("win", "overlayDimsDesktop");
|
||||
g_params.uiFont = option_get_string("win", "uiFont" );
|
||||
g_params.uiSize = option_get_int ("win", "uiSize" );
|
||||
g_params.jitRender = option_get_bool ("win", "jitRender" );
|
||||
g_params.windowTitle = option_get_string("win", "title" );
|
||||
g_params.autoResize = option_get_bool ("win", "autoResize" );
|
||||
g_params.allowResize = option_get_bool ("win", "allowResize" );
|
||||
g_params.keepAspect = option_get_bool ("win", "keepAspect" );
|
||||
g_params.forceAspect = option_get_bool ("win", "forceAspect" );
|
||||
g_params.dontUpscale = option_get_bool ("win", "dontUpscale" );
|
||||
g_params.intUpscale = option_get_bool ("win", "intUpscale" );
|
||||
g_params.shrinkOnUpscale = option_get_bool ("win", "shrinkOnUpscale" );
|
||||
g_params.borderless = option_get_bool ("win", "borderless" );
|
||||
g_params.fullscreen = option_get_bool ("win", "fullScreen" );
|
||||
g_params.maximize = option_get_bool ("win", "maximize" );
|
||||
g_params.fpsMin = option_get_int ("win", "fpsMin" );
|
||||
g_params.ignoreQuit = option_get_bool ("win", "ignoreQuit" );
|
||||
g_params.noScreensaver = option_get_bool ("win", "noScreensaver" );
|
||||
g_params.autoScreensaver = option_get_bool ("win", "autoScreensaver" );
|
||||
g_params.showAlerts = option_get_bool ("win", "alerts" );
|
||||
g_params.quickSplash = option_get_bool ("win", "quickSplash" );
|
||||
g_params.overlayDim = option_get_bool ("win", "overlayDimsDesktop");
|
||||
g_params.uiFont = option_get_string("win", "uiFont" );
|
||||
g_params.uiSize = option_get_int ("win", "uiSize" );
|
||||
g_params.jitRender = option_get_bool ("win", "jitRender" );
|
||||
g_params.requestActivation = option_get_bool ("win", "requestActivation" );
|
||||
|
||||
if (g_params.noScreensaver && g_params.autoScreensaver)
|
||||
{
|
||||
@@ -657,6 +686,7 @@ bool config_load(int argc, char * argv[])
|
||||
case 270: g_params.winRotate = LG_ROTATE_270; break;
|
||||
}
|
||||
|
||||
g_params.captureOnFocus = option_get_bool("input", "captureOnFocus" );
|
||||
g_params.grabKeyboard = option_get_bool("input", "grabKeyboard" );
|
||||
g_params.grabKeyboardOnFocus = option_get_bool("input", "grabKeyboardOnFocus" );
|
||||
g_params.releaseKeysOnFocusLoss = option_get_bool("input", "releaseKeysOnFocusLoss");
|
||||
@@ -705,11 +735,13 @@ bool config_load(int argc, char * argv[])
|
||||
g_params.captureOnStart = option_get_bool("spice", "captureOnStart");
|
||||
g_params.alwaysShowCursor = option_get_bool("spice", "alwaysShowCursor");
|
||||
g_params.showCursorDot = option_get_bool("spice", "showCursorDot");
|
||||
g_params.largeCursorDot = option_get_bool("spice", "largeCursorDot");
|
||||
}
|
||||
|
||||
g_params.audioPeriodSize = option_get_int("audio", "periodSize");
|
||||
g_params.audioBufferLatency = option_get_int("audio", "bufferLatency");
|
||||
g_params.micShowIndicator = option_get_bool("audio", "micShowIndicator");
|
||||
g_params.audioSyncVolume = option_get_bool("audio", "syncVolume");
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -725,7 +757,7 @@ static void doLicense(void)
|
||||
// BEGIN LICENSE BLOCK
|
||||
"\n"
|
||||
"Looking Glass\n"
|
||||
"Copyright © 2017-2022 The Looking Glass Authors\n"
|
||||
"Copyright © 2017-2023 The Looking Glass Authors\n"
|
||||
"https://looking-glass.io\n"
|
||||
"\n"
|
||||
"This program is free software; you can redistribute it and/or modify it under\n"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2022 The Looking Glass Authors
|
||||
* Copyright © 2017-2023 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user