mirror of
https://github.com/raysan5/raylib.git
synced 2026-04-25 08:13:58 -04:00
REVIEWED: Code formating
This commit is contained in:
@ -1067,8 +1067,8 @@ Image GetClipboardImage(void)
|
|||||||
|
|
||||||
#elif defined(__linux__) && defined(_GLFW_X11)
|
#elif defined(__linux__) && defined(_GLFW_X11)
|
||||||
|
|
||||||
// Implementation based on https://github.com/ColleagueRiley/Clipboard-Copy-Paste/blob/main/x11.c
|
// REF: https://github.com/ColleagueRiley/Clipboard-Copy-Paste/blob/main/x11.c
|
||||||
Display* dpy = XOpenDisplay(NULL);
|
Display *dpy = XOpenDisplay(NULL);
|
||||||
if (!dpy) return image;
|
if (!dpy) return image;
|
||||||
|
|
||||||
Window root = DefaultRootWindow(dpy);
|
Window root = DefaultRootWindow(dpy);
|
||||||
@ -1090,19 +1090,21 @@ Image GetClipboardImage(void)
|
|||||||
XConvertSelection(dpy, clipboard, targetType, property, win, CurrentTime);
|
XConvertSelection(dpy, clipboard, targetType, property, win, CurrentTime);
|
||||||
|
|
||||||
// Wait for the SelectionNotify event
|
// Wait for the SelectionNotify event
|
||||||
XEvent ev;
|
XEvent ev = { 0 };
|
||||||
XNextEvent(dpy, &ev);
|
XNextEvent(dpy, &ev);
|
||||||
|
|
||||||
Atom actualType;
|
Atom actualType = { 0 };
|
||||||
int actualFormat;
|
int actualFormat = 0;
|
||||||
unsigned long nitems, bytesAfter;
|
unsigned long nitems = 0;
|
||||||
unsigned char* data = NULL;
|
unsigned long bytesAfter = 0;
|
||||||
|
unsigned char *data = NULL;
|
||||||
|
|
||||||
// Read the data from our ghost window's property
|
// Read the data from our ghost window's property
|
||||||
XGetWindowProperty(dpy, win, property, 0, ~0L, False, AnyPropertyType,
|
XGetWindowProperty(dpy, win, property, 0, ~0L, False, AnyPropertyType,
|
||||||
&actualType, &actualFormat, &nitems, &bytesAfter, &data);
|
&actualType, &actualFormat, &nitems, &bytesAfter, &data);
|
||||||
|
|
||||||
if (data != NULL) {
|
if (data != NULL)
|
||||||
|
{
|
||||||
image = LoadImageFromMemory(".png", data, (int)nitems);
|
image = LoadImageFromMemory(".png", data, (int)nitems);
|
||||||
XFree(data);
|
XFree(data);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1025,8 +1025,8 @@ Image GetClipboardImage(void)
|
|||||||
|
|
||||||
#elif defined(__linux__) && defined(DRGFW_X11)
|
#elif defined(__linux__) && defined(DRGFW_X11)
|
||||||
|
|
||||||
// Implementation based on https://github.com/ColleagueRiley/Clipboard-Copy-Paste/blob/main/x11.c
|
// REF: https://github.com/ColleagueRiley/Clipboard-Copy-Paste/blob/main/x11.c
|
||||||
Display* dpy = XOpenDisplay(NULL);
|
Display *dpy = XOpenDisplay(NULL);
|
||||||
if (!dpy) return image;
|
if (!dpy) return image;
|
||||||
|
|
||||||
Window root = DefaultRootWindow(dpy);
|
Window root = DefaultRootWindow(dpy);
|
||||||
@ -1048,19 +1048,21 @@ Image GetClipboardImage(void)
|
|||||||
XConvertSelection(dpy, clipboard, targetType, property, win, CurrentTime);
|
XConvertSelection(dpy, clipboard, targetType, property, win, CurrentTime);
|
||||||
|
|
||||||
// Wait for the SelectionNotify event
|
// Wait for the SelectionNotify event
|
||||||
XEvent ev;
|
XEvent ev = { 0 };
|
||||||
XNextEvent(dpy, &ev);
|
XNextEvent(dpy, &ev);
|
||||||
|
|
||||||
Atom actualType;
|
Atom actualType = { 0 };
|
||||||
int actualFormat;
|
int actualFormat = 0;
|
||||||
unsigned long nitems, bytesAfter;
|
unsigned long nitems = 0;
|
||||||
unsigned char* data = NULL;
|
unsigned long bytesAfter = 0;
|
||||||
|
unsigned char *data = NULL;
|
||||||
|
|
||||||
// Read the data from our ghost window's property
|
// Read the data from our ghost window's property
|
||||||
XGetWindowProperty(dpy, win, property, 0, ~0L, False, AnyPropertyType,
|
XGetWindowProperty(dpy, win, property, 0, ~0L, False, AnyPropertyType,
|
||||||
&actualType, &actualFormat, &nitems, &bytesAfter, &data);
|
&actualType, &actualFormat, &nitems, &bytesAfter, &data);
|
||||||
|
|
||||||
if (data != NULL) {
|
if (data != NULL)
|
||||||
|
{
|
||||||
image = LoadImageFromMemory(".png", data, (int)nitems);
|
image = LoadImageFromMemory(".png", data, (int)nitems);
|
||||||
XFree(data);
|
XFree(data);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user