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;
}
//////////////////////////////////////////////////////////////////////////
////// GLFW platform API //////
//////////////////////////////////////////////////////////////////////////

6
glfw/x11_monitor.c vendored
View File

@ -349,7 +349,7 @@ void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor,
*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;
@ -595,7 +595,8 @@ void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
(unsigned short*) ramp->green,
(unsigned short*) ramp->blue);
}
else {
else
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"X11: Gamma ramp access not supported by server");
}
@ -619,3 +620,4 @@ GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* handle)
_GLFW_REQUIRE_INIT_OR_RETURN(None);
return monitor->x11.output;
}

22
glfw/x11_platform.h vendored
View File

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

24
glfw/x11_window.c vendored
View File

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