From 7f3418fba089c3c4633e45cc16bfe4feba2abc59 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Sat, 25 Mar 2000 17:30:13 +0000 Subject: [PATCH] Store monitor size and depth in the generic structure. Merged monitor driver into USER driver. --- controls/desktop.c | 61 +--------- dlls/ttydrv/ttydrv_main.c | 135 ++++++++++++++++++++--- dlls/x11drv/x11drv_main.c | 157 ++++++++++++++++++++++++-- graphics/ttydrv/dc.c | 6 +- include/desktop.h | 8 -- include/monitor.h | 43 +++----- include/ttydrv.h | 52 +++------ include/user.h | 7 ++ include/x11drv.h | 28 +---- misc/main.c | 1 - windows/dce.c | 6 +- windows/multimon.c | 103 +---------------- windows/sysparams.c | 14 +-- windows/ttydrv/Makefile.in | 2 - windows/ttydrv/desktop.c | 27 ----- windows/ttydrv/init.c | 14 --- windows/ttydrv/monitor.c | 190 -------------------------------- windows/ttydrv/wnd.c | 14 --- windows/user.c | 20 ++-- windows/win.c | 5 - windows/x11drv/Makefile.in | 1 - windows/x11drv/init.c | 14 --- windows/x11drv/monitor.c | 220 ------------------------------------- 23 files changed, 341 insertions(+), 787 deletions(-) delete mode 100644 windows/ttydrv/desktop.c delete mode 100644 windows/ttydrv/monitor.c delete mode 100644 windows/x11drv/monitor.c diff --git a/controls/desktop.c b/controls/desktop.c index 786921ff49a..1341ff33a7f 100644 --- a/controls/desktop.c +++ b/controls/desktop.c @@ -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 ); diff --git a/dlls/ttydrv/ttydrv_main.c b/dlls/ttydrv/ttydrv_main.c index aa65f14c90e..b65d6d8ba63 100644 --- a/dlls/ttydrv/ttydrv_main.c +++ b/dlls/ttydrv/ttydrv_main.c @@ -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; +} diff --git a/dlls/x11drv/x11drv_main.c b/dlls/x11drv/x11drv_main.c index 0489b2152f5..7b5ea3acd1d 100644 --- a/dlls/x11drv/x11drv_main.c +++ b/dlls/x11drv/x11drv_main.c @@ -7,7 +7,9 @@ #include #include +#include #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)); +} diff --git a/graphics/ttydrv/dc.c b/graphics/ttydrv/dc.c index 63948dce68b..de1a6d65499 100644 --- a/graphics/ttydrv/dc.c +++ b/graphics/ttydrv/dc.c @@ -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); diff --git a/include/desktop.h b/include/desktop.h index 7d75ac0b926..9e130ab921b 100644 --- a/include/desktop.h +++ b/include/desktop.h @@ -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 ); diff --git a/include/monitor.h b/include/monitor.h index 7947748be6c..e7c95c5e6cb 100644 --- a/include/monitor.h +++ b/include/monitor.h @@ -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 */ - diff --git a/include/ttydrv.h b/include/ttydrv.h index 4a56d763a38..cbe978885cc 100644 --- a/include/ttydrv.h +++ b/include/ttydrv.h @@ -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); diff --git a/include/user.h b/include/user.h index 74af41d4816..741428a6711 100644 --- a/include/user.h +++ b/include/user.h @@ -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; diff --git a/include/x11drv.h b/include/x11drv.h index 5a0a1a72679..e15565987aa 100644 --- a/include/x11drv.h +++ b/include/x11drv.h @@ -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(); diff --git a/misc/main.c b/misc/main.c index 98471c3890c..05c237e42ab 100644 --- a/misc/main.c +++ b/misc/main.c @@ -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" diff --git a/windows/dce.c b/windows/dce.c index b166d3aa915..78f1123ce72 100644 --- a/windows/dce.c +++ b/windows/dce.c @@ -18,7 +18,6 @@ */ #include -#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 { diff --git a/windows/multimon.c b/windows/multimon.c index a3076e25ea8..987b6abf94b 100644 --- a/windows/multimon.c +++ b/windows/multimon.c @@ -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; diff --git a/windows/sysparams.c b/windows/sysparams.c index f5c0b46d747..3ebe1257c23 100644 --- a/windows/sysparams.c +++ b/windows/sysparams.c @@ -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: diff --git a/windows/ttydrv/Makefile.in b/windows/ttydrv/Makefile.in index fcf53f62738..8e244948245 100644 --- a/windows/ttydrv/Makefile.in +++ b/windows/ttydrv/Makefile.in @@ -7,11 +7,9 @@ MODULE = ttydrv C_SRCS = \ clipboard.c \ - desktop.c \ event.c \ init.c \ keyboard.c \ - monitor.c \ mouse.c \ wnd.c diff --git a/windows/ttydrv/desktop.c b/windows/ttydrv/desktop.c deleted file mode 100644 index 23ad73c51d2..00000000000 --- a/windows/ttydrv/desktop.c +++ /dev/null @@ -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) */ diff --git a/windows/ttydrv/init.c b/windows/ttydrv/init.c index 74bd93f3149..41dd14a6922 100644 --- a/windows/ttydrv/init.c +++ b/windows/ttydrv/init.c @@ -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, diff --git a/windows/ttydrv/monitor.c b/windows/ttydrv/monitor.c deleted file mode 100644 index fb0d702c64a..00000000000 --- a/windows/ttydrv/monitor.c +++ /dev/null @@ -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); -} diff --git a/windows/ttydrv/wnd.c b/windows/ttydrv/wnd.c index 27b9a27fe66..e8a21008fdc 100644 --- a/windows/ttydrv/wnd.c +++ b/windows/ttydrv/wnd.c @@ -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 */ diff --git a/windows/user.c b/windows/user.c index c72a4674984..cc436821301 100644 --- a/windows/user.c +++ b/windows/user.c @@ -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)wExtra; - pDesktop->pPrimaryMonitor = &MONITOR_PrimaryMonitor; - pWndDesktop->pDriver = WND_Driver; pWndDesktop->pDriver->pInitialize(pWndDesktop); diff --git a/windows/x11drv/Makefile.in b/windows/x11drv/Makefile.in index c2b990ba324..3159c15295a 100644 --- a/windows/x11drv/Makefile.in +++ b/windows/x11drv/Makefile.in @@ -10,7 +10,6 @@ C_SRCS = \ event.c \ init.c \ keyboard.c \ - monitor.c \ mouse.c \ wnd.c diff --git a/windows/x11drv/init.c b/windows/x11drv/init.c index 5913a4aa442..37616fe321a 100644 --- a/windows/x11drv/init.c +++ b/windows/x11drv/init.c @@ -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, diff --git a/windows/x11drv/monitor.c b/windows/x11drv/monitor.c deleted file mode 100644 index 9204ff1c064..00000000000 --- a/windows/x11drv/monitor.c +++ /dev/null @@ -1,220 +0,0 @@ -/* - * X11 monitor driver - * - * Copyright 1998 Patrik Stridvall - * - */ - -#include "config.h" - -#ifndef X_DISPLAY_MISSING - -#include -#include -#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 */