Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Luc Peurière <jlp@nerim.net>2008-03-14 02:54:02 +0300
committerJean-Luc Peurière <jlp@nerim.net>2008-03-14 02:54:02 +0300
commita68a7f42b02ad0260220d94f36ab61c772db071a (patch)
tree620b763cd24fbfc1259f00ccb005217914af0c6f /intern/ghost
parent526d0bec4722900a86d81ff0f5d71504b2b4ad8c (diff)
parent15215493bf9d1d08e650109e6eb6189fc76e289e (diff)
resolved conflict state with HEAD r14096
blenderbuttons still bad not let this compile
Diffstat (limited to 'intern/ghost')
-rw-r--r--intern/ghost/GHOST_C-api.h12
-rw-r--r--intern/ghost/GHOST_ISystem.h12
-rw-r--r--intern/ghost/intern/GHOST_C-api.cpp13
-rw-r--r--intern/ghost/intern/GHOST_DisplayManager.cpp2
-rw-r--r--intern/ghost/intern/GHOST_System.h15
-rw-r--r--intern/ghost/intern/GHOST_SystemCarbon.cpp68
-rw-r--r--intern/ghost/intern/GHOST_SystemCarbon.h18
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.cpp59
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.h14
-rw-r--r--[-rwxr-xr-x]intern/ghost/intern/GHOST_SystemX11.cpp171
-rw-r--r--[-rwxr-xr-x]intern/ghost/intern/GHOST_SystemX11.h15
-rw-r--r--[-rwxr-xr-x]intern/ghost/intern/GHOST_WindowX11.cpp27
12 files changed, 417 insertions, 9 deletions
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index 2b17b8f8c61..11b0204eacb 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -771,6 +771,18 @@ extern void GHOST_SetRectangleCenter(GHOST_RectangleHandle rectanglehandle,
*/
extern GHOST_TSuccess GHOST_ClipRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_RectangleHandle anotherrectanglehandle);
+
+/**
+ * Return the data from the clipboad
+ * @return clipboard data
+ */
+extern GHOST_TUns8* GHOST_getClipboard(int flag);
+
+/**
+ * Put data to the Clipboard
+ */
+extern void GHOST_putClipboard(GHOST_TInt8 *buffer, int flag);
+
#ifdef __cplusplus
}
#endif
diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h
index 381aac64de0..0cb860d8158 100644
--- a/intern/ghost/GHOST_ISystem.h
+++ b/intern/ghost/GHOST_ISystem.h
@@ -352,6 +352,18 @@ public:
*/
virtual GHOST_TSuccess getButtonState(GHOST_TButtonMask mask, bool& isDown) const = 0;
+ /**
+ * Returns the selection buffer
+ * @return Returns "unsinged char" from X11 XA_CUT_BUFFER0 buffer
+ *
+ */
+ virtual GHOST_TUns8* getClipboard(int flag) const = 0;
+
+ /**
+ * Put data to the Clipboard
+ */
+ virtual void putClipboard(GHOST_TInt8 *buffer, int flag) const = 0;
+
protected:
/**
* Initialize the system.
diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp
index 054cd507d1d..8c93788ee1b 100644
--- a/intern/ghost/intern/GHOST_C-api.cpp
+++ b/intern/ghost/intern/GHOST_C-api.cpp
@@ -817,3 +817,16 @@ GHOST_TSuccess GHOST_ClipRectangle(GHOST_RectangleHandle rectanglehandle,
return result;
}
+
+GHOST_TUns8* GHOST_getClipboard(int flag)
+{
+ GHOST_ISystem* system = GHOST_ISystem::getSystem();
+ return system->getClipboard(flag);
+}
+
+void GHOST_putClipboard(GHOST_TInt8 *buffer, int flag)
+{
+ GHOST_ISystem* system = GHOST_ISystem::getSystem();
+ system->putClipboard(buffer, flag);
+}
+
diff --git a/intern/ghost/intern/GHOST_DisplayManager.cpp b/intern/ghost/intern/GHOST_DisplayManager.cpp
index b36143ee1a9..f806daee86b 100644
--- a/intern/ghost/intern/GHOST_DisplayManager.cpp
+++ b/intern/ghost/intern/GHOST_DisplayManager.cpp
@@ -116,7 +116,7 @@ GHOST_DisplayManager::getDisplaySetting(
GHOST_TUns8 numDisplays;
success = getNumDisplays(numDisplays);
if (success == GHOST_kSuccess) {
- if (display < numDisplays && index < m_settings[display].size()) {
+ if (display < numDisplays && ((GHOST_TUns8)index < m_settings[display].size())) {
setting = m_settings[display][index];
}
else {
diff --git a/intern/ghost/intern/GHOST_System.h b/intern/ghost/intern/GHOST_System.h
index 4c797fbaa80..8477d70c42f 100644
--- a/intern/ghost/intern/GHOST_System.h
+++ b/intern/ghost/intern/GHOST_System.h
@@ -285,6 +285,21 @@ public:
*/
virtual GHOST_TSuccess getButtons(GHOST_Buttons& buttons) const = 0;
+ /**
+ * Returns the selection buffer
+ * @param flag Only used on X11
+ * @return Returns the clipboard data
+ *
+ */
+ virtual GHOST_TUns8* getClipboard(int flag) const = 0;
+
+ /**
+ * Put data to the Clipboard
+ * @param buffer The buffer to copy to the clipboard
+ * @param flag The clipboard to copy too only used on X11
+ */
+ virtual void putClipboard(GHOST_TInt8 *buffer, int flag) const = 0;
+
protected:
/**
* Initialize the system.
diff --git a/intern/ghost/intern/GHOST_SystemCarbon.cpp b/intern/ghost/intern/GHOST_SystemCarbon.cpp
index 7f1a2467d1a..cf4015815a9 100644
--- a/intern/ghost/intern/GHOST_SystemCarbon.cpp
+++ b/intern/ghost/intern/GHOST_SystemCarbon.cpp
@@ -1115,3 +1115,71 @@ OSStatus GHOST_SystemCarbon::sEventHandlerProc(EventHandlerCallRef handler, Even
return err;
}
+
+GHOST_TUns8* GHOST_SystemCarbon::getClipboard(int flag) const
+{
+ PasteboardRef inPasteboard;
+ PasteboardItemID itemID;
+ CFDataRef flavorData;
+ OSStatus err = noErr;
+ GHOST_TUns8 * temp_buff;
+ CFRange range;
+
+ err = PasteboardCreate(kPasteboardClipboard, &inPasteboard);
+ if(err != noErr) { return NULL;}
+
+ err = PasteboardSynchronize( inPasteboard );
+ if(err != noErr) { return NULL;}
+
+ err = PasteboardGetItemIdentifier( inPasteboard, 1, &itemID );
+ if(err != noErr) { return NULL;}
+
+ err = PasteboardCopyItemFlavorData( inPasteboard, itemID, CFSTR("public.utf8-plain-text"), &flavorData);
+ if(err != noErr) { return NULL;}
+
+ range = CFRangeMake(0, CFDataGetLength(flavorData));
+
+ temp_buff = (GHOST_TUns8*) malloc(range.length+1);
+
+ CFDataGetBytes(flavorData, range, (UInt8*)temp_buff);
+
+ temp_buff[range.length] = '\0';
+
+ if(temp_buff) {
+ return temp_buff;
+ } else {
+ return NULL;
+ }
+}
+
+void GHOST_SystemCarbon::putClipboard(GHOST_TInt8 *buffer, int flag) const
+{
+ if(flag == 1) {return;} //If Flag is 1 means the selection and is used on X11
+ PasteboardRef inPasteboard;
+ CFDataRef textData = NULL;
+ OSStatus err = noErr; /*For error checking*/
+
+ err = PasteboardCreate(kPasteboardClipboard, &inPasteboard);
+ if(err != noErr) { return;}
+
+ err = PasteboardSynchronize( inPasteboard );
+ if(err != noErr) { return;}
+
+ err = PasteboardClear( inPasteboard );
+ if(err != noErr) { return;}
+
+ textData = CFDataCreate(kCFAllocatorDefault, (UInt8*)buffer, strlen(buffer));
+
+ if (textData) {
+ err = PasteboardPutItemFlavor( inPasteboard, (PasteboardItemID)1, CFSTR("public.utf8-plain-text"), textData, 0);
+ if(err != noErr) {
+ if(textData) { CFRelease(textData);}
+ return;
+ }
+ }
+
+ if(textData) {
+ CFRelease(textData);
+ }
+}
+
diff --git a/intern/ghost/intern/GHOST_SystemCarbon.h b/intern/ghost/intern/GHOST_SystemCarbon.h
index f2e3a775701..68e2d059226 100644
--- a/intern/ghost/intern/GHOST_SystemCarbon.h
+++ b/intern/ghost/intern/GHOST_SystemCarbon.h
@@ -60,12 +60,12 @@ public:
/**
* Constructor.
*/
- GHOST_SystemCarbon::GHOST_SystemCarbon();
+ GHOST_SystemCarbon();
/**
* Destructor.
*/
- GHOST_SystemCarbon::~GHOST_SystemCarbon();
+ ~GHOST_SystemCarbon();
/***************************************************************************************
** Time(r) functionality
@@ -168,6 +168,20 @@ public:
*/
virtual GHOST_TSuccess getButtons(GHOST_Buttons& buttons) const;
+ /**
+ * Returns Clipboard data
+ * @param flag Indicate which buffer to return
+ * @return Returns the selected buffer
+ */
+ virtual GHOST_TUns8* getClipboard(int flag) const;
+
+ /**
+ * Puts buffer to system clipboard
+ * @param buffer The buffer to be copied
+ * @param flag Indicates which buffer to copy too Only used on X11
+ */
+ virtual void putClipboard(GHOST_TInt8 *buffer, int flag) const;
+
protected:
/**
* Initializes the system.
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index 5f4bfe9d668..c15e4f1246c 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -54,7 +54,7 @@
#define WM_MOUSEWHEEL 0x020A
#endif // WM_MOUSEWHEEL
#ifndef WHEEL_DELTA
-#define WHEEL_DELTA 120 /* Value for rolling one detent */
+#define WHEEL_DELTA 120 /* Value for rolling one detent, (old convention! MS changed it) */
#endif // WHEEL_DELTA
@@ -481,7 +481,11 @@ GHOST_EventWheel* GHOST_SystemWin32::processWheelEvent(GHOST_IWindow *window, WP
{
// short fwKeys = LOWORD(wParam); // key flags
int zDelta = (short) HIWORD(wParam); // wheel rotation
- zDelta /= WHEEL_DELTA;
+
+ // zDelta /= WHEEL_DELTA;
+ // temporary fix below: microsoft now has added more precision, making the above division not work
+ if (zDelta <= 0 ) zDelta= -1; else zDelta= 1;
+
// short xPos = (short) LOWORD(lParam); // horizontal position of pointer
// short yPos = (short) HIWORD(lParam); // vertical position of pointer
return new GHOST_EventWheel (getSystem()->getMilliSeconds(), window, zDelta);
@@ -893,3 +897,54 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
}
return lResult;
}
+
+GHOST_TUns8* GHOST_SystemWin32::getClipboard(int flag) const
+{
+ char *buffer;
+ char *temp_buff;
+
+ if ( OpenClipboard(NULL) ) {
+ HANDLE hData = GetClipboardData( CF_TEXT );
+ buffer = (char*)GlobalLock( hData );
+
+ temp_buff = (char*) malloc(strlen(buffer)+1);
+ strcpy(temp_buff, buffer);
+
+ GlobalUnlock( hData );
+ CloseClipboard();
+
+ temp_buff[strlen(buffer)] = '\0';
+ if (buffer) {
+ return (GHOST_TUns8*)temp_buff;
+ } else {
+ return NULL;
+ }
+ } else {
+ return NULL;
+ }
+}
+
+void GHOST_SystemWin32::putClipboard(GHOST_TInt8 *buffer, int flag) const
+{
+ if(flag == 1) {return;} //If Flag is 1 means the selection and is used on X11
+ if (OpenClipboard(NULL)) {
+ HLOCAL clipbuffer;
+ char *data;
+
+ if (buffer) {
+ EmptyClipboard();
+
+ clipbuffer = LocalAlloc(LMEM_FIXED,((strlen(buffer)+1)));
+ data = (char*)GlobalLock(clipbuffer);
+
+ strcpy(data, (char*)buffer);
+ data[strlen(buffer)] = '\0';
+ LocalUnlock(clipbuffer);
+ SetClipboardData(CF_TEXT,clipbuffer);
+ }
+ CloseClipboard();
+ } else {
+ return;
+ }
+}
+
diff --git a/intern/ghost/intern/GHOST_SystemWin32.h b/intern/ghost/intern/GHOST_SystemWin32.h
index 218fc5794eb..762e5a988a4 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.h
+++ b/intern/ghost/intern/GHOST_SystemWin32.h
@@ -170,6 +170,20 @@ public:
*/
virtual GHOST_TSuccess getButtons(GHOST_Buttons& buttons) const;
+ /**
+ * Returns unsinged char from CUT_BUFFER0
+ * @param flag Flag is not used on win32 on used on X11
+ * @return Returns the Clipboard
+ */
+ virtual GHOST_TUns8* getClipboard(int flag) const;
+
+ /**
+ * Puts buffer to system clipboard
+ * @param flag Flag is not used on win32 on used on X11
+ * @return No return
+ */
+ virtual void putClipboard(GHOST_TInt8 *buffer, int flag) const;
+
protected:
/**
* Initializes the system.
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index 9d4717b00ef..47bcb76441f 100755..100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -66,6 +66,7 @@
#include <unistd.h>
#include <vector>
+#include <stdio.h> // for fprintf only
typedef struct NDOFPlatformInfo {
Display *display;
@@ -79,6 +80,11 @@ typedef struct NDOFPlatformInfo {
static NDOFPlatformInfo sNdofInfo = {NULL, 0, NULL, 0, 0, 0, 0};
+
+//these are for copy and select copy
+static char *txt_cut_buffer= NULL;
+static char *txt_select_buffer= NULL;
+
using namespace std;
GHOST_SystemX11::
@@ -316,7 +322,7 @@ GHOST_SystemX11::processEvent(XEvent *xe)
if (!window) {
return;
}
-
+
switch (xe->type) {
case Expose:
{
@@ -510,8 +516,57 @@ GHOST_SystemX11::processEvent(XEvent *xe)
case MappingNotify:
case ReparentNotify:
break;
-
- default: {
+ case SelectionRequest:
+ {
+ XEvent nxe;
+ Atom target, string, compound_text, c_string;
+ XSelectionRequestEvent *xse = &xe->xselectionrequest;
+
+ target = XInternAtom(m_display, "TARGETS", False);
+ string = XInternAtom(m_display, "STRING", False);
+ compound_text = XInternAtom(m_display, "COMPOUND_TEXT", False);
+ c_string = XInternAtom(m_display, "C_STRING", False);
+
+ /* support obsolete clients */
+ if (xse->property == None) {
+ xse->property = xse->target;
+ }
+
+ nxe.xselection.type = SelectionNotify;
+ nxe.xselection.requestor = xse->requestor;
+ nxe.xselection.property = xse->property;
+ nxe.xselection.display = xse->display;
+ nxe.xselection.selection = xse->selection;
+ nxe.xselection.target = xse->target;
+ nxe.xselection.time = xse->time;
+
+ /*Check to see if the requestor is asking for String*/
+ if(xse->target == string || xse->target == compound_text || xse->target == c_string) {
+ if (xse->selection == XInternAtom(m_display, "PRIMARY", False)) {
+ XChangeProperty(m_display, xse->requestor, xse->property, xse->target, 8, PropModeReplace, (unsigned char*)txt_select_buffer, strlen(txt_select_buffer));
+ } else if (xse->selection == XInternAtom(m_display, "CLIPBOARD", False)) {
+ XChangeProperty(m_display, xse->requestor, xse->property, xse->target, 8, PropModeReplace, (unsigned char*)txt_cut_buffer, strlen(txt_cut_buffer));
+ }
+ } else if (xse->target == target) {
+ Atom alist[4];
+ alist[0] = target;
+ alist[1] = string;
+ alist[2] = compound_text;
+ alist[3] = c_string;
+ XChangeProperty(m_display, xse->requestor, xse->property, xse->target, 32, PropModeReplace, (unsigned char*)alist, 4);
+ XFlush(m_display);
+ } else {
+ //Change property to None because we do not support anything but STRING
+ nxe.xselection.property = None;
+ }
+
+ //Send the event to the client 0 0 == False, SelectionNotify
+ XSendEvent(m_display, xse->requestor, 0, 0, &nxe);
+ XFlush(m_display);
+ break;
+ }
+
+ default: {
if(xe->type == window->GetXTablet().MotionEvent)
{
XDeviceMotionEvent* data = (XDeviceMotionEvent*)xe;
@@ -893,3 +948,113 @@ convertXKey(
}
#undef GXMAP
+
+ GHOST_TUns8*
+GHOST_SystemX11::
+getClipboard(int flag
+) const {
+ //Flag
+ //0 = Regular clipboard 1 = selection
+ static Atom Primary_atom, clip_String, compound_text;
+ Atom rtype;
+ Window m_window, owner;
+ unsigned char *data, *tmp_data;
+ int bits;
+ unsigned long len, bytes;
+ XEvent xevent;
+
+ vector<GHOST_IWindow *> & win_vec = m_windowManager->getWindows();
+ vector<GHOST_IWindow *>::iterator win_it = win_vec.begin();
+ GHOST_WindowX11 * window = static_cast<GHOST_WindowX11 *>(*win_it);
+ m_window = window->getXWindow();
+
+ clip_String = XInternAtom(m_display, "_BLENDER_STRING", False);
+ compound_text = XInternAtom(m_display, "COMPOUND_TEXT", False);
+
+ //lets check the owner and if it is us then return the static buffer
+ if(flag == 0) {
+ Primary_atom = XInternAtom(m_display, "CLIPBOARD", False);
+ owner = XGetSelectionOwner(m_display, Primary_atom);
+ if (owner == m_window) {
+ data = (unsigned char*) malloc(strlen(txt_cut_buffer));
+ strcpy((char*)data, txt_cut_buffer);
+ return (GHOST_TUns8*)data;
+ } else if (owner == None) {
+ return NULL;
+ }
+ } else {
+ Primary_atom = XInternAtom(m_display, "PRIMARY", False);
+ owner = XGetSelectionOwner(m_display, Primary_atom);
+ if (owner == m_window) {
+ data = (unsigned char*) malloc(strlen(txt_select_buffer));
+ strcpy((char*)data, txt_select_buffer);
+ return (GHOST_TUns8*)data;
+ } else if (owner == None) {
+ return NULL;
+ }
+ }
+
+ if(!Primary_atom) {
+ return NULL;
+ }
+
+ XDeleteProperty(m_display, m_window, Primary_atom);
+ XConvertSelection(m_display, Primary_atom, compound_text, clip_String, m_window, CurrentTime); //XA_STRING
+ XFlush(m_display);
+
+ //This needs to change so we do not wait for ever or check owner first
+ while(1) {
+ XNextEvent(m_display, &xevent);
+ if(xevent.type == SelectionNotify) {
+ if(XGetWindowProperty(m_display, m_window, xevent.xselection.property, 0L, 4096L, False, AnyPropertyType, &rtype, &bits, &len, &bytes, &data) == Success) {
+ tmp_data = (unsigned char*) malloc(strlen((char*)data));
+ strcpy((char*)tmp_data, (char*)data);
+ XFree(data);
+ return (GHOST_TUns8*)tmp_data;
+ }
+ return NULL;
+ }
+ }
+}
+
+ void
+GHOST_SystemX11::
+putClipboard(
+GHOST_TInt8 *buffer, int flag) const
+{
+ static Atom Primary_atom;
+ Window m_window, owner;
+
+ if(!buffer) {return;}
+
+ if(flag == 0) {
+ Primary_atom = XInternAtom(m_display, "CLIPBOARD", False);
+ if(txt_cut_buffer) { free((void*)txt_cut_buffer); }
+
+ txt_cut_buffer = (char*) malloc(strlen(buffer));
+ strcpy(txt_cut_buffer, buffer);
+ } else {
+ Primary_atom = XInternAtom(m_display, "PRIMARY", False);
+ if(txt_select_buffer) { free((void*)txt_select_buffer); }
+
+ txt_select_buffer = (char*) malloc(strlen(buffer));
+ strcpy(txt_select_buffer, buffer);
+ }
+
+ vector<GHOST_IWindow *> & win_vec = m_windowManager->getWindows();
+ vector<GHOST_IWindow *>::iterator win_it = win_vec.begin();
+ GHOST_WindowX11 * window = static_cast<GHOST_WindowX11 *>(*win_it);
+ m_window = window->getXWindow();
+
+ if(!Primary_atom) {
+ return;
+ }
+
+ XSetSelectionOwner(m_display, Primary_atom, m_window, CurrentTime);
+ owner = XGetSelectionOwner(m_display, Primary_atom);
+ if (owner != m_window)
+ fprintf(stderr, "failed to own primary\n");
+
+ return;
+}
+
diff --git a/intern/ghost/intern/GHOST_SystemX11.h b/intern/ghost/intern/GHOST_SystemX11.h
index e6adff44155..1c100bee852 100755..100644
--- a/intern/ghost/intern/GHOST_SystemX11.h
+++ b/intern/ghost/intern/GHOST_SystemX11.h
@@ -201,6 +201,21 @@ public:
volatile GHOST_TEventNDOFData *current_values
);
+ /**
+ * Returns unsinged char from CUT_BUFFER0
+ * @param flag Flag indicates which buffer to return 0 for clipboard 1 for selection
+ * @return Returns the Clipboard indicated by Flag
+ */
+ GHOST_TUns8*
+ getClipboard(int flag) const;
+
+ /**
+ * Puts buffer to system clipboard
+ * @param buffer The buffer to copy to the clipboard
+ * @param flag Flag indicates which buffer to set ownership of 0 for clipboard 1 for selection
+ */
+ virtual void putClipboard(GHOST_TInt8 *buffer, int flag) const;
+
private :
Display * m_display;
diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp
index 056b5756587..1b9b3c491d5 100755..100644
--- a/intern/ghost/intern/GHOST_WindowX11.cpp
+++ b/intern/ghost/intern/GHOST_WindowX11.cpp
@@ -38,6 +38,13 @@
#include <X11/cursorfont.h>
#include <X11/Xatom.h>
+#if defined(__sun__) || defined( __sun ) || defined (__sparc) || defined (__sparc__)
+#include <strings.h>
+#endif
+
+#include <cstring>
+#include <cstdio>
+
// For obscure full screen mode stuuf
// lifted verbatim from blut.
@@ -168,6 +175,7 @@ GHOST_WindowX11(
if (m_visual == NULL) {
// barf : no visual meeting these requirements could be found.
+ printf("%s:%d: X11 glxChooseVisual() failed for OpenGL, verify working openGL system!\n", __FILE__, __LINE__);
return;
}
@@ -196,7 +204,7 @@ GHOST_WindowX11(
KeyPressMask | KeyReleaseMask |
EnterWindowMask | LeaveWindowMask |
ButtonPressMask | ButtonReleaseMask |
- PointerMotionMask | FocusChangeMask;
+ PointerMotionMask | FocusChangeMask | PropertyChangeMask;
// create the window!
@@ -758,6 +766,15 @@ validate(
GHOST_WindowX11::
~GHOST_WindowX11(
){
+ static Atom Primary_atom, Clipboard_atom;
+ Window p_owner, c_owner;
+ /*Change the owner of the Atoms to None if we are the owner*/
+ Primary_atom = XInternAtom(m_display, "PRIMARY", False);
+ Clipboard_atom = XInternAtom(m_display, "CLIPBOARD", False);
+
+ p_owner = XGetSelectionOwner(m_display, Primary_atom);
+ c_owner = XGetSelectionOwner(m_display, Clipboard_atom);
+
std::map<unsigned int, Cursor>::iterator it = m_standard_cursors.begin();
for (; it != m_standard_cursors.end(); it++) {
XFreeCursor(m_display, it->second);
@@ -776,6 +793,14 @@ GHOST_WindowX11::
}
glXDestroyContext(m_display, m_context);
}
+
+ if (p_owner == m_window) {
+ XSetSelectionOwner(m_display, Primary_atom, None, CurrentTime);
+ }
+ if (c_owner == m_window) {
+ XSetSelectionOwner(m_display, Clipboard_atom, None, CurrentTime);
+ }
+
XDestroyWindow(m_display, m_window);
XFree(m_visual);
}