dix: Modify callers of property and selection API to use new interfaces.
This commit is contained in:
parent
cc76ea6e3a
commit
ef60632e20
|
@ -172,12 +172,11 @@ xf86CreateRootWindow(WindowPtr pWin)
|
|||
Atom prop;
|
||||
|
||||
prop = MakeAtom(pProp->name, strlen(pProp->name), TRUE);
|
||||
err = ChangeWindowProperty(pWin,
|
||||
err = dixChangeWindowProperty(serverClient, pWin,
|
||||
prop, pProp->type,
|
||||
pProp->format, PropModeReplace,
|
||||
pProp->size, pProp->data,
|
||||
FALSE
|
||||
);
|
||||
FALSE);
|
||||
}
|
||||
|
||||
/* Look at err */
|
||||
|
|
|
@ -115,7 +115,7 @@ GetPropString(
|
|||
if(atom != BAD_RESOURCE)
|
||||
{
|
||||
WindowPtr pPropWin;
|
||||
int n;
|
||||
int rc, n;
|
||||
|
||||
/*
|
||||
* The atom has been defined, but it might only exist as a
|
||||
|
@ -124,15 +124,12 @@ GetPropString(
|
|||
for(pPropWin = pWin; pPropWin != (WindowPtr)NULL;
|
||||
pPropWin = pPropWin->parent)
|
||||
{
|
||||
for(pProp = (PropertyPtr)(wUserProps(pPropWin));
|
||||
pProp != (PropertyPtr)NULL;
|
||||
pProp = pProp->next)
|
||||
{
|
||||
if (pProp->propertyName == atom)
|
||||
break;
|
||||
}
|
||||
if(pProp != (PropertyPtr)NULL)
|
||||
rc = dixLookupProperty(&pProp, pPropWin, atom,
|
||||
serverClient, DixReadAccess);
|
||||
if (rc == Success)
|
||||
break;
|
||||
else
|
||||
pProp = NULL;
|
||||
}
|
||||
if(pProp == (PropertyPtr)NULL)
|
||||
return (char *)NULL;
|
||||
|
|
|
@ -128,8 +128,8 @@ PclCreateWindow(
|
|||
{
|
||||
propName = MakeAtom(propStrings[i], strlen(propStrings[i]),
|
||||
TRUE);
|
||||
ChangeWindowProperty(pWin, propName, XA_STRING, 8,
|
||||
PropModeReplace, strlen(propVal),
|
||||
dixChangeWindowProperty(serverClient, pWin, propName, XA_STRING,
|
||||
8, PropModeReplace, strlen(propVal),
|
||||
(pointer)propVal, FALSE);
|
||||
xfree(propVal);
|
||||
}
|
||||
|
|
|
@ -175,7 +175,7 @@ GetPropString(
|
|||
if(atom != BAD_RESOURCE)
|
||||
{
|
||||
WindowPtr pPropWin;
|
||||
int n;
|
||||
int rc, n;
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -186,15 +186,12 @@ GetPropString(
|
|||
for(pPropWin = pWin; pPropWin != (WindowPtr)NULL;
|
||||
pPropWin = pPropWin->parent)
|
||||
{
|
||||
for(pProp = (PropertyPtr)(wUserProps(pPropWin));
|
||||
pProp != (PropertyPtr)NULL;
|
||||
pProp = pProp->next)
|
||||
{
|
||||
if (pProp->propertyName == atom)
|
||||
break;
|
||||
}
|
||||
if(pProp != (PropertyPtr)NULL)
|
||||
rc = dixLookupProperty(&pProp, pPropWin, atom,
|
||||
serverClient, DixReadAccess);
|
||||
if (rc == Success)
|
||||
break;
|
||||
else
|
||||
pProp = NULL;
|
||||
}
|
||||
if(pProp == (PropertyPtr)NULL)
|
||||
return (char *)NULL;
|
||||
|
|
|
@ -154,8 +154,8 @@ PsCreateWindow(WindowPtr pWin)
|
|||
{
|
||||
propName = MakeAtom(propStrings[i], strlen(propStrings[i]),
|
||||
TRUE);
|
||||
ChangeWindowProperty(pWin, propName, XA_STRING, 8,
|
||||
PropModeReplace, strlen(propVal),
|
||||
dixChangeWindowProperty(serverClient, pWin, propName, XA_STRING,
|
||||
8, PropModeReplace, strlen(propVal),
|
||||
(pointer)propVal, FALSE);
|
||||
xfree(propVal);
|
||||
}
|
||||
|
|
|
@ -154,8 +154,8 @@ AppleWMSetScreenOrigin(
|
|||
data[1] = (dixScreenOrigins[pWin->drawable.pScreen->myNum].y
|
||||
+ darwinMainScreenY);
|
||||
|
||||
ChangeWindowProperty(pWin, xa_native_screen_origin(), XA_INTEGER,
|
||||
32, PropModeReplace, 2, data, TRUE);
|
||||
dixChangeWindowProperty(serverClient, pWin, xa_native_screen_origin(),
|
||||
XA_INTEGER, 32, PropModeReplace, 2, data, TRUE);
|
||||
}
|
||||
|
||||
/* Window managers can set the _APPLE_NO_ORDER_IN property on windows
|
||||
|
@ -169,15 +169,11 @@ AppleWMDoReorderWindow(
|
|||
{
|
||||
Atom atom;
|
||||
PropertyPtr prop;
|
||||
int rc;
|
||||
|
||||
atom = xa_apple_no_order_in();
|
||||
for (prop = wUserProps(pWin); prop != NULL; prop = prop->next)
|
||||
{
|
||||
if (prop->propertyName == atom && prop->type == atom)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
rc = dixLookupProperty(&prop, pWin, atom, serverClient, DixReadAccess);
|
||||
return (rc == Success) && (prop->type == atom);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -43,9 +43,6 @@
|
|||
#include "selection.h"
|
||||
#include "globals.h"
|
||||
|
||||
extern Selection *CurrentSelections;
|
||||
extern int NumCurrentSelections;
|
||||
|
||||
|
||||
// Helper function to read the X11 cut buffer
|
||||
// FIXME: What about multiple screens? Currently, this reads the first
|
||||
|
@ -54,18 +51,16 @@ extern int NumCurrentSelections;
|
|||
// Returns NULL if there is no cut text or there is not enough memory.
|
||||
static char * QuartzReadCutBuffer(void)
|
||||
{
|
||||
int i;
|
||||
int rc, i;
|
||||
char *text = NULL;
|
||||
|
||||
for (i = 0; i < screenInfo.numScreens; i++) {
|
||||
ScreenPtr pScreen = screenInfo.screens[i];
|
||||
PropertyPtr pProp;
|
||||
|
||||
pProp = wUserProps (WindowTable[pScreen->myNum]);
|
||||
while (pProp && pProp->propertyName != XA_CUT_BUFFER0) {
|
||||
pProp = pProp->next;
|
||||
}
|
||||
if (! pProp) continue;
|
||||
rc = dixLookupProperty(&pProp, WindowTable[pScreen->myNum],
|
||||
XA_CUT_BUFFER0, serverClient, DixReadAccess);
|
||||
if (rc != Success) continue;
|
||||
if (pProp->type != XA_STRING) continue;
|
||||
if (pProp->format != 8) continue;
|
||||
|
||||
|
@ -108,43 +103,40 @@ void QuartzReadPasteboard(void)
|
|||
|
||||
if ((text && oldText && !strequal(text, oldText)) ||
|
||||
(text && !oldText)) {
|
||||
int scrn, sel;
|
||||
int scrn, rc;
|
||||
Selection *pSel;
|
||||
|
||||
for (scrn = 0; scrn < screenInfo.numScreens; scrn++) {
|
||||
ScreenPtr pScreen = screenInfo.screens[scrn];
|
||||
// Set the cut buffers on each screen
|
||||
// fixme really on each screen?
|
||||
ChangeWindowProperty(WindowTable[pScreen->myNum], XA_CUT_BUFFER0,
|
||||
XA_STRING, 8, PropModeReplace,
|
||||
dixChangeWindowProperty(serverClient, WindowTable[pScreen->myNum],
|
||||
XA_CUT_BUFFER0, XA_STRING, 8, PropModeReplace,
|
||||
strlen(text), (pointer)text, TRUE);
|
||||
}
|
||||
|
||||
// Undo any current X selection (similar to code in dispatch.c)
|
||||
// FIXME: what about secondary selection?
|
||||
// FIXME: only touch first XA_PRIMARY selection?
|
||||
sel = 0;
|
||||
while ((sel < NumCurrentSelections) &&
|
||||
CurrentSelections[sel].selection != XA_PRIMARY)
|
||||
sel++;
|
||||
if (sel < NumCurrentSelections) {
|
||||
rc = dixLookupSelection(&pSel, XA_PRIMARY, serverClient,
|
||||
DixSetAttrAccess);
|
||||
if (rc == Success) {
|
||||
// Notify client if necessary
|
||||
if (CurrentSelections[sel].client) {
|
||||
if (pSel->client) {
|
||||
xEvent event;
|
||||
|
||||
event.u.u.type = SelectionClear;
|
||||
event.u.selectionClear.time = GetTimeInMillis();
|
||||
event.u.selectionClear.window = CurrentSelections[sel].window;
|
||||
event.u.selectionClear.atom = CurrentSelections[sel].selection;
|
||||
TryClientEvents(CurrentSelections[sel].client, &event, 1,
|
||||
NoEventMask, NoEventMask /*CantBeFiltered*/,
|
||||
NullGrab);
|
||||
event.u.selectionClear.window = pSel->window;
|
||||
event.u.selectionClear.atom = pSel->selection;
|
||||
TryClientEvents(pSel->client, &event, 1, NoEventMask,
|
||||
NoEventMask /*CantBeFiltered*/, NullGrab);
|
||||
}
|
||||
|
||||
// Erase it
|
||||
// FIXME: need to erase .selection too? dispatch.c doesn't
|
||||
CurrentSelections[sel].pWin = NullWindow;
|
||||
CurrentSelections[sel].window = None;
|
||||
CurrentSelections[sel].client = NullClient;
|
||||
pSel->pWin = NullWindow;
|
||||
pSel->window = None;
|
||||
pSel->client = NullClient;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ xprSetNativeProperty(RootlessWindowPtr pFrame)
|
|||
/* FIXME: move this to AppleWM extension */
|
||||
|
||||
data = native_id;
|
||||
ChangeWindowProperty(pFrame->win, xa_native_window_id(),
|
||||
dixChangeWindowProperty(serverClient, pFrame->win, xa_native_window_id(),
|
||||
XA_INTEGER, 32, PropModeReplace, 1, &data, TRUE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1087,6 +1087,6 @@ winMWExtWMSetNativeProperty (RootlessWindowPtr pFrame)
|
|||
/* FIXME: move this to WindowsWM extension */
|
||||
|
||||
lData = (long) pRLWinPriv->hWnd;
|
||||
ChangeWindowProperty (pFrame->win, AtmWindowsWmNativeHwnd (),
|
||||
dixChangeWindowProperty(serverClient, pFrame->win, AtmWindowsWmNativeHwnd(),
|
||||
XA_INTEGER, 32, PropModeReplace, 1, &lData, TRUE);
|
||||
}
|
||||
|
|
|
@ -181,8 +181,8 @@ set_screen_origin (WindowPtr pWin)
|
|||
data[1] = (dixScreenOrigins[pWin->drawable.pScreen->myNum].y
|
||||
+ darwinMainScreenY);
|
||||
|
||||
ChangeWindowProperty (pWin, xa_native_screen_origin (), XA_INTEGER,
|
||||
32, PropModeReplace, 2, data, TRUE);
|
||||
dixChangeWindowProperty(serverClient, pWin, xa_native_screen_origin(),
|
||||
XA_INTEGER, 32, PropModeReplace, 2, data, TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -222,8 +222,8 @@ char * pval;
|
|||
ErrorF("Internal Error! bad size (%d!=%d) for _XKB_RULES_NAMES\n",
|
||||
out,len);
|
||||
}
|
||||
ChangeWindowProperty(WindowTable[0],name,XA_STRING,8,PropModeReplace,
|
||||
len,pval,True);
|
||||
dixChangeWindowProperty(serverClient, WindowTable[0], name, XA_STRING, 8,
|
||||
PropModeReplace, len, pval, True);
|
||||
xfree(pval);
|
||||
return True;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue