Merge branch 'diff_glfw_upstream' of https://github.com/Luflosi/kitty

This commit is contained in:
Kovid Goyal 2019-06-12 05:17:15 +05:30
commit 7091d554b5
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
4 changed files with 32 additions and 21 deletions

1
glfw/x11_init.c vendored
View File

@ -611,6 +611,7 @@ Cursor _glfwCreateCursorX11(const GLFWimage* image, int xhot, int yhot)
return cursor; return cursor;
} }
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
////// GLFW platform API ////// ////// GLFW platform API //////
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////

6
glfw/x11_monitor.c vendored
View File

@ -349,7 +349,7 @@ void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor,
*yscale = _glfw.x11.contentScaleY; *yscale = _glfw.x11.contentScaleY;
} }
void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor, int* xpos, int* ypos, int *width, int *height) void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height)
{ {
int areaX = 0, areaY = 0, areaWidth = 0, areaHeight = 0; int areaX = 0, areaY = 0, areaWidth = 0, areaHeight = 0;
@ -595,7 +595,8 @@ void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
(unsigned short*) ramp->green, (unsigned short*) ramp->green,
(unsigned short*) ramp->blue); (unsigned short*) ramp->blue);
} }
else { else
{
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"X11: Gamma ramp access not supported by server"); "X11: Gamma ramp access not supported by server");
} }
@ -619,3 +620,4 @@ GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* handle)
_GLFW_REQUIRE_INIT_OR_RETURN(None); _GLFW_REQUIRE_INIT_OR_RETURN(None);
return monitor->x11.output; return monitor->x11.output;
} }

22
glfw/x11_platform.h vendored
View File

@ -182,11 +182,11 @@ typedef struct _GLFWwindowX11
Colormap colormap; Colormap colormap;
Window handle; Window handle;
bool iconified; bool iconified;
bool maximized; bool maximized;
// Whether the visual supports framebuffer transparency // Whether the visual supports framebuffer transparency
bool transparent; bool transparent;
// Cached position and size used to filter out duplicate events // Cached position and size used to filter out duplicate events
int width, height; int width, height;
@ -284,14 +284,14 @@ typedef struct _GLFWlibraryX11
Atom RESOURCE_MANAGER; Atom RESOURCE_MANAGER;
struct { struct {
bool available; bool available;
void* handle; void* handle;
int eventBase; int eventBase;
int errorBase; int errorBase;
int major; int major;
int minor; int minor;
bool gammaBroken; bool gammaBroken;
bool monitorBroken; bool monitorBroken;
PFN_XRRAllocGamma AllocGamma; PFN_XRRAllocGamma AllocGamma;
PFN_XRRFreeCrtcInfo FreeCrtcInfo; PFN_XRRFreeCrtcInfo FreeCrtcInfo;
PFN_XRRFreeGamma FreeGamma; PFN_XRRFreeGamma FreeGamma;
@ -336,7 +336,7 @@ typedef struct _GLFWlibraryX11
} xcursor; } xcursor;
struct { struct {
bool available; bool available;
void* handle; void* handle;
int major; int major;
int minor; int minor;
@ -346,7 +346,7 @@ typedef struct _GLFWlibraryX11
} xinerama; } xinerama;
struct { struct {
bool available; bool available;
void* handle; void* handle;
int eventBase; int eventBase;
int errorBase; int errorBase;
@ -357,7 +357,7 @@ typedef struct _GLFWlibraryX11
} vidmode; } vidmode;
struct { struct {
bool available; bool available;
void* handle; void* handle;
int majorOpcode; int majorOpcode;
int eventBase; int eventBase;
@ -369,7 +369,7 @@ typedef struct _GLFWlibraryX11
} xi; } xi;
struct { struct {
bool available; bool available;
void* handle; void* handle;
int major; int major;
int minor; int minor;
@ -406,6 +406,7 @@ typedef struct _GLFWcursorX11
} _GLFWcursorX11; } _GLFWcursorX11;
void _glfwPollMonitorsX11(void); void _glfwPollMonitorsX11(void);
void _glfwSetVideoModeX11(_GLFWmonitor* monitor, const GLFWvidmode* desired); void _glfwSetVideoModeX11(_GLFWmonitor* monitor, const GLFWvidmode* desired);
void _glfwRestoreVideoModeX11(_GLFWmonitor* monitor); void _glfwRestoreVideoModeX11(_GLFWmonitor* monitor);
@ -424,3 +425,4 @@ void _glfwInputErrorX11(int error, const char* message);
void _glfwGetSystemContentScaleX11(float* xscale, float* yscale, bool bypass_cache); void _glfwGetSystemContentScaleX11(float* xscale, float* yscale, bool bypass_cache);
void _glfwPushSelectionToManagerX11(void); void _glfwPushSelectionToManagerX11(void);

24
glfw/x11_window.c vendored
View File

@ -51,6 +51,7 @@
#define _GLFW_XDND_VERSION 5 #define _GLFW_XDND_VERSION 5
// Wait for data to arrive using poll // Wait for data to arrive using poll
// This avoids blocking other threads via the per-display Xlib lock that also // This avoids blocking other threads via the per-display Xlib lock that also
// covers GLX functions // covers GLX functions
@ -2245,13 +2246,14 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
if (window->monitor) if (window->monitor)
{ {
if (!_glfwPlatformWindowVisible(window)) if (!_glfwPlatformWindowVisible(window))
{ {
XMapRaised(_glfw.x11.display, window->x11.handle); XMapRaised(_glfw.x11.display, window->x11.handle);
waitForVisibilityNotify(window); waitForVisibilityNotify(window);
} }
updateWindowMode(window);
acquireMonitor(window); updateWindowMode(window);
acquireMonitor(window);
} }
else else
{ {
@ -2294,10 +2296,13 @@ int _glfwPlatformWindowMaximized(_GLFWwindow* window)
Atom* states; Atom* states;
unsigned long i; unsigned long i;
bool maximized = false; bool maximized = false;
if (!_glfw.x11.NET_WM_STATE || if (!_glfw.x11.NET_WM_STATE ||
!_glfw.x11.NET_WM_STATE_MAXIMIZED_VERT || !_glfw.x11.NET_WM_STATE_MAXIMIZED_VERT ||
!_glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ) !_glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ)
{
return maximized; return maximized;
}
const unsigned long count = const unsigned long count =
_glfwGetWindowPropertyX11(window->x11.handle, _glfwGetWindowPropertyX11(window->x11.handle,
_glfw.x11.NET_WM_STATE, _glfw.x11.NET_WM_STATE,
@ -2891,3 +2896,4 @@ GLFWAPI unsigned long long glfwDBusUserNotify(const char *app_name, const char*
GLFWAPI void glfwDBusSetUserNotificationHandler(GLFWDBusnotificationactivatedfun handler) { GLFWAPI void glfwDBusSetUserNotificationHandler(GLFWDBusnotificationactivatedfun handler) {
glfw_dbus_set_user_notification_activated_handler(handler); glfw_dbus_set_user_notification_activated_handler(handler);
} }