//========================================================================== bool Finalise(IComponentContext& contextManager) override { projectManager_.getBase<ProjectManager>()->fini(); projectManager_ = nullptr; auto uiApplication = contextManager.queryInterface<IUIApplication>(); assert(uiApplication != nullptr); uiApplication->removeAction(*newProject_); uiApplication->removeAction(*openProject_); uiApplication->removeAction(*saveProject_); uiApplication->removeAction(*closeProject_); if (newProjectDialog_ != nullptr) { uiApplication->removeWindow(*newProjectDialog_); newProjectDialog_ = nullptr; } if (openProjectDialog_ != nullptr) { uiApplication->removeWindow(*openProjectDialog_); openProjectDialog_ = nullptr; } connections_.clear(); newProject_ = nullptr; openProject_ = nullptr; saveProject_ = nullptr; closeProject_ = nullptr; return true; }
void WindowManager::manageNextWindow() { if (!m_nextWindow) { return; } switch (m_nextAction) { case NextWindowAction::Replace: { popWindow(); pushWindow(m_nextWindow); break; } case NextWindowAction::ReplaceAll: { for (Window* win : m_windows) { removeWindow(win); } m_windows.clear(); pushWindow(m_nextWindow); break; } case NextWindowAction::None: default: LOG(ERROR) << "Invalid window action for next window" << std::endl; break; } m_nextWindow = nullptr; m_nextAction = NextWindowAction::None; }
void PointerDetectorFilter::invoke (KmsMediaInvocationReturn &_return, const std::string &command, const std::map< std::string, KmsMediaParam > ¶ms) throw (KmsMediaServerException) { if (g_KmsMediaPointerDetectorFilterType_constants.ADD_NEW_WINDOW.compare (command) == 0) { KmsMediaPointerDetectorWindow windowInfo; const KmsMediaParam *p; /* extract window params from param */ p = getParam (params, g_KmsMediaPointerDetectorFilterType_constants.ADD_NEW_WINDOW_PARAM_WINDOW); if (p != NULL) { unmarshalStruct (windowInfo, p->data); /* create window */ addWindow (windowInfo); } } else if (g_KmsMediaPointerDetectorFilterType_constants.REMOVE_WINDOW.compare (command) == 0) { std::string id; getStringParam (id, params, g_KmsMediaPointerDetectorFilterType_constants.REMOVE_WINDOW_PARAM_WINDOW_ID); removeWindow (id); } else if (g_KmsMediaPointerDetectorFilterType_constants.CLEAR_WINDOWS.compare (command) == 0) { clearWindows(); } }
void WindowManager::popWindow() { if (!m_windows.size()) { return; } removeWindow(m_windows.back()); m_windows.pop_back(); }
INT_PTR Mwin_MenuClicked(WPARAM wParam,LPARAM lParam) { BOOL addwnd = WindowList_Find(hMwinWindowList, (HANDLE)wParam) == NULL; if (addwnd) addWindow((HANDLE)wParam); else removeWindow((HANDLE)wParam); return 0; }
void GfxPorts::kernelDisposeWindow(uint16 windowId, bool reanimate) { Window *wnd = (Window *)getPortById(windowId); if (wnd) { if (!wnd->counterTillFree) { removeWindow(wnd, reanimate); } else { error("kDisposeWindow: used already disposed window id %d", windowId); } } else { error("kDisposeWindow: used unknown window id %d", windowId); } }
Pager::Pager(KWMModuleApplication *a, char *name) : QWidget(NULL, "kwmpager") { kwmmapp = a; a->setMainWidget(this); kwmmapp -> connectToKWM(); KWM::setSticky(winId(), true); KWM::setDecoration(winId(), KWM::tinyDecoration | KWM::noFocus); KWM::setWmCommand(winId(), name); KWM::setUnsavedDataHint(winId(), false); int count = KWM::numberOfDesktops(); desktop_font = new QFont(); Desktop *desk; desktops.resize(count); for (int i = 0; i < count; i++) { desk = new Desktop(a, i + 1, this); desktops[i] = desk; } activeDesktop = desktops.at(KWM::currentDesktop() - 1); activeDesktop->activate(true); connect(kwmmapp, SIGNAL(desktopChange(int)) , SLOT(changeDesktop(int))); connect(kwmmapp, SIGNAL(init()), SLOT(initDesktops())); connect(kwmmapp, SIGNAL( desktopNumberChange(int)), SLOT(changeNumber(int))); connect(kwmmapp, SIGNAL( windowAdd(Window)), SLOT(addWindow(Window))); connect(kwmmapp, SIGNAL( windowRemove(Window)), SLOT(removeWindow(Window))); connect(kwmmapp, SIGNAL( windowChange(Window)), SLOT(windowChange(Window))); connect(kwmmapp, SIGNAL( windowRaise(Window)), SLOT(raiseWindow(Window))); connect(kwmmapp, SIGNAL( windowLower(Window)), SLOT(lowerWindow(Window))); connect(kwmmapp, SIGNAL( windowActivate(Window)), SLOT(windowActivate(Window))); connect(kwmmapp, SIGNAL( commandReceived(QString)), SLOT(receiveCommand(QString))); moved = false; readSettings(); initDesktops(); show(); placeIt(); }
void ComboBox::showPopup() { setPressed(true); if(_win) removeWindow(); else { gsize_t pad = Application::getInstance()->getDefaultTheme()->getTextPadding(); gsize_t height = _items.size() * (getGraphics()->getFont().getSize().height + pad * 2); const Window *w = getWindow(); Pos pos(w->getPos().x + getWindowPos().x, w->getPos().y + getWindowPos().y + getSize().height); _win = make_control<ItemWindow>(this,pos,Size(getSize().width,height)); _win->show(); Application::getInstance()->addWindow(_win); } }
void IndiWidgetGroup::changeWindowCount(QAction* action) // Slot { int count = action->data().toInt(); if(count > 0) { for(int i = 0; i < count; ++i) addWindow(); } else { for(int i = 0; i > count; --i) { if(1 == mSplitter->count()) break; // Don't remove the last IndicatorWindow removeWindow(); } } }
// when a contact is deleted, make sure some other contact take over the default station // wParam = deleted contact int ContactDeleted(WPARAM wParam, LPARAM lParam) { if (!IsMyContact(wParam)) return 0; removeWindow(wParam); // exit this function if it is not default station DBVARIANT dbv; if (!db_get_ts(wParam, WEATHERPROTONAME, "ID", &dbv)) { if ( _tcscmp(dbv.ptszVal, opt.Default)) { db_free(&dbv); return 0; } db_free(&dbv); } // now the default station is deleted, try to get a new one // start looking for other weather stations for (MCONTACT hContact = db_find_first(WEATHERPROTONAME); hContact; hContact = db_find_next(hContact, WEATHERPROTONAME)) { if ( !db_get_ts(hContact, WEATHERPROTONAME, "ID", &dbv)) { // if the station is not a default station, set it as the new default station // this is the first weather station encountered from the search if ( _tcscmp(opt.Default, dbv.ptszVal)) { _tcscpy(opt.Default, dbv.ptszVal); opt.DefStn = hContact; db_free(&dbv); if ( !db_get_ts(hContact, WEATHERPROTONAME, "Nick", &dbv)) { TCHAR str[255]; mir_sntprintf(str, SIZEOF(str), TranslateT("%s is now the default weather station"), dbv.ptszVal); db_free(&dbv); MessageBox(NULL, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION); } db_set_ts(NULL, WEATHERPROTONAME, "Default", opt.Default); return 0; // exit this function quickly } db_free(&dbv); } } // got here if no more weather station left opt.Default[0] = 0; // no default station opt.DefStn = NULL; db_set_ts(NULL, WEATHERPROTONAME, "Default", opt.Default); return 0; }
/** * create new window, run thread & return pointer to its structure or NULL * asynchroneous call from outside * wait for window creating & return its data * @param title - header (copyed inside this function) * @param w,h - image size * @param rawdata - NULL (then the memory will be allocated here with size w x h) * or allocated outside data */ windowData *createGLwin(char *title, int w, int h, rawimage *rawdata){ FNAME(); if(!initialized) return NULL; windowData *win = MALLOC(windowData, 1); if(!addWindow(win)){ FREE(win); return NULL; } rawimage *raw; if(rawdata){ raw = rawdata; }else{ raw = MALLOC(rawimage, 1); if(raw){ raw->rawdata = MALLOC(GLubyte, w*h*3); raw->w = w; raw->h = h; raw->changed = 1; // raw->protected is zero automatically } } if(!raw || !raw->rawdata){ free(raw); return NULL; } win->title = strdup(title); win->image = raw; if(pthread_mutex_init(&win->mutex, NULL)){ WARN(_("Can't init mutex!")); removeWindow(win->ID); return NULL; } win->w = w; win->h = h; while(wannacreate); // wait if there was another creating pthread_mutex_lock(&winini_mutex); wininiptr = win; wannacreate = 1; pthread_mutex_unlock(&winini_mutex); DBG("wait for creatin"); while(wannacreate); // wait until window created from main thread DBG("window created"); return win; }
// Closes the OpenGL window. bool Window::close() { // if not open, then don't bother. if ( !mWindowIsOpen ) { return false; } // Remove window from window list removeWindow(mWinHandle); mDirect3D->Release(); mRenderDevice->Release(); mWindowIsOpen = false; // destroy the win32 window return(1 == DestroyWindow(mWinHandle)); }
void IndiWidgetGroup::loadSetup(const QString& setup) { if(setup.isEmpty() or setup == mSetName) return; saveSetup(); mSetName = setup; int rowCount; SettingsFile sfile(mFullIndiSetsPath + mSetName); rowCount = sfile.getIT("IndicatorCount", 1); for(int i = 0; (i < mSplitter->count()) and (i < rowCount); ++i) { static_cast<IndicatorWidget*>(mSplitter->widget(i))->loadSetup(mSetName, i); } while(mSplitter->count() < rowCount) addWindow(); while(mSplitter->count() > rowCount) removeWindow(); mSplitter->restoreState(sfile.getBA("GroupSplitter")); }
int killwindow(int GL_ID){ DBG("try to kill win GL_ID=%d", GL_ID); windowData *win; win = searchWindow_byGLID(GL_ID); if(!win) return 0; glutSetWindow(GL_ID); // obviously set window (for closing from menu) if(!win->killthread){ pthread_mutex_lock(&win->mutex); // say changed thread to die win->killthread = 1; pthread_mutex_unlock(&win->mutex); DBG("wait for changed thread"); pthread_join(win->thread, NULL); // wait while thread dies } if(win->menu) glutDestroyMenu(win->menu); glutDestroyWindow(win->GL_ID); win->GL_ID = 0; // reset for forEachWindow() DBG("destroy texture %d", win->Tex); glDeleteTextures(1, &(win->Tex)); glFinish(); if(!removeWindow(win->ID)) WARNX(_("Error removing from list")); totWindows--; return 1; }
void openProject() { connections_.clear(); auto uiFramework = contextManager_->queryInterface<IUIFramework>(); auto uiApplication = contextManager_->queryInterface<IUIApplication>(); if (openProjectDialog_ != nullptr) { uiApplication->removeWindow(*openProjectDialog_); openProjectDialog_ = nullptr; } auto viewCreator = get<IViewCreator>(); if (viewCreator) { viewCreator->createWindow( "TestingProjectControl/OpenProjectDialog.qml", projectManager_, [this](std::unique_ptr<IWindow>& window) { openProjectDialog_ = std::move(window); if (openProjectDialog_ != nullptr) { connections_ += openProjectDialog_->signalClose.connect(std::bind(&EnvrionmentTestPlugin::onOpenDlgClose, this)); } }); } }
void eventLoop (void) { XEvent event; struct pollfd ufd; int timeDiff; struct timeval tv; Region tmpRegion; CompDisplay *display = compDisplays; CompScreen *s = display->screens; int timeToNextRedraw = 0; CompWindow *move = 0; int px = 0, py = 0; CompTimeout *t; tmpRegion = XCreateRegion (); if (!tmpRegion) { fprintf (stderr, "%s: Couldn't create region\n", programName); return; } ufd.fd = ConnectionNumber (display->display); ufd.events = POLLIN; for (;;) { if (display->dirtyPluginList) updatePlugins (display); if (restartSignal) { execvp (programName, programArgv); exit (1); } while (XPending (display->display)) { XNextEvent (display->display, &event); /* translate root window */ if (testMode) { Window root, child; switch (event.type) { case ButtonPress: if (!move) { px = event.xbutton.x; py = event.xbutton.y; move = findWindowAt (display, event.xbutton.window, px, py); if (move) { XRaiseWindow (display->display, move->id); continue; } } case ButtonRelease: move = 0; root = translateToRootWindow (display, event.xbutton.window); XTranslateCoordinates (display->display, event.xbutton.root, root, event.xbutton.x_root, event.xbutton.y_root, &event.xbutton.x_root, &event.xbutton.y_root, &child); event.xbutton.root = root; break; case KeyPress: case KeyRelease: root = translateToRootWindow (display, event.xkey.window); XTranslateCoordinates (display->display, event.xkey.root, root, event.xkey.x_root, event.xkey.y_root, &event.xkey.x_root, &event.xkey.y_root, &child); event.xkey.root = root; break; case MotionNotify: if (move) { XMoveWindow (display->display, move->id, move->attrib.x + event.xbutton.x - px, move->attrib.y + event.xbutton.y - py); px = event.xbutton.x; py = event.xbutton.y; continue; } root = translateToRootWindow (display, event.xmotion.window); XTranslateCoordinates (display->display, event.xmotion.root, root, event.xmotion.x_root, event.xmotion.y_root, &event.xmotion.x_root, &event.xmotion.y_root, &child); event.xmotion.root = root; default: break; } } /* add virtual modifiers */ switch (event.type) { case ButtonPress: event.xbutton.state |= CompPressMask; event.xbutton.state = realToVirtualModMask (display, event.xbutton.state); break; case ButtonRelease: event.xbutton.state |= CompReleaseMask; event.xbutton.state = realToVirtualModMask (display, event.xbutton.state); break; case KeyPress: event.xkey.state |= CompPressMask; event.xkey.state = realToVirtualModMask (display, event.xkey.state); break; case KeyRelease: event.xkey.state |= CompReleaseMask; event.xkey.state = realToVirtualModMask (display, event.xkey.state); break; case MotionNotify: event.xmotion.state = realToVirtualModMask (display, event.xmotion.state); break; default: break; } (*display->handleEvent) (display, &event); } if (s->allDamaged || REGION_NOT_EMPTY (s->damage)) { if (timeToNextRedraw == 0) { /* wait for X drawing requests to finish glXWaitX (); */ gettimeofday (&tv, 0); timeDiff = TIMEVALDIFF (&tv, &s->lastRedraw); (*s->preparePaintScreen) (s, timeDiff); if (s->allDamaged) { EMPTY_REGION (s->damage); s->allDamaged = 0; (*s->paintScreen) (s, &defaultScreenPaintAttrib, &defaultWindowPaintAttrib, &s->region, PAINT_SCREEN_REGION_MASK | PAINT_SCREEN_FULL_MASK); glXSwapBuffers (s->display->display, s->root); } else { XIntersectRegion (s->damage, &s->region, tmpRegion); EMPTY_REGION (s->damage); if ((*s->paintScreen) (s, &defaultScreenPaintAttrib, &defaultWindowPaintAttrib, tmpRegion, PAINT_SCREEN_REGION_MASK)) { BoxPtr pBox; int nBox, y; glEnable (GL_SCISSOR_TEST); glDrawBuffer (GL_FRONT); pBox = tmpRegion->rects; nBox = tmpRegion->numRects; while (nBox--) { y = s->height - pBox->y2; glBitmap (0, 0, 0, 0, pBox->x1 - s->rasterX, y - s->rasterY, NULL); s->rasterX = pBox->x1; s->rasterY = y; glScissor (pBox->x1, y, pBox->x2 - pBox->x1, pBox->y2 - pBox->y1); glCopyPixels (pBox->x1, y, pBox->x2 - pBox->x1, pBox->y2 - pBox->y1, GL_COLOR); pBox++; } glDrawBuffer (GL_BACK); glDisable (GL_SCISSOR_TEST); glFlush (); } else { (*s->paintScreen) (s, &defaultScreenPaintAttrib, &defaultWindowPaintAttrib, &s->region, PAINT_SCREEN_FULL_MASK); glXSwapBuffers (s->display->display, s->root); } } s->lastRedraw = tv; (*s->donePaintScreen) (s); /* remove destroyed windows */ while (s->pendingDestroys) { CompWindow *w; for (w = s->windows; w; w = w->next) { if (w->destroyed) { addWindowDamage (w); removeWindow (w); break; } } s->pendingDestroys--; } } timeToNextRedraw = getTimeToNextRedraw (s, &s->lastRedraw); if (timeToNextRedraw) timeToNextRedraw = poll (&ufd, 1, timeToNextRedraw); } else { if (timeouts) { if (timeouts->left > 0) poll (&ufd, 1, timeouts->left); gettimeofday (&tv, 0); timeDiff = TIMEVALDIFF (&tv, &lastTimeout); for (t = timeouts; t; t = t->next) t->left -= timeDiff; while (timeouts && timeouts->left <= 0) { t = timeouts; if ((*t->callBack) (t->closure)) { timeouts = t->next; addTimeout (t); } else { timeouts = t->next; free (t); } } s->lastRedraw = lastTimeout = tv; } else { poll (&ufd, 1, 1000); gettimeofday (&s->lastRedraw, 0); } /* just redraw immediately */ timeToNextRedraw = 0; } } }
///////////////////////////////////////////////////////////////////////////// //#include <pmessage.hpp> SIGNED MyMainFrame::Message(const PegMessage &msg) { bool ok; switch(msg.wType) { //case PM_ADD: // addWindow( (PegWindow*)msg.pSource ); // break; case PM_DRAW: Invalidate(); Draw(); break; case HM_SYS_KEYBOARD: toggleKeypad(); break; //case HM_SYS_RESUME: // break; case HM_SYS_ZOOM: if(m_allowResizeKey) setFullScreenApp(!m_fullScreen); break; case HM_SYS_CLEAR: if(m_activeWin && m_activeWin->onClearKeyPressed()) removeWindow(m_activeWin); break; case PM_FIRST_START: if(m_activeWin) Presentation()->MoveFocusTree(m_activeWin); break; case SIGNAL(DEF_MENU_QUIT, PSF_CLICKED): programQuit(); break; case MYMF_SEND_SIGNAL: ((MyWindow*)msg.pSource)->onSignal(msg.iData); break; default: ok = false; if(m_activeWin) m_otherWin.Insert(m_activeWin); ent ptr2; CPListIterator it2(&m_otherWin); for(ptr2 = it2.Head(); ptr2!=NULL; ptr2 = it2.Next()) { ent ptr; CPListIterator it( ((MyWindow*)ptr2)->handledSignalsList() ); for(ptr = it.Head(); ptr!=NULL; ptr = it.Next()) { if( msg.wType == *((WORD*)ptr) ) { prepareSignal((MyWindow*)ptr2, msg.wType); ok=true; break; } } } m_otherWin.Remove(m_activeWin); if(!ok) return PegWindow::Message(msg); } return 0; }
ListProyectosView::~ListProyectosView() { BL_FUNC_DEBUG removeWindow(); }