/////////////////////////////////////////////////////////////////////////////// /// @fn FB::variant VideoPinsAPI::UnHookWindow(const int windowId) /// /// @brief Echos whatever is passed from Javascript. /// Go ahead and change it. See what happens! /////////////////////////////////////////////////////////////////////////////// int VideoPinsAPI::UnHookWindow(const int windowId) { Window activate = windowId; Display *disp = XOpenDisplay(NIL); char opt[] = "remove,above"; int ret = window_state(disp, activate, opt); XCloseDisplay(disp); return ret; }
/////////////////////////////////////////////////////////////////////////////// /// @fn FB::variant VideoPinsAPI::HookWindow(const int windowId, const int x, const int y, const int width, const int height) /// /// @brief Echos whatever is passed from Javascript. /// Go ahead and change it. See what happens! /////////////////////////////////////////////////////////////////////////////// FB::variant VideoPinsAPI::HookWindow(const int windowId, const int x, const int y, const int width, const int height) { Window activate = windowId; Display *disp = XOpenDisplay(NIL); char opt[] = "add,above"; window_state(disp, activate, opt); XResizeWindow(disp, activate, width, height); XMoveWindow(disp, activate, x, y); XCloseDisplay(disp); return activate; }
int action_window( Display * disp, Window win, char mode ) { /*{{{ */ p_verbose( "Using window: 0x%.8lx\n", win ); switch ( mode ) { case 'a': return activate_window( disp, win, TRUE ); case 'c': return close_window( disp, win ); case 'e': /* resize/move the window around the desktop => -r -e */ return window_move_resize( disp, win, options.param ); case 'b': /* change state of a window => -r -b */ return window_state( disp, win, options.param ); case 't': /* move the window to the specified desktop => -r -t */ return window_to_desktop( disp, win, atoi( options.param ) ); case 'R': /* move the window to the current desktop and activate it => -r */ if ( window_to_desktop( disp, win, -1 ) == EXIT_SUCCESS ) { usleep( 100000 ); /* 100 ms - make sure the WM has enough time to move the window, before we activate it */ return activate_window( disp, win, FALSE ); } else { return EXIT_FAILURE; } case 'N': case 'I': case 'T': window_set_title( disp, win, options.param, mode ); return EXIT_SUCCESS; default: fprintf( stderr, "Unknown action: '%c'\n", mode ); return EXIT_FAILURE; } }