mirror of
https://github.com/X11Libre/xserver.git
synced 2026-09-30 21:53:25 +00:00
Rootless: Abstract some of the Xplugin specific stuff which has crept into rootlessWindow.c
The rootless extension now directly calls some Xplugin functions, and relies on types defined in Xplugin.h, which isn't very abstracted :-) This patch is a start at abstracting some of the Xplugin specific stuff which has crept into rootlessWindow.c. This has been done in a pretty mindless fashion, without much thought as to if the additions to the generic rootless interface are the correct ones There is some confusion as to if RootlesscolormapCallback() returns a Bool or xp_error_enum value (not so abstact), but I have no way of checking, of finding out if Xplugin actually checks the result :-) Based on patches from Colin Harrison, Jon Turney and Yaakov Selkowitz Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk> Signed-off-by: Jeremy Huddleston <jeremyhu@freedesktop.org> Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
72f5874434
commit
5b91dfac6f
7 changed files with 76 additions and 71 deletions
|
|
@ -36,15 +36,15 @@
|
|||
#include <stddef.h> /* For NULL */
|
||||
#include <limits.h> /* For CHAR_BIT */
|
||||
#include <assert.h>
|
||||
#ifdef __APPLE__
|
||||
//#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
#ifdef __APPLE__
|
||||
#include <Xplugin.h>
|
||||
#include "mi.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "windowstr.h"
|
||||
#include <Xplugin.h>
|
||||
//#include <X11/extensions/applewm.h>
|
||||
extern int darwinMainScreenX, darwinMainScreenY;
|
||||
extern Bool no_configure_window;
|
||||
#endif
|
||||
#include "fb.h"
|
||||
|
||||
|
|
@ -61,8 +61,6 @@ extern int darwinMainScreenX, darwinMainScreenY;
|
|||
#define SCREEN_TO_GLOBAL_Y 0
|
||||
#endif
|
||||
|
||||
#define MAKE_WINDOW_ID(x) ((xp_window_id)((size_t)(x)))
|
||||
|
||||
#define DEFINE_ATOM_HELPER(func,atom_name) \
|
||||
static Atom func (void) { \
|
||||
static unsigned int generation = 0; \
|
||||
|
|
@ -74,34 +72,15 @@ extern int darwinMainScreenX, darwinMainScreenY;
|
|||
return atom; \
|
||||
}
|
||||
|
||||
DEFINE_ATOM_HELPER (xa_native_screen_origin, "_NATIVE_SCREEN_ORIGIN")
|
||||
DEFINE_ATOM_HELPER (xa_native_window_id, "_NATIVE_WINDOW_ID")
|
||||
DEFINE_ATOM_HELPER (xa_apple_no_order_in, "_APPLE_NO_ORDER_IN")
|
||||
|
||||
static Bool no_configure_window;
|
||||
static Bool windows_hidden;
|
||||
// TODO - abstract xp functions
|
||||
|
||||
static inline int
|
||||
configure_window (xp_window_id id, unsigned int mask,
|
||||
const xp_window_changes *values)
|
||||
{
|
||||
if (!no_configure_window)
|
||||
return xp_configure_window (id, mask, values);
|
||||
else
|
||||
return XP_Success;
|
||||
}
|
||||
#ifdef __APPLE__
|
||||
|
||||
/*static inline unsigned long
|
||||
current_time_in_seconds (void)
|
||||
{
|
||||
unsigned long t = 0;
|
||||
|
||||
t += currentTime.milliseconds / 1000;
|
||||
t += currentTime.months * 4294967;
|
||||
|
||||
return t;
|
||||
} */
|
||||
// XXX: identical to x_cvt_vptr_to_uint ?
|
||||
#define MAKE_WINDOW_ID(x) ((xp_window_id)((size_t)(x)))
|
||||
|
||||
void
|
||||
RootlessNativeWindowStateChanged (WindowPtr pWin, unsigned int state)
|
||||
|
|
@ -153,25 +132,7 @@ void RootlessNativeWindowMoved (WindowPtr pWin) {
|
|||
no_configure_window = FALSE;
|
||||
}
|
||||
|
||||
/* Updates the _NATIVE_SCREEN_ORIGIN property on the given root window. */
|
||||
static void
|
||||
set_screen_origin (WindowPtr pWin)
|
||||
{
|
||||
long data[2];
|
||||
|
||||
if (!IsRoot (pWin))
|
||||
return;
|
||||
|
||||
/* FIXME: move this to an extension? */
|
||||
|
||||
data[0] = (dixScreenOrigins[pWin->drawable.pScreen->myNum].x
|
||||
+ darwinMainScreenX);
|
||||
data[1] = (dixScreenOrigins[pWin->drawable.pScreen->myNum].y
|
||||
+ darwinMainScreenY);
|
||||
|
||||
dixChangeWindowProperty(serverClient, pWin, xa_native_screen_origin(),
|
||||
XA_INTEGER, 32, PropModeReplace, 2, data, TRUE);
|
||||
}
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
/*
|
||||
* RootlessCreateWindow
|
||||
|
|
@ -437,13 +398,6 @@ RootlessInitializeFrame(WindowPtr pWin, RootlessWindowRec *winRec)
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
Bool
|
||||
RootlessColormapCallback (void *data, int first_color, int n_colors, uint32_t *colors)
|
||||
{
|
||||
return (RootlessResolveColormap (data, first_color, n_colors, colors) ? XP_Success : XP_BadMatch);
|
||||
}
|
||||
|
||||
/*
|
||||
* RootlessEnsureFrame
|
||||
* Make sure the given window is framed. If the window doesn't have a
|
||||
|
|
@ -1482,19 +1436,15 @@ void
|
|||
RootlessFlushWindowColormap (WindowPtr pWin)
|
||||
{
|
||||
RootlessWindowRec *winRec = WINREC (pWin);
|
||||
xp_window_changes wc;
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
|
||||
if (winRec == NULL)
|
||||
return;
|
||||
|
||||
RootlessStopDrawing (pWin, FALSE);
|
||||
|
||||
/* This is how we tell xp that the colormap may have changed. */
|
||||
|
||||
wc.colormap = RootlessColormapCallback;
|
||||
wc.colormap_data = pWin->drawable.pScreen;
|
||||
|
||||
configure_window (MAKE_WINDOW_ID(winRec->wid), XP_COLORMAP, &wc);
|
||||
if (SCREENREC(pScreen)->imp->UpdateColormap)
|
||||
SCREENREC(pScreen)->imp->UpdateColormap(winRec->wid, pScreen);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -1617,7 +1567,6 @@ RootlessHideAllWindows (void)
|
|||
ScreenPtr pScreen;
|
||||
WindowPtr pWin;
|
||||
RootlessWindowRec *winRec;
|
||||
xp_window_changes wc;
|
||||
|
||||
if (windows_hidden)
|
||||
return;
|
||||
|
|
@ -1641,9 +1590,8 @@ RootlessHideAllWindows (void)
|
|||
winRec = WINREC (pWin);
|
||||
if (winRec != NULL)
|
||||
{
|
||||
wc.stack_mode = XP_UNMAPPED;
|
||||
wc.sibling = 0;
|
||||
configure_window (MAKE_WINDOW_ID(winRec->wid), XP_STACKING, &wc);
|
||||
if (SCREENREC(pScreen)->imp->HideWindow)
|
||||
SCREENREC(pScreen)->imp->HideWindow(winRec->wid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue