/** * @constructor * @param day [int] the day * @param month [const char*] the month (no abbreviation allowed) * @param year [int] the year (supply all four digits) * @param hours [int] default is 0 * @param minutes [int] default is 0 * @param seconds [int] default is 1 * @throws XTime * * Sets secs and fills ts based on day, month, year, hours, minutes, * and seconds provided. Throws XTime exception if parameters * supplied do not represent a valid date/time. */ NxsDate::NxsDate( int day, const char* month, int year , int hours /* = 0 */, int minutes /* = 0 */ , int seconds /* = 1 */ ) { assert( month != NULL ); char mstr[10]; int n = strlen(month); for( int i = 0; i < n; i++ ) mstr[i] = toupper( month[i] ); mstr[n] = '\0'; ts.tm_mday = day; if( strcmp( month, "JANUARY" ) == 0 ) ts.tm_mon = 0; else if( strcmp( month, "FEBRUARY" ) == 0 ) ts.tm_mon = 1; else if( strcmp( month, "MARCH" ) == 0 ) ts.tm_mon = 2; else if( strcmp( month, "APRIL" ) == 0 ) ts.tm_mon = 3; else if( strcmp( month, "MAY" ) == 0 ) ts.tm_mon = 4; else if( strcmp( month, "JUNE" ) == 0 ) ts.tm_mon = 5; else if( strcmp( month, "JULY" ) == 0 ) ts.tm_mon = 6; else if( strcmp( month, "AUGUST" ) == 0 ) ts.tm_mon = 7; else if( strcmp( month, "SEPTEMBER" ) == 0 ) ts.tm_mon = 8; else if( strcmp( month, "OCTOBER" ) == 0 ) ts.tm_mon = 9; else if( strcmp( month, "NOVEMBER" ) == 0 ) ts.tm_mon = 10; else if( strcmp( month, "DECEMBER" ) == 0 ) ts.tm_mon = 11; else ts.tm_mon = -1; ts.tm_year = year - 1900; ts.tm_hour = hours; ts.tm_min = minutes; ts.tm_sec = seconds; ts.tm_wday = -1; ts.tm_yday = -1; ts.tm_isdst = -1; // ensure that the date is correct (and compute tm_wday and tm_yday) secs = mktime(&ts); if( secs == -1 ) throw XTime(); }
void Blackbox::shutdown(void) { bt::Application::shutdown(); XGrabServer(); XSetInputFocus(XDisplay(), PointerRoot, RevertToPointerRoot, XTime()); std::for_each(screen_list, screen_list + screen_list_count, std::mem_fun(&BScreen::shutdown)); XSync(XDisplay(), false); XUngrabServer(); }
void Blackbox::setFocusedWindow(BlackboxWindow *win) { if (focused_window && focused_window == win) // nothing to do return; if (win && !win->isIconic()) { // the active screen is the one with the newly focused window... active_screen = win->screen(); focused_window = win; } else { // nothing has focus focused_window = 0; assert(active_screen != 0); XSetInputFocus(XDisplay(), active_screen->noFocusWindow(), RevertToPointerRoot, XTime()); } updateActiveWindow(); }