Store monitor size and depth in the generic structure.

Merged monitor driver into USER driver.
oldstable
Alexandre Julliard 2000-03-25 17:30:13 +00:00
parent 9383eb94a7
commit 7f3418fba0
23 changed files with 341 additions and 787 deletions

View File

@ -12,68 +12,11 @@
#include "windef.h"
#include "wingdi.h"
#include "heap.h"
#include "monitor.h"
#include "user.h"
#include "win.h"
#include "wine/winuser16.h"
/***********************************************************************
* DESKTOP_IsSingleWindow
*/
BOOL DESKTOP_IsSingleWindow(void)
{
BOOL retvalue;
DESKTOP *pDesktop = (DESKTOP *) WIN_GetDesktop()->wExtra;
retvalue = MONITOR_IsSingleWindow(pDesktop->pPrimaryMonitor);
WIN_ReleaseDesktop();
return retvalue;
}
/***********************************************************************
* DESKTOP_GetScreenWidth
*
* Return the width of the screen associated to the current desktop.
*/
int DESKTOP_GetScreenWidth()
{
int retvalue;
DESKTOP *pDesktop = (DESKTOP *) WIN_GetDesktop()->wExtra;
retvalue = MONITOR_GetWidth(pDesktop->pPrimaryMonitor);
WIN_ReleaseDesktop();
return retvalue;
}
/***********************************************************************
* DESKTOP_GetScreenHeight
*
* Return the height of the screen associated to the current desktop.
*/
int DESKTOP_GetScreenHeight()
{
int retvalue;
DESKTOP *pDesktop = (DESKTOP *) WIN_GetDesktop()->wExtra;
retvalue = MONITOR_GetHeight(pDesktop->pPrimaryMonitor);
WIN_ReleaseDesktop();
return retvalue;
}
/***********************************************************************
* DESKTOP_GetScreenDepth
*
* Return the depth of the screen associated to the current desktop.
*/
int DESKTOP_GetScreenDepth()
{
int retvalue;
DESKTOP *pDesktop = (DESKTOP *) WIN_GetDesktop()->wExtra;
retvalue = MONITOR_GetDepth(pDesktop->pPrimaryMonitor);
WIN_ReleaseDesktop();
return retvalue;
}
/***********************************************************************
* DESKTOP_LoadBitmap
*
@ -216,7 +159,7 @@ static inline LRESULT WINAPI DesktopWndProc_locked( WND *wndPtr, UINT message,
return 1;
case WM_ERASEBKGND:
if(!DESKTOP_IsSingleWindow())
if(!USER_Driver->pIsSingleWindow())
return 1;
return DESKTOP_DoEraseBkgnd( hwnd, (HDC)wParam, desktopPtr );

View File

@ -12,6 +12,9 @@
#include "ttydrv.h"
#include "user.h"
#include "win.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(ttydrv);
static USER_DRIVER user_driver =
{
@ -36,36 +39,138 @@ static USER_DRIVER user_driver =
TTYDRV_MOUSE_Init,
TTYDRV_MOUSE_SetCursor,
TTYDRV_MOUSE_MoveCursor,
TTYDRV_MOUSE_EnableWarpPointer
TTYDRV_MOUSE_EnableWarpPointer,
/* screen saver functions */
TTYDRV_GetScreenSaveActive,
TTYDRV_SetScreenSaveActive,
TTYDRV_GetScreenSaveTimeout,
TTYDRV_SetScreenSaveTimeout,
/* windowing functions */
TTYDRV_IsSingleWindow
};
int cell_width = 8;
int cell_height = 8;
#ifdef HAVE_LIBCURSES
WINDOW *root_window;
#endif /* defined(HAVE_LIBCURSES) */
/***********************************************************************
* TTYDRV process initialisation routine
*/
static void process_attach(void)
{
int rows, cols;
USER_Driver = &user_driver;
CLIPBOARD_Driver = &TTYDRV_CLIPBOARD_Driver;
WND_Driver = &TTYDRV_WND_Driver;
#ifdef HAVE_LIBCURSES
if ((root_window = initscr()))
{
werase(root_window);
wrefresh(root_window);
}
getmaxyx(root_window, rows, cols);
#else /* defined(HAVE_LIBCURSES) */
rows = 60; /* FIXME: Hardcoded */
cols = 80; /* FIXME: Hardcoded */
#endif /* defined(HAVE_LIBCURSES) */
MONITOR_PrimaryMonitor.rect.left = 0;
MONITOR_PrimaryMonitor.rect.top = 0;
MONITOR_PrimaryMonitor.rect.right = cell_width * cols;
MONITOR_PrimaryMonitor.rect.bottom = cell_height * rows;
MONITOR_PrimaryMonitor.depth = 1;
TTYDRV_GDI_Initialize();
}
/***********************************************************************
* TTYDRV process termination routine
*/
static void process_detach(void)
{
TTYDRV_GDI_Finalize();
#ifdef HAVE_LIBCURSES
if (root_window) endwin();
#endif /* defined(HAVE_LIBCURSES) */
USER_Driver = NULL;
CLIPBOARD_Driver = NULL;
WND_Driver = NULL;
}
/***********************************************************************
* TTYDRV initialisation routine
*/
BOOL WINAPI TTYDRV_Init( HINSTANCE hinst, DWORD reason, LPVOID reserved )
{
static int process_count;
switch(reason)
{
case DLL_PROCESS_ATTACH:
USER_Driver = &user_driver;
CLIPBOARD_Driver = &TTYDRV_CLIPBOARD_Driver;
MONITOR_Driver = &TTYDRV_MONITOR_Driver;
WND_Driver = &TTYDRV_WND_Driver;
TTYDRV_MONITOR_Initialize( &MONITOR_PrimaryMonitor );
TTYDRV_GDI_Initialize();
if (!process_count++) process_attach();
break;
case DLL_PROCESS_DETACH:
TTYDRV_GDI_Finalize();
TTYDRV_MONITOR_Finalize( &MONITOR_PrimaryMonitor );
USER_Driver = NULL;
CLIPBOARD_Driver = NULL;
MONITOR_Driver = NULL;
WND_Driver = NULL;
if (!--process_count) process_detach();
break;
}
return TRUE;
}
/***********************************************************************
* TTYDRV_GetScreenSaveActive
*
* Returns the active status of the screen saver
*/
BOOL TTYDRV_GetScreenSaveActive(void)
{
return FALSE;
}
/***********************************************************************
* TTYDRV_SetScreenSaveActive
*
* Activate/Deactivate the screen saver
*/
void TTYDRV_SetScreenSaveActive(BOOL bActivate)
{
FIXME("(%d): stub\n", bActivate);
}
/***********************************************************************
* TTYDRV_GetScreenSaveTimeout
*
* Return the screen saver timeout
*/
int TTYDRV_GetScreenSaveTimeout(void)
{
return 0;
}
/***********************************************************************
* TTYDRV_SetScreenSaveTimeout
*
* Set the screen saver timeout
*/
void TTYDRV_SetScreenSaveTimeout(int nTimeout)
{
FIXME("(%d): stub\n", nTimeout);
}
/***********************************************************************
* TTYDRV_IsSingleWindow
*/
BOOL TTYDRV_IsSingleWindow(void)
{
return TRUE;
}

View File

@ -7,7 +7,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <X11/cursorfont.h>
#include "ts_xlib.h"
#include "ts_xutil.h"
#include "winbase.h"
@ -44,7 +46,14 @@ static USER_DRIVER user_driver =
X11DRV_MOUSE_Init,
X11DRV_MOUSE_SetCursor,
X11DRV_MOUSE_MoveCursor,
X11DRV_MOUSE_EnableWarpPointer
X11DRV_MOUSE_EnableWarpPointer,
/* screen saver functions */
X11DRV_GetScreenSaveActive,
X11DRV_SetScreenSaveActive,
X11DRV_GetScreenSaveTimeout,
X11DRV_SetScreenSaveTimeout,
/* windowing functions */
X11DRV_IsSingleWindow
};
static XKeyboardState keyboard_state;
@ -65,6 +74,78 @@ static int error_handler(Display *display, XErrorEvent *error_evt)
}
/***********************************************************************
* create_desktop
*
* Create the desktop window for the --desktop mode.
*/
static void create_desktop( const char *geometry )
{
int x = 0, y = 0, flags;
unsigned int width = 640, height = 480; /* Default size = 640x480 */
char *name = "Wine desktop";
XSizeHints *size_hints;
XWMHints *wm_hints;
XClassHint *class_hints;
XSetWindowAttributes win_attr;
XTextProperty window_name;
Atom XA_WM_DELETE_WINDOW;
flags = TSXParseGeometry( geometry, &x, &y, &width, &height );
MONITOR_PrimaryMonitor.rect.right = width;
MONITOR_PrimaryMonitor.rect.bottom = height;
/* Create window */
win_attr.background_pixel = BlackPixel(display, 0);
win_attr.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask |
PointerMotionMask | ButtonPressMask |
ButtonReleaseMask | EnterWindowMask;
win_attr.cursor = TSXCreateFontCursor( display, XC_top_left_arrow );
root_window = TSXCreateWindow( display, DefaultRootWindow(display),
x, y, width, height, 0,
CopyFromParent, InputOutput, CopyFromParent,
CWBackPixel | CWEventMask | CWCursor, &win_attr);
/* Set window manager properties */
size_hints = TSXAllocSizeHints();
wm_hints = TSXAllocWMHints();
class_hints = TSXAllocClassHint();
if (!size_hints || !wm_hints || !class_hints)
{
MESSAGE("Not enough memory for window manager hints.\n" );
ExitProcess(1);
}
size_hints->min_width = size_hints->max_width = width;
size_hints->min_height = size_hints->max_height = height;
size_hints->flags = PMinSize | PMaxSize;
if (flags & (XValue | YValue)) size_hints->flags |= USPosition;
if (flags & (WidthValue | HeightValue)) size_hints->flags |= USSize;
else size_hints->flags |= PSize;
wm_hints->flags = InputHint | StateHint;
wm_hints->input = True;
wm_hints->initial_state = NormalState;
class_hints->res_name = (char *)argv0;
class_hints->res_class = "Wine";
TSXStringListToTextProperty( &name, 1, &window_name );
TSXSetWMProperties( display, root_window, &window_name, &window_name,
Options.argv, Options.argc, size_hints, wm_hints, class_hints );
XA_WM_DELETE_WINDOW = TSXInternAtom( display, "WM_DELETE_WINDOW", False );
TSXSetWMProtocols( display, root_window, &XA_WM_DELETE_WINDOW, 1 );
TSXFree( size_hints );
TSXFree( wm_hints );
TSXFree( class_hints );
/* Map window */
TSXMapWindow( display, root_window );
}
/***********************************************************************
* X11DRV process initialisation routine
*/
@ -72,7 +153,6 @@ static void process_attach(void)
{
USER_Driver = &user_driver;
CLIPBOARD_Driver = &X11DRV_CLIPBOARD_Driver;
MONITOR_Driver = &X11DRV_MONITOR_Driver;
WND_Driver = &X11DRV_WND_Driver;
/* We need this before calling any Xlib function */
@ -120,10 +200,18 @@ static void process_attach(void)
TSXOpenIM(display,NULL,NULL,NULL);
if (Options.synchronous) XSetErrorHandler( error_handler );
if (Options.desktopGeometry && Options.managed) Options.managed = FALSE;
/* initialize monitor */
X11DRV_MONITOR_Initialize( &MONITOR_PrimaryMonitor );
MONITOR_PrimaryMonitor.rect.left = 0;
MONITOR_PrimaryMonitor.rect.top = 0;
MONITOR_PrimaryMonitor.rect.right = WidthOfScreen( screen );
MONITOR_PrimaryMonitor.rect.bottom = HeightOfScreen( screen );
MONITOR_PrimaryMonitor.depth = screen_depth;
if (Options.desktopGeometry)
{
Options.managed = FALSE;
create_desktop( Options.desktopGeometry );
}
/* initialize GDI */
X11DRV_GDI_Initialize();
@ -158,16 +246,12 @@ static void process_detach(void)
#if 0 /* FIXME */
/* cleanup monitor */
X11DRV_MONITOR_Finalize( &MONITOR_PrimaryMonitor );
/* close the display */
XCloseDisplay( display );
display = NULL;
USER_Driver = NULL;
CLIPBOARD_Driver = NULL;
MONITOR_Driver = NULL;
WND_Driver = NULL;
#endif
}
@ -191,3 +275,58 @@ BOOL WINAPI X11DRV_Init( HINSTANCE hinst, DWORD reason, LPVOID reserved )
}
return TRUE;
}
/***********************************************************************
* X11DRV_GetScreenSaveActive
*
* Returns the active status of the screen saver
*/
BOOL X11DRV_GetScreenSaveActive(void)
{
int timeout, temp;
TSXGetScreenSaver(display, &timeout, &temp, &temp, &temp);
return timeout != NULL;
}
/***********************************************************************
* X11DRV_SetScreenSaveActive
*
* Activate/Deactivate the screen saver
*/
void X11DRV_SetScreenSaveActive(BOOL bActivate)
{
if(bActivate)
TSXActivateScreenSaver(display);
else
TSXResetScreenSaver(display);
}
/***********************************************************************
* X11DRV_GetScreenSaveTimeout
*
* Return the screen saver timeout
*/
int X11DRV_GetScreenSaveTimeout(void)
{
int timeout, temp;
TSXGetScreenSaver(display, &timeout, &temp, &temp, &temp);
return timeout;
}
/***********************************************************************
* X11DRV_SetScreenSaveTimeout
*
* Set the screen saver timeout
*/
void X11DRV_SetScreenSaveTimeout(int nTimeout)
{
TSXSetScreenSaver(display, nTimeout, 60, DefaultBlanking, DefaultExposures);
}
/***********************************************************************
* X11DRV_IsSingleWindow
*/
BOOL X11DRV_IsSingleWindow(void)
{
return (root_window != DefaultRootWindow(display));
}

View File

@ -64,10 +64,10 @@ BOOL TTYDRV_DC_CreateDC(DC *dc, LPCSTR driver, LPCSTR device,
GDI_HEAP_UNLOCK( dc->w.hBitmap );
} else {
#ifdef HAVE_LIBCURSES
physDev->window = TTYDRV_MONITOR_GetCursesRootWindow(&MONITOR_PrimaryMonitor);
physDev->window = TTYDRV_GetRootWindow();
#endif /* defined(HAVE_LIBCURSES) */
physDev->cellWidth = TTYDRV_MONITOR_GetCellWidth(&MONITOR_PrimaryMonitor);
physDev->cellHeight = TTYDRV_MONITOR_GetCellHeight(&MONITOR_PrimaryMonitor);
physDev->cellWidth = TTYDRV_GetCellWidth();
physDev->cellHeight = TTYDRV_GetCellHeight();
dc->w.bitsPerPixel = MONITOR_GetDepth(&MONITOR_PrimaryMonitor);

View File

@ -9,22 +9,14 @@
#include "windef.h"
struct tagMONITOR;
typedef struct tagDESKTOP
{
HBRUSH hbrushPattern;
HBITMAP hbitmapWallPaper;
SIZE bitmapSize;
BOOL fTileWallPaper;
struct tagMONITOR *pPrimaryMonitor;
} DESKTOP;
extern BOOL DESKTOP_IsSingleWindow(void);
extern int DESKTOP_GetScreenWidth(void);
extern int DESKTOP_GetScreenHeight(void);
extern int DESKTOP_GetScreenDepth(void);
extern BOOL DESKTOP_SetPattern( LPCSTR pattern );
extern LRESULT WINAPI DesktopWndProc( HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam );

View File

@ -8,38 +8,27 @@
#include "windef.h"
struct tagMONITOR_DRIVER;
typedef struct tagMONITOR
{
void *pDriverData;
RECT rect;
int depth;
} MONITOR;
typedef struct tagMONITOR_DRIVER {
void (*pInitialize)(struct tagMONITOR *);
void (*pFinalize)(struct tagMONITOR *);
BOOL (*pIsSingleWindow)(struct tagMONITOR *);
int (*pGetWidth)(struct tagMONITOR *);
int (*pGetHeight)(struct tagMONITOR *);
int (*pGetDepth)(struct tagMONITOR *);
BOOL (*pGetScreenSaveActive)(struct tagMONITOR *);
void (*pSetScreenSaveActive)(struct tagMONITOR *, BOOL);
int (*pGetScreenSaveTimeout)(struct tagMONITOR *);
void (*pSetScreenSaveTimeout)(struct tagMONITOR *, int);
} MONITOR_DRIVER;
extern MONITOR_DRIVER *MONITOR_Driver;
extern MONITOR MONITOR_PrimaryMonitor;
extern BOOL MONITOR_IsSingleWindow(MONITOR *pMonitor);
extern int MONITOR_GetWidth(MONITOR *pMonitor);
extern int MONITOR_GetHeight(MONITOR *pMonitor);
extern int MONITOR_GetDepth(MONITOR *pMonitor);
extern BOOL MONITOR_GetScreenSaveActive(MONITOR *pMonitor);
extern void MONITOR_SetScreenSaveActive(MONITOR *pMonitor, BOOL bActivate);
extern int MONITOR_GetScreenSaveTimeout(MONITOR *pMonitor);
extern void MONITOR_SetScreenSaveTimeout(MONITOR *pMonitor, int nTimeout);
static int inline MONITOR_GetWidth(MONITOR *pMonitor)
{
return pMonitor->rect.right - pMonitor->rect.left;
}
static int inline MONITOR_GetHeight(MONITOR *pMonitor)
{
return pMonitor->rect.bottom - pMonitor->rect.top;
}
static int inline MONITOR_GetDepth(MONITOR *pMonitor)
{
return pMonitor->depth;
}
#endif /* __WINE_MONITOR_H */

View File

@ -114,6 +114,22 @@ extern BOOL TTYDRV_PALETTE_IsDark(int pixel);
* TTY USER driver
*/
extern int cell_width;
extern int cell_height;
static inline int TTYDRV_GetCellWidth(void) { return cell_width; }
static inline int TTYDRV_GetCellHeight(void) { return cell_height; }
#ifdef HAVE_LIBCURSES
extern WINDOW *root_window;
static inline WINDOW *TTYDRV_GetRootWindow(void) { return root_window; }
#endif /* defined(HAVE_LIBCURSES) */
extern BOOL TTYDRV_GetScreenSaveActive(void);
extern void TTYDRV_SetScreenSaveActive(BOOL bActivate);
extern int TTYDRV_GetScreenSaveTimeout(void);
extern void TTYDRV_SetScreenSaveTimeout(int nTimeout);
extern BOOL TTYDRV_IsSingleWindow(void);
/* TTY clipboard driver */
extern struct tagCLIPBOARD_DRIVER TTYDRV_CLIPBOARD_Driver;
@ -154,41 +170,6 @@ extern BOOL TTYDRV_KEYBOARD_GetDIData(BYTE *keystate, DWORD dodsize, struct DIDE
extern void TTYDRV_KEYBOARD_GetKeyboardConfig(struct tagKEYBOARD_CONFIG *cfg);
extern void TTYDRV_KEYBOARD_SetKeyboardConfig(struct tagKEYBOARD_CONFIG *cfg, DWORD mask);
/* TTY monitor driver */
extern struct tagMONITOR_DRIVER TTYDRV_MONITOR_Driver;
typedef struct tagTTYDRV_MONITOR_DATA {
#ifdef HAVE_LIBCURSES
WINDOW *rootWindow;
#endif /* defined(HAVE_LIBCURSES) */
int cellWidth;
int cellHeight;
int width;
int height;
int depth;
} TTYDRV_MONITOR_DATA;
struct tagMONITOR;
#ifdef HAVE_LIBCURSES
extern WINDOW *TTYDRV_MONITOR_GetCursesRootWindow(struct tagMONITOR *pMonitor);
#endif /* defined(HAVE_LIBCURSES) */
extern INT TTYDRV_MONITOR_GetCellWidth(struct tagMONITOR *pMonitor);
extern INT TTYDRV_MONITOR_GetCellHeight(struct tagMONITOR *pMonitor);
extern void TTYDRV_MONITOR_Initialize(struct tagMONITOR *pMonitor);
extern void TTYDRV_MONITOR_Finalize(struct tagMONITOR *pMonitor);
extern BOOL TTYDRV_MONITOR_IsSingleWindow(struct tagMONITOR *pMonitor);
extern int TTYDRV_MONITOR_GetWidth(struct tagMONITOR *pMonitor);
extern int TTYDRV_MONITOR_GetHeight(struct tagMONITOR *pMonitor);
extern int TTYDRV_MONITOR_GetDepth(struct tagMONITOR *pMonitor);
extern BOOL TTYDRV_MONITOR_GetScreenSaveActive(struct tagMONITOR *pMonitor);
extern void TTYDRV_MONITOR_SetScreenSaveActive(struct tagMONITOR *pMonitor, BOOL bActivate);
extern int TTYDRV_MONITOR_GetScreenSaveTimeout(struct tagMONITOR *pMonitor);
extern void TTYDRV_MONITOR_SetScreenSaveTimeout(struct tagMONITOR *pMonitor, int nTimeout);
/* TTY mouse driver */
extern void TTYDRV_MOUSE_Init();
@ -210,7 +191,6 @@ typedef struct tagTTYDRV_WND_DATA {
#ifdef HAVE_LIBCURSES
WINDOW *TTYDRV_WND_GetCursesWindow(struct tagWND *wndPtr);
WINDOW *TTYDRV_WND_GetCursesRootWindow(struct tagWND *wndPtr);
#endif /* defined(HAVE_LIBCURSES) */
extern void TTYDRV_WND_Initialize(struct tagWND *wndPtr);

View File

@ -60,6 +60,13 @@ typedef struct tagUSER_DRIVER {
void (*pSetCursor)(struct tagCURSORICONINFO *);
void (*pMoveCursor)(WORD, WORD);
LONG (*pEnableWarpPointer)(BOOL);
/* screen saver functions */
BOOL (*pGetScreenSaveActive)(void);
void (*pSetScreenSaveActive)(BOOL);
int (*pGetScreenSaveTimeout)(void);
void (*pSetScreenSaveTimeout)(int);
/* windowing functions */
BOOL (*pIsSingleWindow)(void);
} USER_DRIVER;
extern USER_DRIVER *USER_Driver;

View File

@ -321,6 +321,12 @@ static inline Visual *X11DRV_GetVisual(void) { return visual; }
static inline Window X11DRV_GetXRootWindow(void) { return root_window; }
static inline int X11DRV_GetDepth(void) { return screen_depth; }
extern BOOL X11DRV_GetScreenSaveActive(void);
extern void X11DRV_SetScreenSaveActive(BOOL bActivate);
extern int X11DRV_GetScreenSaveTimeout(void);
extern void X11DRV_SetScreenSaveTimeout(int nTimeout);
extern BOOL X11DRV_IsSingleWindow(void);
/* X11 clipboard driver */
extern struct tagCLIPBOARD_DRIVER X11DRV_CLIPBOARD_Driver;
@ -378,28 +384,6 @@ extern void X11DRV_KEYBOARD_SetKeyboardConfig(struct tagKEYBOARD_CONFIG *cfg, DW
extern void X11DRV_KEYBOARD_HandleEvent(struct tagWND *pWnd, XKeyEvent *event);
/* X11 monitor driver */
extern struct tagMONITOR_DRIVER X11DRV_MONITOR_Driver;
typedef struct _X11DRV_MONITOR_DATA {
int width;
int height;
} X11DRV_MONITOR_DATA;
struct tagMONITOR;
extern void X11DRV_MONITOR_Initialize(struct tagMONITOR *pMonitor);
extern void X11DRV_MONITOR_Finalize(struct tagMONITOR *pMonitor);
extern BOOL X11DRV_MONITOR_IsSingleWindow(struct tagMONITOR *pMonitor);
extern int X11DRV_MONITOR_GetWidth(struct tagMONITOR *pMonitor);
extern int X11DRV_MONITOR_GetHeight(struct tagMONITOR *pMonitor);
extern int X11DRV_MONITOR_GetDepth(struct tagMONITOR *pMonitor);
extern BOOL X11DRV_MONITOR_GetScreenSaveActive(struct tagMONITOR *pMonitor);
extern void X11DRV_MONITOR_SetScreenSaveActive(struct tagMONITOR *pMonitor, BOOL bActivate);
extern int X11DRV_MONITOR_GetScreenSaveTimeout(struct tagMONITOR *pMonitor);
extern void X11DRV_MONITOR_SetScreenSaveTimeout(struct tagMONITOR *pMonitor, int nTimeout);
/* X11 mouse driver */
extern void X11DRV_MOUSE_Init();

View File

@ -22,7 +22,6 @@
#include "msdos.h"
#include "color.h"
#include "options.h"
#include "desktop.h"
#include "builtin32.h"
#include "debugtools.h"
#include "debugdefs.h"

View File

@ -18,7 +18,6 @@
*/
#include <assert.h>
#include "desktop.h"
#include "options.h"
#include "dce.h"
#include "class.h"
@ -28,13 +27,14 @@
#include "heap.h"
#include "local.h"
#include "module.h"
#include "user.h"
#include "debugtools.h"
#include "windef.h"
#include "wingdi.h"
#include "wine/winbase16.h"
#include "wine/winuser16.h"
DEFAULT_DEBUG_CHANNEL(dc)
DEFAULT_DEBUG_CHANNEL(dc);
#define NB_DCE 5 /* Number of DCEs created at startup */
@ -838,7 +838,7 @@ HDC WINAPI GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags )
WIN_ReleaseWndPtr(parentPtr);
}
else
if ((hwnd == GetDesktopWindow()) && !DESKTOP_IsSingleWindow())
if ((hwnd == GetDesktopWindow()) && !USER_Driver->pIsSingleWindow())
hrgnVisible = CreateRectRgn( 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN) );
else
{

View File

@ -12,96 +12,10 @@
/**********************************************************************/
MONITOR_DRIVER *MONITOR_Driver;
/**********************************************************************/
#define xPRIMARY_MONITOR ((HMONITOR)0x12340042)
MONITOR MONITOR_PrimaryMonitor;
/***********************************************************************
* MONITOR_GetMonitor
*/
#if 0
static MONITOR *MONITOR_GetMonitor(HMONITOR hMonitor)
{
if(hMonitor == xPRIMARY_MONITOR)
{
return &MONITOR_PrimaryMonitor;
}
else
{
return NULL;
}
}
#endif
/***********************************************************************
* MONITOR_IsSingleWindow
*/
BOOL MONITOR_IsSingleWindow(MONITOR *pMonitor)
{
return MONITOR_Driver->pIsSingleWindow(pMonitor);
}
/***********************************************************************
* MONITOR_GetWidth
*/
int MONITOR_GetWidth(MONITOR *pMonitor)
{
return MONITOR_Driver->pGetWidth(pMonitor);
}
/***********************************************************************
* MONITOR_GetHeight
*/
int MONITOR_GetHeight(MONITOR *pMonitor)
{
return MONITOR_Driver->pGetHeight(pMonitor);
}
/***********************************************************************
* MONITOR_GetDepth
*/
int MONITOR_GetDepth(MONITOR *pMonitor)
{
return MONITOR_Driver->pGetDepth(pMonitor);
}
/***********************************************************************
* MONITOR_GetScreenSaveActive
*/
BOOL MONITOR_GetScreenSaveActive(MONITOR *pMonitor)
{
return MONITOR_Driver->pGetScreenSaveActive(pMonitor);
}
/***********************************************************************
* MONITOR_SetScreenSaveActive
*/
void MONITOR_SetScreenSaveActive(MONITOR *pMonitor, BOOL bActivate)
{
MONITOR_Driver->pSetScreenSaveActive(pMonitor, bActivate);
}
/***********************************************************************
* MONITOR_GetScreenSaveTimeout
*/
int MONITOR_GetScreenSaveTimeout(MONITOR *pMonitor)
{
return MONITOR_Driver->pGetScreenSaveTimeout(pMonitor);
}
/***********************************************************************
* MONITOR_SetScreenSaveTimeout
*/
void MONITOR_SetScreenSaveTimeout(MONITOR *pMonitor, int nTimeout)
{
MONITOR_Driver->pSetScreenSaveTimeout(pMonitor, nTimeout);
}
/**********************************************************************/
HMONITOR WINAPI MonitorFromPoint(POINT ptScreenCoords, DWORD dwFlags)
@ -156,10 +70,7 @@ BOOL WINAPI GetMonitorInfoA(HMONITOR hMonitor, LPMONITORINFO lpMonitorInfo)
(lpMonitorInfo->cbSize >= sizeof(MONITORINFO)) &&
SystemParametersInfoA(SPI_GETWORKAREA, 0, &rcWork, 0))
{
lpMonitorInfo->rcMonitor.left = 0;
lpMonitorInfo->rcMonitor.top = 0;
lpMonitorInfo->rcMonitor.right = GetSystemMetrics(SM_CXSCREEN);
lpMonitorInfo->rcMonitor.bottom = GetSystemMetrics(SM_CYSCREEN);
lpMonitorInfo->rcMonitor = MONITOR_PrimaryMonitor.rect;
lpMonitorInfo->rcWork = rcWork;
lpMonitorInfo->dwFlags = MONITORINFOF_PRIMARY;
@ -181,10 +92,7 @@ BOOL WINAPI GetMonitorInfoW(HMONITOR hMonitor, LPMONITORINFO lpMonitorInfo)
(lpMonitorInfo->cbSize >= sizeof(MONITORINFO)) &&
SystemParametersInfoW(SPI_GETWORKAREA, 0, &rcWork, 0))
{
lpMonitorInfo->rcMonitor.left = 0;
lpMonitorInfo->rcMonitor.top = 0;
lpMonitorInfo->rcMonitor.right = GetSystemMetrics(SM_CXSCREEN);
lpMonitorInfo->rcMonitor.bottom = GetSystemMetrics(SM_CYSCREEN);
lpMonitorInfo->rcMonitor = MONITOR_PrimaryMonitor.rect;
lpMonitorInfo->rcWork = rcWork;
lpMonitorInfo->dwFlags = MONITORINFOF_PRIMARY;
@ -203,16 +111,11 @@ BOOL WINAPI EnumDisplayMonitors(
MONITORENUMPROC lpfnEnumProc,
LPARAM dwData)
{
RECT rcLimit;
RECT rcLimit = MONITOR_PrimaryMonitor.rect;
if (!lpfnEnumProc)
return FALSE;
rcLimit.left = 0;
rcLimit.top = 0;
rcLimit.right = GetSystemMetrics(SM_CXSCREEN);
rcLimit.bottom = GetSystemMetrics(SM_CYSCREEN);
if (hdcOptionalForPainting)
{
RECT rcClip;

View File

@ -13,8 +13,8 @@
#include "winerror.h"
#include "keyboard.h"
#include "monitor.h"
#include "tweak.h"
#include "user.h"
#include "desktop.h"
#include "debugtools.h"
@ -83,7 +83,7 @@ BOOL WINAPI SystemParametersInfoA( UINT uAction, UINT uParam,
break;
case SPI_GETSCREENSAVEACTIVE:
if(MONITOR_GetScreenSaveActive(&MONITOR_PrimaryMonitor) ||
if(USER_Driver->pGetScreenSaveActive() ||
GetProfileIntA( "windows", "ScreenSaveActive", 1 ) == 1)
*(BOOL*)lpvParam = TRUE;
else
@ -91,7 +91,7 @@ BOOL WINAPI SystemParametersInfoA( UINT uAction, UINT uParam,
break;
case SPI_GETSCREENSAVETIMEOUT:
timeout = MONITOR_GetScreenSaveTimeout(&MONITOR_PrimaryMonitor);
timeout = USER_Driver->pGetScreenSaveTimeout();
if(!timeout)
timeout = GetProfileIntA( "windows", "ScreenSaveTimeout", 300 );
*(INT *) lpvParam = timeout * 1000;
@ -320,7 +320,7 @@ BOOL16 WINAPI SystemParametersInfo16( UINT16 uAction, UINT16 uParam,
break;
case SPI_GETSCREENSAVEACTIVE:
if(MONITOR_GetScreenSaveActive(&MONITOR_PrimaryMonitor) ||
if(USER_Driver->pGetScreenSaveActive() ||
GetProfileIntA( "windows", "ScreenSaveActive", 1 ) == 1)
*(BOOL16 *) lpvParam = TRUE;
else
@ -328,7 +328,7 @@ BOOL16 WINAPI SystemParametersInfo16( UINT16 uAction, UINT16 uParam,
break;
case SPI_GETSCREENSAVETIMEOUT:
timeout = MONITOR_GetScreenSaveTimeout(&MONITOR_PrimaryMonitor);
timeout = USER_Driver->pGetScreenSaveTimeout();
if(!timeout)
timeout = GetProfileIntA( "windows", "ScreenSaveTimeout", 300 );
*(INT16 *) lpvParam = timeout;
@ -355,11 +355,11 @@ BOOL16 WINAPI SystemParametersInfo16( UINT16 uAction, UINT16 uParam,
break;
case SPI_SETSCREENSAVEACTIVE:
MONITOR_SetScreenSaveActive(&MONITOR_PrimaryMonitor, uParam);
USER_Driver->pSetScreenSaveActive(uParam);
break;
case SPI_SETSCREENSAVETIMEOUT:
MONITOR_SetScreenSaveTimeout(&MONITOR_PrimaryMonitor, uParam);
USER_Driver->pSetScreenSaveTimeout(uParam);
break;
case SPI_SETDESKWALLPAPER:

View File

@ -7,11 +7,9 @@ MODULE = ttydrv
C_SRCS = \
clipboard.c \
desktop.c \
event.c \
init.c \
keyboard.c \
monitor.c \
mouse.c \
wnd.c

View File

@ -1,27 +0,0 @@
/*
* TTY desktop driver
*
* Copyright 1998,1999 Patrik Stridvall
*
*/
#include "config.h"
#include "debugtools.h"
#include "desktop.h"
#include "monitor.h"
#include "ttydrv.h"
DEFAULT_DEBUG_CHANNEL(ttydrv)
/***********************************************************************
* TTYDRV_DESKTOP_GetCursesRootWindow
*
* Return the Curses root window associated to the desktop.
*/
#ifdef HAVE_LIBCURSES
WINDOW *TTYDRV_DESKTOP_GetCursesRootWindow(DESKTOP *pDesktop)
{
return TTYDRV_MONITOR_GetCursesRootWindow(pDesktop->pPrimaryMonitor);
}
#endif /* defined(HAVE_LIBCURSES) */

View File

@ -22,20 +22,6 @@ CLIPBOARD_DRIVER TTYDRV_CLIPBOARD_Driver =
TTYDRV_CLIPBOARD_ResetOwner
};
MONITOR_DRIVER TTYDRV_MONITOR_Driver =
{
TTYDRV_MONITOR_Initialize,
TTYDRV_MONITOR_Finalize,
TTYDRV_MONITOR_IsSingleWindow,
TTYDRV_MONITOR_GetWidth,
TTYDRV_MONITOR_GetHeight,
TTYDRV_MONITOR_GetDepth,
TTYDRV_MONITOR_GetScreenSaveActive,
TTYDRV_MONITOR_SetScreenSaveActive,
TTYDRV_MONITOR_GetScreenSaveTimeout,
TTYDRV_MONITOR_SetScreenSaveTimeout
};
WND_DRIVER TTYDRV_WND_Driver =
{
TTYDRV_WND_Initialize,

View File

@ -1,190 +0,0 @@
/*
* TTY monitor driver
*
* Copyright 1998,1999 Patrik Stridvall
*
*/
#include "config.h"
#include "debugtools.h"
#include "heap.h"
#include "monitor.h"
#include "windef.h"
#include "ttydrv.h"
DEFAULT_DEBUG_CHANNEL(ttydrv)
/***********************************************************************
* TTYDRV_MONITOR_GetCursesRootWindow
*
* Return the Curses root window associated to the MONITOR.
*/
#ifdef HAVE_LIBCURSES
WINDOW *TTYDRV_MONITOR_GetCursesRootWindow(MONITOR *pMonitor)
{
TTYDRV_MONITOR_DATA *pTTYMonitor =
(TTYDRV_MONITOR_DATA *) pMonitor->pDriverData;
return pTTYMonitor->rootWindow;
}
#endif /* defined(HAVE_LIBCURSES) */
/***********************************************************************
* TTYDRV_MONITOR_GetCellWidth
*/
INT TTYDRV_MONITOR_GetCellWidth(MONITOR *pMonitor)
{
TTYDRV_MONITOR_DATA *pTTYMonitor =
(TTYDRV_MONITOR_DATA *) pMonitor->pDriverData;
return pTTYMonitor->cellWidth;
}
/***********************************************************************
* TTYDRV_MONITOR_GetCellHeight
*/
INT TTYDRV_MONITOR_GetCellHeight(MONITOR *pMonitor)
{
TTYDRV_MONITOR_DATA *pTTYMonitor =
(TTYDRV_MONITOR_DATA *) pMonitor->pDriverData;
return pTTYMonitor->cellHeight;
}
/***********************************************************************
* TTYDRV_MONITOR_Initialize
*/
void TTYDRV_MONITOR_Initialize(MONITOR *pMonitor)
{
TTYDRV_MONITOR_DATA *pTTYMonitor = (TTYDRV_MONITOR_DATA *)
HeapAlloc(SystemHeap, 0, sizeof(TTYDRV_MONITOR_DATA));
int rows, cols;
pMonitor->pDriverData = pTTYMonitor;
pTTYMonitor->cellWidth = 8;
pTTYMonitor->cellHeight = 8;
#ifdef HAVE_LIBCURSES
pTTYMonitor->rootWindow = initscr();
if(pTTYMonitor->rootWindow) {
werase(pTTYMonitor->rootWindow);
wrefresh(pTTYMonitor->rootWindow);
}
getmaxyx(pTTYMonitor->rootWindow, rows, cols);
#else /* defined(HAVE_LIBCURSES) */
rows = 60; /* FIXME: Hardcoded */
cols = 80; /* FIXME: Hardcoded */
#endif /* defined(HAVE_LIBCURSES) */
pTTYMonitor->width = pTTYMonitor->cellWidth*cols;
pTTYMonitor->height = pTTYMonitor->cellWidth*rows;
pTTYMonitor->depth = 1;
}
/***********************************************************************
* TTYDRV_MONITOR_Finalize
*/
void TTYDRV_MONITOR_Finalize(MONITOR *pMonitor)
{
TTYDRV_MONITOR_DATA *pTTYMonitor =
(TTYDRV_MONITOR_DATA *) pMonitor->pDriverData;
#ifdef HAVE_LIBCURSES
if(pTTYMonitor->rootWindow) {
endwin();
}
#endif /* defined(HAVE_LIBCURSES) */
HeapFree(SystemHeap, 0, pTTYMonitor);
}
/***********************************************************************
* TTYDRV_MONITOR_IsSingleWindow
*/
BOOL TTYDRV_MONITOR_IsSingleWindow(MONITOR *pMonitor)
{
return TRUE;
}
/***********************************************************************
* TTYDRV_MONITOR_GetWidth
*
* Return the width of the monitor
*/
int TTYDRV_MONITOR_GetWidth(MONITOR *pMonitor)
{
TTYDRV_MONITOR_DATA *pTTYMonitor =
(TTYDRV_MONITOR_DATA *) pMonitor->pDriverData;
return pTTYMonitor->width;
}
/***********************************************************************
* TTYDRV_MONITOR_GetHeight
*
* Return the height of the monitor
*/
int TTYDRV_MONITOR_GetHeight(MONITOR *pMonitor)
{
TTYDRV_MONITOR_DATA *pTTYMonitor =
(TTYDRV_MONITOR_DATA *) pMonitor->pDriverData;
return pTTYMonitor->height;
}
/***********************************************************************
* TTYDRV_MONITOR_GetDepth
*
* Return the depth of the monitor
*/
int TTYDRV_MONITOR_GetDepth(MONITOR *pMonitor)
{
TTYDRV_MONITOR_DATA *pTTYMonitor =
(TTYDRV_MONITOR_DATA *) pMonitor->pDriverData;
return pTTYMonitor->depth;
}
/***********************************************************************
* TTYDRV_MONITOR_GetScreenSaveActive
*
* Returns the active status of the screen saver
*/
BOOL TTYDRV_MONITOR_GetScreenSaveActive(MONITOR *pMonitor)
{
return FALSE;
}
/***********************************************************************
* TTYDRV_MONITOR_SetScreenSaveActive
*
* Activate/Deactivate the screen saver
*/
void TTYDRV_MONITOR_SetScreenSaveActive(MONITOR *pMonitor, BOOL bActivate)
{
FIXME("(%p, %d): stub\n", pMonitor, bActivate);
}
/***********************************************************************
* TTYDRV_MONITOR_GetScreenSaveTimeout
*
* Return the screen saver timeout
*/
int TTYDRV_MONITOR_GetScreenSaveTimeout(MONITOR *pMonitor)
{
return 0;
}
/***********************************************************************
* TTYDRV_MONITOR_SetScreenSaveTimeout
*
* Set the screen saver timeout
*/
void TTYDRV_MONITOR_SetScreenSaveTimeout(
MONITOR *pMonitor, int nTimeout)
{
FIXME("(%p, %d): stub\n", pMonitor, nTimeout);
}

View File

@ -28,20 +28,6 @@ WINDOW *TTYDRV_WND_GetCursesWindow(WND *wndPtr)
}
#endif /* defined(HAVE_LIBCURSES) */
/***********************************************************************
* TTYDRV_WND_GetCursesRootWindow
*
* Return the Curses root window of the Curses window associated
* to a window.
*/
#ifdef HAVE_LIBCURSES
WINDOW *TTYDRV_WND_GetCursesRootWindow(WND *wndPtr)
{
while(wndPtr->parent) wndPtr = wndPtr->parent;
return TTYDRV_DESKTOP_GetCursesRootWindow((struct tagDESKTOP *) wndPtr->wExtra);
}
#endif /* defined(HAVE_LIBCURSES) */
/**********************************************************************
* TTYDRV_WND_Initialize
*/

View File

@ -24,11 +24,11 @@
#include "toolhelp.h"
#include "message.h"
#include "module.h"
#include "monitor.h"
#include "miscemu.h"
#include "shell.h"
#include "callback.h"
#include "local.h"
#include "desktop.h"
#include "process.h"
#include "debugtools.h"
@ -395,9 +395,9 @@ LONG WINAPI ChangeDisplaySettingsA( LPDEVMODEA devmode, DWORD flags )
MESSAGE("\tflags=");_dump_CDS_flags(flags);MESSAGE("\n");
if (devmode==NULL)
FIXME_(system)(" devmode=NULL (return to default mode)\n");
else if ( (devmode->dmBitsPerPel != DESKTOP_GetScreenDepth())
|| (devmode->dmPelsHeight != DESKTOP_GetScreenHeight())
|| (devmode->dmPelsWidth != DESKTOP_GetScreenWidth()) )
else if ( (devmode->dmBitsPerPel != MONITOR_GetDepth(&MONITOR_PrimaryMonitor))
|| (devmode->dmPelsHeight != MONITOR_GetHeight(&MONITOR_PrimaryMonitor))
|| (devmode->dmPelsWidth != MONITOR_GetWidth(&MONITOR_PrimaryMonitor)) )
{
@ -425,9 +425,9 @@ LONG WINAPI ChangeDisplaySettingsExA(
MESSAGE("\tflags=");_dump_CDS_flags(flags);MESSAGE("\n");
if (devmode==NULL)
FIXME_(system)(" devmode=NULL (return to default mode)\n");
else if ( (devmode->dmBitsPerPel != DESKTOP_GetScreenDepth())
|| (devmode->dmPelsHeight != DESKTOP_GetScreenHeight())
|| (devmode->dmPelsWidth != DESKTOP_GetScreenWidth()) )
else if ( (devmode->dmBitsPerPel != MONITOR_GetDepth(&MONITOR_PrimaryMonitor))
|| (devmode->dmPelsHeight != MONITOR_GetHeight(&MONITOR_PrimaryMonitor))
|| (devmode->dmPelsWidth != MONITOR_GetWidth(&MONITOR_PrimaryMonitor)) )
{
@ -466,9 +466,9 @@ BOOL WINAPI EnumDisplaySettingsA(
TRACE_(system)("(%s,%ld,%p)\n",name,n,devmode);
if (n==0) {
devmode->dmBitsPerPel = DESKTOP_GetScreenDepth();
devmode->dmPelsHeight = DESKTOP_GetScreenHeight();
devmode->dmPelsWidth = DESKTOP_GetScreenWidth();
devmode->dmBitsPerPel = MONITOR_GetDepth(&MONITOR_PrimaryMonitor);
devmode->dmPelsHeight = MONITOR_GetHeight(&MONITOR_PrimaryMonitor);
devmode->dmPelsWidth = MONITOR_GetWidth(&MONITOR_PrimaryMonitor);
return TRUE;
}
if ((n-1)<NRMODES*NRDEPTHS) {

View File

@ -32,7 +32,6 @@
#include "winerror.h"
#include "mdi.h"
#include "local.h"
#include "desktop.h"
#include "syslevel.h"
#include "stackframe.h"
#include "debugtools.h"
@ -588,7 +587,6 @@ BOOL WIN_CreateDesktopWindow(void)
{
CLASS *class;
HWND hwndDesktop;
DESKTOP *pDesktop;
TRACE("Creating desktop window\n");
@ -602,9 +600,6 @@ BOOL WIN_CreateDesktopWindow(void)
if (!hwndDesktop) return FALSE;
pWndDesktop = (WND *) USER_HEAP_LIN_ADDR( hwndDesktop );
pDesktop = (DESKTOP *) pWndDesktop->wExtra;
pDesktop->pPrimaryMonitor = &MONITOR_PrimaryMonitor;
pWndDesktop->pDriver = WND_Driver;
pWndDesktop->pDriver->pInitialize(pWndDesktop);

View File

@ -10,7 +10,6 @@ C_SRCS = \
event.c \
init.c \
keyboard.c \
monitor.c \
mouse.c \
wnd.c

View File

@ -26,20 +26,6 @@ CLIPBOARD_DRIVER X11DRV_CLIPBOARD_Driver =
X11DRV_CLIPBOARD_ResetOwner
};
MONITOR_DRIVER X11DRV_MONITOR_Driver =
{
X11DRV_MONITOR_Initialize,
X11DRV_MONITOR_Finalize,
X11DRV_MONITOR_IsSingleWindow,
X11DRV_MONITOR_GetWidth,
X11DRV_MONITOR_GetHeight,
X11DRV_MONITOR_GetDepth,
X11DRV_MONITOR_GetScreenSaveActive,
X11DRV_MONITOR_SetScreenSaveActive,
X11DRV_MONITOR_GetScreenSaveTimeout,
X11DRV_MONITOR_SetScreenSaveTimeout
};
WND_DRIVER X11DRV_WND_Driver =
{
X11DRV_WND_Initialize,

View File

@ -1,220 +0,0 @@
/*
* X11 monitor driver
*
* Copyright 1998 Patrik Stridvall
*
*/
#include "config.h"
#ifndef X_DISPLAY_MISSING
#include <stdlib.h>
#include <X11/cursorfont.h>
#include "ts_xlib.h"
#include "ts_xutil.h"
#include "debugtools.h"
#include "heap.h"
#include "monitor.h"
#include "options.h"
#include "windef.h"
#include "x11drv.h"
/***********************************************************************
* X11DRV_MONITOR_CreateDesktop
* FIXME
* The desktop should create created in X11DRV_DESKTOP_Initialize
* instead but it can't be yet because some code depends on that
* the desktop always exists.
*
*/
static void X11DRV_MONITOR_CreateDesktop(MONITOR *pMonitor)
{
X11DRV_MONITOR_DATA *pX11Monitor =
(X11DRV_MONITOR_DATA *) pMonitor->pDriverData;
int x = 0, y = 0, flags;
unsigned int width = 640, height = 480; /* Default size = 640x480 */
char *name = "Wine desktop";
XSizeHints *size_hints;
XWMHints *wm_hints;
XClassHint *class_hints;
XSetWindowAttributes win_attr;
XTextProperty window_name;
Atom XA_WM_DELETE_WINDOW;
flags = TSXParseGeometry( Options.desktopGeometry, &x, &y, &width, &height );
pX11Monitor->width = width;
pX11Monitor->height = height;
/* Create window */
win_attr.background_pixel = BlackPixel(display, 0);
win_attr.event_mask =
ExposureMask | KeyPressMask | KeyReleaseMask |
PointerMotionMask | ButtonPressMask |
ButtonReleaseMask | EnterWindowMask;
win_attr.cursor = TSXCreateFontCursor( display, XC_top_left_arrow );
root_window = TSXCreateWindow( display,
DefaultRootWindow(display),
x, y, width, height, 0,
CopyFromParent, InputOutput, CopyFromParent,
CWBackPixel | CWEventMask | CWCursor, &win_attr);
/* Set window manager properties */
size_hints = TSXAllocSizeHints();
wm_hints = TSXAllocWMHints();
class_hints = TSXAllocClassHint();
if (!size_hints || !wm_hints || !class_hints)
{
MESSAGE("Not enough memory for window manager hints.\n" );
exit(1);
}
size_hints->min_width = size_hints->max_width = width;
size_hints->min_height = size_hints->max_height = height;
size_hints->flags = PMinSize | PMaxSize;
if (flags & (XValue | YValue)) size_hints->flags |= USPosition;
if (flags & (WidthValue | HeightValue)) size_hints->flags |= USSize;
else size_hints->flags |= PSize;
wm_hints->flags = InputHint | StateHint;
wm_hints->input = True;
wm_hints->initial_state = NormalState;
class_hints->res_name = (char *)argv0;
class_hints->res_class = "Wine";
TSXStringListToTextProperty( &name, 1, &window_name );
TSXSetWMProperties( display, root_window, &window_name, &window_name,
Options.argv, Options.argc, size_hints, wm_hints, class_hints );
XA_WM_DELETE_WINDOW = TSXInternAtom( display, "WM_DELETE_WINDOW", False );
TSXSetWMProtocols( display, root_window, &XA_WM_DELETE_WINDOW, 1 );
TSXFree( size_hints );
TSXFree( wm_hints );
TSXFree( class_hints );
/* Map window */
TSXMapWindow( display, root_window );
}
/***********************************************************************
* X11DRV_MONITOR_Initialize
*/
void X11DRV_MONITOR_Initialize(MONITOR *pMonitor)
{
X11DRV_MONITOR_DATA *pX11Monitor = (X11DRV_MONITOR_DATA *)
HeapAlloc(SystemHeap, 0, sizeof(X11DRV_MONITOR_DATA));
pMonitor->pDriverData = pX11Monitor;
pX11Monitor->width = WidthOfScreen( screen );
pX11Monitor->height = HeightOfScreen( screen );
if (Options.desktopGeometry) X11DRV_MONITOR_CreateDesktop(pMonitor);
}
/***********************************************************************
* X11DRV_MONITOR_Finalize
*/
void X11DRV_MONITOR_Finalize(MONITOR *pMonitor)
{
HeapFree(SystemHeap, 0, pMonitor->pDriverData);
}
/***********************************************************************
* X11DRV_MONITOR_IsSingleWindow
*/
BOOL X11DRV_MONITOR_IsSingleWindow(MONITOR *pMonitor)
{
return (root_window != DefaultRootWindow(display));
}
/***********************************************************************
* X11DRV_MONITOR_GetWidth
*
* Return the width of the monitor
*/
int X11DRV_MONITOR_GetWidth(MONITOR *pMonitor)
{
X11DRV_MONITOR_DATA *pX11Monitor =
(X11DRV_MONITOR_DATA *) pMonitor->pDriverData;
return pX11Monitor->width;
}
/***********************************************************************
* X11DRV_MONITOR_GetHeight
*
* Return the height of the monitor
*/
int X11DRV_MONITOR_GetHeight(MONITOR *pMonitor)
{
X11DRV_MONITOR_DATA *pX11Monitor =
(X11DRV_MONITOR_DATA *) pMonitor->pDriverData;
return pX11Monitor->height;
}
/***********************************************************************
* X11DRV_MONITOR_GetDepth
*
* Return the depth of the monitor
*/
int X11DRV_MONITOR_GetDepth(MONITOR *pMonitor)
{
return screen_depth;
}
/***********************************************************************
* X11DRV_MONITOR_GetScreenSaveActive
*
* Returns the active status of the screen saver
*/
BOOL X11DRV_MONITOR_GetScreenSaveActive(MONITOR *pMonitor)
{
int timeout, temp;
TSXGetScreenSaver(display, &timeout, &temp, &temp, &temp);
return timeout!=NULL;
}
/***********************************************************************
* X11DRV_MONITOR_SetScreenSaveActive
*
* Activate/Deactivate the screen saver
*/
void X11DRV_MONITOR_SetScreenSaveActive(MONITOR *pMonitor, BOOL bActivate)
{
if(bActivate)
TSXActivateScreenSaver(display);
else
TSXResetScreenSaver(display);
}
/***********************************************************************
* X11DRV_MONITOR_GetScreenSaveTimeout
*
* Return the screen saver timeout
*/
int X11DRV_MONITOR_GetScreenSaveTimeout(MONITOR *pMonitor)
{
int timeout, temp;
TSXGetScreenSaver(display, &timeout, &temp, &temp, &temp);
return timeout;
}
/***********************************************************************
* X11DRV_MONITOR_SetScreenSaveTimeout
*
* Set the screen saver timeout
*/
void X11DRV_MONITOR_SetScreenSaveTimeout(
MONITOR *pMonitor, int nTimeout)
{
TSXSetScreenSaver(display, nTimeout, 60,
DefaultBlanking, DefaultExposures);
}
#endif /* X_DISPLAY_MISSING */