void miPointerWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { miPointerPtr pPointer; BOOL changedScreen = FALSE; SetupScreen (pScreen); pPointer = MIPOINTER(pDev); if (pPointer->pScreen != pScreen) { (*pScreenPriv->screenFuncs->NewEventScreen) (pDev, pScreen, TRUE); changedScreen = TRUE; } if (GenerateEvent) miPointerMove (pDev, pScreen, x, y); else miPointerMoveNoEvent(pDev, pScreen, x, y); /* Don't call USFS if we use Xinerama, otherwise the root window is * updated to the second screen, and we never receive any events. * (FDO bug #18668) */ if (changedScreen #ifdef PANORAMIX && noPanoramiXExtension #endif ) UpdateSpriteForScreen (pDev, pScreen) ; }
/* Set up sprite information for the device. This function will be called once for each device after it is initialized in the DIX. */ static Bool miPointerDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen) { miPointerPtr pPointer; SetupScreen (pScreen); pPointer = malloc(sizeof(miPointerRec)); if (!pPointer) return FALSE; pPointer->pScreen = NULL; pPointer->pSpriteScreen = NULL; pPointer->pCursor = NULL; pPointer->pSpriteCursor = NULL; pPointer->limits.x1 = 0; pPointer->limits.x2 = 32767; pPointer->limits.y1 = 0; pPointer->limits.y2 = 32767; pPointer->confined = FALSE; pPointer->x = 0; pPointer->y = 0; if (!((*pScreenPriv->spriteFuncs->DeviceCursorInitialize)(pDev, pScreen))) { free(pPointer); return FALSE; } dixSetPrivate(&pDev->devPrivates, miPointerPrivKey, pPointer); return TRUE; }
/* Move the pointer on the current screen, and update the sprite. */ static void miPointerMoveNoEvent (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { miPointerPtr pPointer; SetupScreen(pScreen); pPointer = MIPOINTER(pDev); /* Hack: We mustn't call into ->MoveCursor for anything but the * VCP, as this may cause a non-HW rendered cursor to be rendered during * SIGIO. This again leads to allocs during SIGIO which leads to SIGABRT. */ if ((pDev == inputInfo.pointer || (!IsMaster(pDev) && pDev->u.master == inputInfo.pointer)) && !pScreenPriv->waitForUpdate && pScreen == pPointer->pSpriteScreen) { pPointer->devx = x; pPointer->devy = y; if(pPointer->pCursor && !pPointer->pCursor->bits->emptyMask) (*pScreenPriv->spriteFuncs->MoveCursor) (pDev, pScreen, x, y); } pPointer->x = x; pPointer->y = y; pPointer->pScreen = pScreen; }
static Bool miPointerUnrealizeCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) { SetupScreen(pScreen); return (*pScreenPriv->spriteFuncs->UnrealizeCursor) (pDev, pScreen, pCursor); }
/* Controls whether the cursor image should be updated immediately when moved (FALSE) or if something else will be responsible for updating it later (TRUE). Returns current setting. Caller is responsible for calling OsBlockSignal first. */ Bool miPointerSetWaitForUpdate(ScreenPtr pScreen, Bool wait) { SetupScreen(pScreen); Bool prevWait = pScreenPriv->waitForUpdate; pScreenPriv->waitForUpdate = wait; return prevWait; }
/** * Destroy screen-specific information. * * @param index Screen index of the screen in screenInfo.screens[] * @param pScreen The actual screen pointer */ static Bool miPointerCloseScreen(ScreenPtr pScreen) { SetupScreen(pScreen); pScreen->CloseScreen = pScreenPriv->CloseScreen; free((pointer) pScreenPriv); FreeEventList(mipointermove_events, GetMaximumEventsNum()); mipointermove_events = NULL; return (*pScreen->CloseScreen) (pScreen); }
/** * Destroy screen-specific information. * * @param index Screen index of the screen in screenInfo.screens[] * @param pScreen The actual screen pointer */ static Bool miPointerCloseScreen (int index, ScreenPtr pScreen) { SetupScreen(pScreen); pScreen->CloseScreen = pScreenPriv->CloseScreen; free((pointer) pScreenPriv); FreeEventList(events, GetMaximumEventsNum()); events = NULL; return (*pScreen->CloseScreen) (index, pScreen); }
/* Clean up after device. This function will be called once before the device is freed in the DIX */ static void miPointerDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen) { SetupScreen(pScreen); if (!IsMaster(pDev) && pDev->u.master) return; (*pScreenPriv->spriteFuncs->DeviceCursorCleanup)(pDev, pScreen); free(dixLookupPrivate(&pDev->devPrivates, miPointerPrivKey)); dixSetPrivate(&pDev->devPrivates, miPointerPrivKey, NULL); }
static Bool miPointerSetCursorPosition(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y, Bool generateEvent) { SetupScreen (pScreen); GenerateEvent = generateEvent; /* device dependent - must pend signal and call miPointerWarpCursor */ (*pScreenPriv->screenFuncs->WarpCursor) (pDev, pScreen, x, y); if (!generateEvent) miPointerUpdateSprite(pDev); return TRUE; }
VOID FinishExternalScreen(VOID) { // make sure we clean up later GraphicsScreenDirty = TRUE; if (haveError) { SwitchToText(FALSE); PauseForKey(); } // Reset the screen resolution, in case external program changed it.... SetupScreen(); // reset error flag haveError = FALSE; }
void miPointerWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { miPointerPtr pPointer; BOOL changedScreen = FALSE; SetupScreen (pScreen); pPointer = MIPOINTER(pDev); if (pPointer->pScreen != pScreen) { (*pScreenPriv->screenFuncs->NewEventScreen) (pDev, pScreen, TRUE); changedScreen = TRUE; } if (GenerateEvent) { miPointerMove (pDev, pScreen, x, y); } else { /* everything from miPointerMove except the event and history */ if (!pScreenPriv->waitForUpdate && pScreen == pPointer->pSpriteScreen) { pPointer->devx = x; pPointer->devy = y; if(pPointer->pCursor && !pPointer->pCursor->bits->emptyMask) (*pScreenPriv->spriteFuncs->MoveCursor) (pDev, pScreen, x, y); } pPointer->x = x; pPointer->y = y; pPointer->pScreen = pScreen; } /* Don't call USFS if we use Xinerama, otherwise the root window is * updated to the second screen, and we never receive any events. * (FDO bug #18668) */ if (changedScreen #ifdef PANORAMIX && noPanoramiXExtension #endif ) UpdateSpriteForScreen (pDev, pScreen) ; }
/** * Set the device's cursor position to the x/y position on the given screen. * Generates and event if required. * * This function is called from: * - sprite init code to place onto initial position * - the various WarpPointer implementations (core, XI, Xinerama, dmx,…) * - during the cursor update path in CheckMotion * - in the Xinerama part of NewCurrentScreen * - when a RandR/RandR1.2 mode was applied (it may have moved the pointer, so * it's set back to the original pos) * * @param pDev The device to move * @param pScreen The screen the device is on * @param x The x coordinate in per-screen coordinates * @param y The y coordinate in per-screen coordinates * @param generateEvent True if the pointer movement should generate an * event. * * @return TRUE in all cases */ static Bool miPointerSetCursorPosition(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y, Bool generateEvent) { SetupScreen(pScreen); miPointerPtr pPointer = MIPOINTER(pDev); pPointer->generateEvent = generateEvent; if (pScreen->ConstrainCursorHarder) pScreen->ConstrainCursorHarder(pDev, pScreen, Absolute, &x, &y); /* device dependent - must pend signal and call miPointerWarpCursor */ (*pScreenPriv->screenFuncs->WarpCursor) (pDev, pScreen, x, y); if (!generateEvent) miPointerUpdateSprite(pDev); return TRUE; }
static Bool miPointerCloseScreen (int index, ScreenPtr pScreen) { #if 0 miPointerPtr pPointer; DeviceIntPtr pDev; #endif SetupScreen(pScreen); #if 0 for (pDev = inputInfo.devices; pDev; pDev = pDev->next) { if (DevHasCursor(pDev)) { pPointer = MIPOINTER(pDev); if (pScreen == pPointer->pScreen) pPointer->pScreen = 0; if (pScreen == pPointer->pSpriteScreen) pPointer->pSpriteScreen = 0; } } if (MIPOINTER(inputInfo.pointer)->pScreen == pScreen) MIPOINTER(inputInfo.pointer)->pScreen = 0; if (MIPOINTER(inputInfo.pointer)->pSpriteScreen == pScreen) MIPOINTER(inputInfo.pointer)->pSpriteScreen = 0; #endif pScreen->CloseScreen = pScreenPriv->CloseScreen; free((pointer) pScreenPriv); FreeEventList(events, GetMaximumEventsNum()); events = NULL; return (*pScreen->CloseScreen) (index, pScreen); }
bool Graphics2D::Test( bool testResolutions ) { bool ok = true; cout << "Testing Graphics2D" << endl; try { cout << "Init()" << endl; Graphics2D::Instance().Init( ); PrintVideoInfo( ); cout << endl; if ( testResolutions ) { cout << "SetupScreen( 640, 480 )" << endl; SetupScreen( 640, 480, "Graphics2D Test 640x480" ); PrintVideoInfo( ); cout << endl; ::SDL_Delay( 1000 ); cout << "SetupScreen( 320, 240, PixelType0RGB )" << endl; SetupScreen( 320, 240, "Graphics2D Test 320x240", PixelType0RGB ); PrintVideoInfo( ); cout << endl; ::SDL_Delay( 1000 ); cout << "SetupScreen( 320, 240, PixelTypeRGB0 )" << endl; SetupScreen( 320, 240, "Graphics2D Test 320x240", PixelTypeRGB0 ); PrintVideoInfo( ); cout << endl; ::SDL_Delay( 1000 ); cout << "SetupScreen( 640, 480, PixelType565 )" << endl; SetupScreen( 640, 480, "Graphics2D Test 640x480", PixelType565 ); PrintVideoInfo( ); cout << endl; ::SDL_Delay( 1000 ); cout << "Shutdown()" << endl; Graphics2D::Instance().Shutdown( ); cout << "Init()" << endl; Graphics2D::Instance().Init( ); cout << "Init() again" << endl; Graphics2D::Instance().Init( ); cout << endl; cout << "SetupScreen( 640, 480, NativePixelType, true )" << endl; SetupScreen( 640, 480, "Graphics2D Test 640x480", NativePixelType, true ); PrintVideoInfo( ); cout << endl; ::SDL_Delay( 1500 ); cout << "SetupScreen( 640, 480, NativePixelType, true, true )" << endl; SetupScreen( 640, 480, "Graphics2D Test 640x480", NativePixelType, true, true ); PrintVideoInfo( ); cout << endl; ::SDL_Delay( 1500 ); #ifndef OS_WINDOWS cout << "SetupScreen( 800, 600, PixelType565, true, true )" << endl; SetupScreen( 800, 600, "Graphics2D Test 800x600", PixelType565, true, true ); PrintVideoInfo( ); cout << endl; ::SDL_Delay( 1500 ); #endif } cout << "Shutdown()" << endl; Graphics2D::Instance().Shutdown( ); cout << "Shutdown() again" << endl; Graphics2D::Instance().Shutdown( ); } catch ( SDLException & except ) { cout << except.Description( ) << endl; ok = false; } if ( ok ) cout << "Graphics2D PASSED." << endl << endl; else cout << "Graphics2D FAILED." << endl << endl; return ok; }
/*----------------------------------------------------------------------------- Background thread for managing the state of the agent -----------------------------------------------------------------------------*/ void CurlBlastDlg::ThreadProc(void) { LoadSettings(); // configure the desktop resolution WaitForSingleObject(testingMutex, INFINITE); SetupScreen(); ReleaseMutex(testingMutex); // wait for the statup delay SetStatus(_T("Starting up...")); DWORD ms = startupDelay; while( ms > 0 && WaitForSingleObject(hMustExit,0) == WAIT_TIMEOUT) { Sleep(500); ms -= 500; } // launch the watchdog TCHAR path[MAX_PATH]; GetModuleFileName(NULL, path, MAX_PATH); lstrcpy(PathFindFileName(path), _T("wptwatchdog.exe")); CString watchdog; watchdog.Format(_T("\"%s\" %d"), path, GetCurrentProcessId()); HANDLE process = NULL; LaunchProcess(watchdog, &process); if (process) CloseHandle(process); if (WaitForSingleObject(hMustExit,0) == WAIT_TIMEOUT) { DoStartup(); } // handle the periodic cleanup until it is time to exit Alive(); DWORD msCleanup = 500; DWORD msTemp = 20000; while(WaitForSingleObject(hMustExit,0) == WAIT_TIMEOUT) { if (!msCleanup) { CloseDialogs(); KillProcs(); msCleanup = 500; } else msCleanup -= 500; if (!msTemp) { if (WaitForSingleObject(testingMutex, 0) != WAIT_TIMEOUT) { ClearTemp(); msTemp = 20000; ReleaseMutex(testingMutex); } } else msTemp -= 500; CheckAlive(); Sleep(500); } // signal and wait for all of the workers to finish KillWorker(); // shut down the url manager urlManager.Stop(); }
iuiAPI void SetupScreen( Widget *w ) { SetupScreen(Rect(w->getPositionAbs(), w->getSize())); }
/*********************************************************************** * Procedure: * main - start of afterstep ************************************************************************/ int main (int argc, char **argv, char **envp) { register int i ; int start_viewport_x = 0 ; int start_viewport_y = 0 ; int start_desk = 0 ; #ifdef LOCAL_DEBUG #if 0 LOCAL_DEBUG_OUT( "calibrating sleep_a_millisec : %s","" ); for( i = 0 ; i < 500 ; ++i ) sleep_a_millisec( 10 ); LOCAL_DEBUG_OUT( "500 sliip_a_millisec(10) completed%s","" ); for( i = 0 ; i < 50 ; ++i ) sleep_a_millisec( 100 ); LOCAL_DEBUG_OUT( "50 sliip_a_millisec(100) completed%s","" ); for( i = 0 ; i < 10 ; ++i ) sleep_a_millisec( 300 ); LOCAL_DEBUG_OUT( "10 sliip_a_millisec(300) completed%s","" ); #endif #endif _as_grab_screen_func = GrabEm; _as_ungrab_screen_func = UngrabEm; original_DISPLAY_string = getenv("DISPLAY"); if (original_DISPLAY_string) original_DISPLAY_string = mystrdup(original_DISPLAY_string); #ifdef DEBUG_TRACE_X trace_window_id2name_hook = &window_id2name; #endif set_DeadPipe_handler(DeadPipe); #if !HAVE_DECL_ENVIRON override_environ( envp ); #endif InitMyApp( CLASS_AFTERSTEP, argc, argv, NULL, AfterStep_usage, 0); LinkAfterStepConfig(); AfterStepState = MyArgs.flags ; clear_flags( AfterStepState, ASS_NormalOperation ); set_flags( AfterStepState, ASS_SuppressDeskBack ); #ifdef __CYGWIN__ CloseOnExec = ASCloseOnExec ; #endif #if defined(LOG_FONT_CALLS) fprintf (stderr, "logging font calls now\n"); #endif /* These signals are mandatory : */ signal (SIGUSR1, Restart); /* These signals we would like to handle only if those are not handled already (by debugger): */ IgnoreSignal(SIGINT); IgnoreSignal(SIGHUP); IgnoreSignal(SIGQUIT); IgnoreSignal(SIGTERM); if( ConnectX( ASDefaultScr, AS_ROOT_EVENT_MASK ) < 0 ) { show_error( "Hostile X server encountered - unable to proceed :-("); return 1;/* failed to accure window management selection - other wm is running */ } ASDBus_fd = asdbus_init(); XSetWindowBackground( dpy, Scr.Root, Scr.asv->black_pixel ); Scr.Look.desktop_animation_tint = get_random_tint_color(); cover_desktop(); if( get_flags( AfterStepState, ASS_Restarting )) { show_progress( "AfterStep v.%s is restarting ...", VERSION ); display_progress( True, "AfterStep v.%s is restarting ...", VERSION ); }else { show_progress( "AfterStep v.%s is starting up ...", VERSION ); display_progress( True, "AfterStep v.%s is starting up ...", VERSION ); } if (ASDBus_fd>=0) { show_progress ("Successfuly accured System DBus connection."); asdbus_RegisterSMClient(SMClientID_string); } SHOW_CHECKPOINT; InitSession(); SHOW_CHECKPOINT; XSync (dpy, 0); SHOW_CHECKPOINT; set_parent_hints_func( afterstep_parent_hints_func ); /* callback for collect_hints() */ SHOW_CHECKPOINT; SetupModules(); SHOW_CHECKPOINT; SetupScreen(); SHOW_CHECKPOINT; event_setup( True /*Bool local*/ ); SHOW_CHECKPOINT; /* * Lets init each and every screen separately : */ for (i = 0; i < Scr.NumberOfScreens; i++) { show_progress( "Initializing screen %d ...", i ); display_progress( True, "Initializing screen %d ...", i ); if (i != Scr.screen) { if( !get_flags(MyArgs.flags, ASS_SingleScreen) ) { int pid = spawn_child( MyName, (i<MAX_USER_SINGLETONS_NUM)?i:-1, i, NULL, None, C_NO_CONTEXT, True, True, NULL ); if( pid >= 0 ) show_progress( "\t instance of afterstep spawned with pid %d.", pid ); else show_error( "failed to launch instance of afterstep to handle screen #%d", i ); } }else { make_screen_envvars(ASDefaultScr); putenv (Scr.rdisplay_string); putenv (Scr.display_string); if( is_output_level_under_threshold( OUTPUT_LEVEL_PROGRESS ) ) { show_progress( "\t screen[%d].size = %ux%u", Scr.screen, Scr.MyDisplayWidth, Scr.MyDisplayHeight ); display_progress( True, " screen[%d].size = %ux%u", Scr.screen, Scr.MyDisplayWidth, Scr.MyDisplayHeight ); show_progress( "\t screen[%d].root = %lX", Scr.screen, Scr.Root ); show_progress( "\t screen[%d].color_depth = %d", Scr.screen, Scr.asv->true_depth ); display_progress( True, " screen[%d].color_depth = %d", Scr.screen, Scr.asv->true_depth ); show_progress( "\t screen[%d].colormap = 0x%lX", Scr.screen, Scr.asv->colormap ); show_progress( "\t screen[%d].visual.id = %X", Scr.screen, Scr.asv->visual_info.visualid ); display_progress( True, " screen[%d].visual.id = %X", Scr.screen, Scr.asv->visual_info.visualid ); show_progress( "\t screen[%d].visual.class = %d", Scr.screen, Scr.asv->visual_info.class ); display_progress( True, " screen[%d].visual.class = %d", Scr.screen, Scr.asv->visual_info.class ); show_progress( "\t screen[%d].visual.red_mask = 0x%8.8lX", Scr.screen, Scr.asv->visual_info.red_mask ); show_progress( "\t screen[%d].visual.green_mask = 0x%8.8lX", Scr.screen, Scr.asv->visual_info.green_mask ); show_progress( "\t screen[%d].visual.blue_mask = 0x%8.8lX", Scr.screen, Scr.asv->visual_info.blue_mask ); show_progress( "\t screen[%d].rdisplay_string = \"%s\"", Scr.screen, Scr.rdisplay_string ); show_progress( "\t screen[%d].display_string = \"%s\"", Scr.screen, Scr.display_string ); display_progress( True, " screen[%d].display_string = \"%s\"", Scr.screen, Scr.display_string ); } } } /* make sure we're on the right desk, and the _WIN_DESK property is set */ Scr.CurrentDesk = INVALID_DESK ; if( get_flags( Scr.wmprops->set_props, WMC_ASDesks ) ) { start_desk = Scr.wmprops->as_current_desk ; }else if( get_flags( Scr.wmprops->set_props, WMC_DesktopCurrent ) ) { int curr = Scr.wmprops->desktop_current ; start_desk = curr; if( get_flags( Scr.wmprops->set_props, WMC_DesktopViewport ) && curr < Scr.wmprops->desktop_viewports_num ) { /* we have to do that prior to capturing any window so that they'll get in * correct position and will not end up outside of the screen */ start_viewport_x = Scr.wmprops->desktop_viewport[curr<<1] ; start_viewport_y = Scr.wmprops->desktop_viewport[(curr<<1)+1] ; } } if( get_flags( Scr.wmprops->set_props, WMC_ASViewport ) ) { start_viewport_x = Scr.wmprops->as_current_vx ; start_viewport_y = Scr.wmprops->as_current_vy ; } /* temporarily setting up desktop 0 */ ChangeDesks(0); /* Load config ... */ /* read config file, set up menus, colors, fonts */ LoadASConfig (0, PARSE_EVERYTHING); /* Reparent all the windows and setup pan frames : */ XSync (dpy, 0); /***********************************************************/ #ifndef DONT_GRAB_SERVER /* grabbed !!!!!*/ grab_server(); /* grabbed !!!!!*/ #endif /* grabbed !!!!!*/ init_screen_panframes(ASDefaultScr); /* grabbed !!!!!*/ display_progress( True, "Capturing all windows ..." ); CaptureAllWindows (ASDefaultScr); /* grabbed !!!!!*/ display_progress( False, "Done." ); check_screen_panframes(ASDefaultScr); /* grabbed !!!!!*/ ASSync( False ); #ifndef DONT_GRAB_SERVER /* grabbed !!!!!*/ ungrab_server(); /* UnGrabbed !!!!!*/ #endif /* UnGrabbed !!!!!*/ /**********************************************************/ XDefineCursor (dpy, Scr.Root, Scr.Feel.cursors[ASCUR_Default]); display_progress( True, "Seting initial viewport to %+d%+d ...", Scr.wmprops->as_current_vx, Scr.wmprops->as_current_vy ); SetupFunctionHandlers(); display_progress( True, "Processing all pending events ..." ); ConfigureNotifyLoop(); display_progress( True, "All done." ); remove_desktop_cover(); if( !get_flags(AfterStepStartupFlags, ASSF_BypassAutoexec)) DoAutoexec(get_flags( AfterStepState, ASS_Restarting)); /* once all the windows are swallowed and placed in its proper desks - we cas restore proper desktop/viewport : */ clear_flags( AfterStepState, ASS_SuppressDeskBack ); ChangeDeskAndViewport ( start_desk, start_viewport_x, start_viewport_y, False); /* all system Go! we are completely Operational! */ set_flags( AfterStepState, ASS_NormalOperation); #if (defined(LOCAL_DEBUG)||defined(DEBUG)) && defined(DEBUG_ALLOCS) LOCAL_DEBUG_OUT( "printing memory%s",""); spool_unfreed_mem( "afterstep.allocs.startup", NULL ); #endif LOCAL_DEBUG_OUT( "entering main loop%s",""); HandleEvents (); return (0); }