summaryrefslogtreecommitdiff
path: root/emu/port/win-x11a.c
diff options
context:
space:
mode:
authorCharles.Forsyth <devnull@localhost>2008-04-15 15:17:35 +0000
committerCharles.Forsyth <devnull@localhost>2008-04-15 15:17:35 +0000
commit8ed08d8c468c352d02e6b5a6fe48fdfe4a565848 (patch)
tree1f9e8510501bee763637e2e87eca3dd6a7fe6bcf /emu/port/win-x11a.c
parente8b3830bf1091c3930cc7f624b0e6cef5e588b67 (diff)
20080415-1617
Diffstat (limited to 'emu/port/win-x11a.c')
-rw-r--r--emu/port/win-x11a.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/emu/port/win-x11a.c b/emu/port/win-x11a.c
index 2f73d943..b9a3b545 100644
--- a/emu/port/win-x11a.c
+++ b/emu/port/win-x11a.c
@@ -10,6 +10,7 @@
*/
#define _GNU_SOURCE 1
+#define XTHREADS
#include "dat.h"
#include "fns.h"
#undef log2
@@ -463,6 +464,7 @@ xkbdproc(void *arg)
/* BEWARE: the value of up is not defined for this proc on some systems */
+ XLockDisplay(xd); /* should be ours alone */
XSelectInput(xd, xdrawable, KeyPressMask);
for(;;){
XNextEvent(xd, &event);
@@ -495,6 +497,7 @@ xproc(void *arg)
ExposureMask|
StructureNotifyMask;
+ XLockDisplay(xd); /* should be ours alone */
XSelectInput(xd, xdrawable, mask);
for(;;){
XNextEvent(xd, &event);
@@ -676,6 +679,7 @@ xinitscreen(int xsize, int ysize, ulong c, ulong *chan, int *d)
dispname = getenv("DISPLAY");
if(dispname == nil)
dispname = "not set";
+ XInitThreads();
xdisplay = XOpenDisplay(NULL);
if(xdisplay == 0){
fprint(2, "emu: win-x11 open %r, DISPLAY is %s\n", dispname);
@@ -1414,12 +1418,23 @@ if(0) iprint("xselect target=%d requestor=%d property=%d selection=%d\n",
char*
clipread(void)
{
- return _xgetsnarf(xsnarfcon);
+ char *p;
+
+ if(xsnarfcon == nil)
+ return nil;
+ XLockDisplay(xsnarfcon);
+ p = _xgetsnarf(xsnarfcon);
+ XUnlockDisplay(xsnarfcon);
+ return p;
}
int
clipwrite(char *buf)
{
+ if(xsnarfcon == nil)
+ return 0;
+ XLockDisplay(xsnarfcon);
_xputsnarf(xsnarfcon, buf);
+ XUnlockDisplay(xsnarfcon);
return 0;
}