示例#1
0
    //////////////////////////////////////////////////////////////////////////
    ////                Win32 Event Listeners
    //////////////////////////////////////////////////////////////////////////
    LRESULT ViWmManager::HandleShellHook( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
    {
        if (msg != shellhookid)
            return DefWindowProc(hwnd, msg, wParam, lParam); 

        TilledWindow    *found;

        switch (wParam)
        {
        case HSHELL_WINDOWCREATED:
            if (TilledWindow::IsHandleTileable((HWND)lParam))
            {
                AddNode((HWND)lParam);
                ArrangeWindows();
                FocusCurrent();
                selectWindow( (HWND)lParam );
                _ASSERTE( _CrtCheckMemory() == TRUE );
            }
            break;

        case HSHELL_WINDOWDESTROYED:
            found = currentState.FindNode((HWND)lParam);
            if ( found )
            {
                for (size_t i = 0; i < currentLayout.size(); ++i)
                    LayoutTree::removeClean( currentLayout[i].layoutRoot, (HWND) lParam );

                currentState.RemoveNode((HWND)lParam, false);

                ArrangeWindows();
                FocusCurrent();
                _ASSERTE( _CrtCheckMemory() == TRUE );
            }
            break;

        case HSHELL_RUDEAPPACTIVATED:
        case HSHELL_WINDOWACTIVATED:
            if (globalManager->inDrag()) break;

            found = currentState.FindNode((HWND)lParam);
            if (found) {
                if (currentState.current) {
                    currentState.current->SetTransparency( globalManager->conf.idleTransparency() );
                }
                currentState.current = found;
                found->SetTransparency( 255 );
                selectWindow( (HWND)lParam );

                FocusCurrent();
            }
            _ASSERTE( _CrtCheckMemory() == TRUE );
            break;
        }
        return 0;
    }
示例#2
0
void CadGraphicsView::setNoMode()
{
    // sets the mode to NoMode for scene
    scene->setMode(CadGraphicsScene::NoMode);
    viewport()->setCursor(Qt::ArrowCursor);
    connect(scene, SIGNAL(setSelectionSignal()), this, SLOT(selectWindow()));
    isPanning = false;
}
示例#3
0
/**
 *
 * @param argc
 * @param argv
 * @return
 */
int
main(int argc, char *argv[]) {
    // result
    int ret = -1;

    // supress invalid option -- 'xyz' output
    int opterr = 0;

    Rect rect;
    rect.x = -1;
    rect.y = -1;
    rect.w = -1;
    rect.h = -1;

    // parse options
    int c = getopt(argc, argv, "dwm");
    switch (c) {
        case 'd': //
        case 'w': //
        case 'm': // desktop
        {
            // common stuff >>
            // get display + root window
            Display *disp = XOpenDisplay(NULL);
            if (disp != NULL) {
                Window root = XDefaultRootWindow(disp);
                switch (c) {
                    case 'd': // desktop
                        ret = getWindowGeometry(disp, &root, &rect);
                        break;
                    case 'w': // window
                        ret = selectWindow(disp, &root, &rect);
                        break;
                    case 'm': // mouse
                        ret = selectArea(disp, &root, &rect);
                        break;
                }

                // common stuff >>
                // close display
                XCloseDisplay(disp);
                // common stuff <<
            }
        }
            break;
    }

    if(rect.w % 2 != 0)
        rect.w++;
    if(rect.h % 2 != 0)
        rect.h++;
    //
    printf("%d %d %d %d %d\n", ret, rect.w, rect.h, rect.x, rect.y);
    return ret;
}
示例#4
0
 //_________________________________________________________
 void DetectDialog::detect(  WId window )
 {
     if( window == 0 ) selectWindow();
     else readWindow( window );
 }