static 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 '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; } default: fprintf(stderr, "Unknown action: '%c'\n", mode); return EXIT_FAILURE; } }/*}}}*/
int QTodoMisc::windowToCurrentDisplay(const Window& win) { Display *disp; if (! (disp = XOpenDisplay(NULL))) { qDebug("Cannot open display.\n"); return EXIT_FAILURE; } int ret; /* 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 */ ret = activate_window(disp, win, false); } else { ret = EXIT_FAILURE; } XCloseDisplay(disp); return ret; }
void raise_wrapped(GtkWidget* display_win_gtk, gchar* term_win_str) { Display* Xdisplay; Window display_win, term_win; Xdisplay = GDK_DRAWABLE_XDISPLAY(display_win_gtk->window); display_win = GDK_WINDOW_XID(display_win_gtk->window); term_win = str_to_win(term_win_str); if (display_win == 0 || term_win == 0) return; gint term_desktop = get_desktop(Xdisplay, term_win); gint disp_desktop = get_desktop(Xdisplay, display_win); if (term_desktop != -1 && disp_desktop != -1 && term_desktop != disp_desktop) { window_to_desktop(Xdisplay, display_win, term_desktop); } static int i = 0; i++; g_warning("raise %d", i); /*raise_window(Xdisplay, display_win, term_win, TRUE);*/ //XMapRaised(Xdisplay, display_win); XRaiseWindow(Xdisplay, display_win); }