1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-10-08 15:17:25 -04:00

Made clipboard string member name consistent.

This commit is contained in:
Camilla Berglund 2014-08-21 21:14:29 +02:00
parent 44c899ce70
commit e5d890a1aa
3 changed files with 18 additions and 20 deletions

View File

@ -110,8 +110,8 @@ static Atom writeTargetToProperty(const XSelectionRequestEvent* request)
targets[i], targets[i],
8, 8,
PropModeReplace, PropModeReplace,
(unsigned char*) _glfw.x11.selection.string, (unsigned char*) _glfw.x11.clipboardString,
strlen(_glfw.x11.selection.string)); strlen(_glfw.x11.clipboardString));
} }
else else
targets[i + 1] = None; targets[i + 1] = None;
@ -162,8 +162,8 @@ static Atom writeTargetToProperty(const XSelectionRequestEvent* request)
request->target, request->target,
8, 8,
PropModeReplace, PropModeReplace,
(unsigned char*) _glfw.x11.selection.string, (unsigned char*) _glfw.x11.clipboardString,
strlen(_glfw.x11.selection.string)); strlen(_glfw.x11.clipboardString));
return request->property; return request->property;
} }
@ -181,8 +181,8 @@ static Atom writeTargetToProperty(const XSelectionRequestEvent* request)
void _glfwHandleSelectionClear(XEvent* event) void _glfwHandleSelectionClear(XEvent* event)
{ {
free(_glfw.x11.selection.string); free(_glfw.x11.clipboardString);
_glfw.x11.selection.string = NULL; _glfw.x11.clipboardString = NULL;
} }
void _glfwHandleSelectionRequest(XEvent* event) void _glfwHandleSelectionRequest(XEvent* event)
@ -253,8 +253,8 @@ void _glfwPushSelectionToManager(_GLFWwindow* window)
void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string) void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string)
{ {
free(_glfw.x11.selection.string); free(_glfw.x11.clipboardString);
_glfw.x11.selection.string = strdup(string); _glfw.x11.clipboardString = strdup(string);
XSetSelectionOwner(_glfw.x11.display, XSetSelectionOwner(_glfw.x11.display,
_glfw.x11.CLIPBOARD, _glfw.x11.CLIPBOARD,
@ -281,11 +281,11 @@ const char* _glfwPlatformGetClipboardString(_GLFWwindow* window)
{ {
// Instead of doing a large number of X round-trips just to put this // Instead of doing a large number of X round-trips just to put this
// string into a window property and then read it back, just return it // string into a window property and then read it back, just return it
return _glfw.x11.selection.string; return _glfw.x11.clipboardString;
} }
free(_glfw.x11.selection.string); free(_glfw.x11.clipboardString);
_glfw.x11.selection.string = NULL; _glfw.x11.clipboardString = NULL;
for (i = 0; i < formatCount; i++) for (i = 0; i < formatCount; i++)
{ {
@ -311,7 +311,7 @@ const char* _glfwPlatformGetClipboardString(_GLFWwindow* window)
event.xselection.target, event.xselection.target,
(unsigned char**) &data)) (unsigned char**) &data))
{ {
_glfw.x11.selection.string = strdup(data); _glfw.x11.clipboardString = strdup(data);
} }
XFree(data); XFree(data);
@ -320,16 +320,16 @@ const char* _glfwPlatformGetClipboardString(_GLFWwindow* window)
event.xselection.requestor, event.xselection.requestor,
event.xselection.property); event.xselection.property);
if (_glfw.x11.selection.string) if (_glfw.x11.clipboardString)
break; break;
} }
if (_glfw.x11.selection.string == NULL) if (_glfw.x11.clipboardString == NULL)
{ {
_glfwInputError(GLFW_FORMAT_UNAVAILABLE, _glfwInputError(GLFW_FORMAT_UNAVAILABLE,
"X11: Failed to convert selection to string"); "X11: Failed to convert selection to string");
} }
return _glfw.x11.selection.string; return _glfw.x11.clipboardString;
} }

View File

@ -730,7 +730,7 @@ void _glfwPlatformTerminate(void)
_glfw.x11.cursor = (Cursor) 0; _glfw.x11.cursor = (Cursor) 0;
} }
free(_glfw.x11.selection.string); free(_glfw.x11.clipboardString);
_glfwTerminateJoysticks(); _glfwTerminateJoysticks();
_glfwTerminateContextAPI(); _glfwTerminateContextAPI();

View File

@ -114,6 +114,8 @@ typedef struct _GLFWlibraryX11
Cursor cursor; Cursor cursor;
XContext context; XContext context;
char* clipboardString;
// Window manager atoms // Window manager atoms
Atom WM_PROTOCOLS; Atom WM_PROTOCOLS;
Atom WM_STATE; Atom WM_STATE;
@ -206,10 +208,6 @@ typedef struct _GLFWlibraryX11
int exposure; int exposure;
} saver; } saver;
struct {
char* string;
} selection;
struct { struct {
Window source; Window source;
} xdnd; } xdnd;