int main () { Display *display; Window main, grouptran, child, group; XEvent report; XWMHints *wmhints; display = XOpenDisplay(NULL); if (display == NULL) { fprintf(stderr, "couldn't connect to X server :0\n"); return 0; } group = XCreateWindow(display, RootWindow(display, 0), 0,0,1,1, 10, CopyFromParent, CopyFromParent, CopyFromParent, 0, 0); main = XCreateWindow(display, RootWindow(display, 0), 0,0,100,100, 10, CopyFromParent, CopyFromParent, CopyFromParent, 0, 0); grouptran = XCreateWindow(display, RootWindow(display, 0), 10,10,80,180, 10, CopyFromParent, CopyFromParent, CopyFromParent, 0, 0); child = XCreateWindow(display, RootWindow(display, 0), 20,20,60,60, 10, CopyFromParent, CopyFromParent, CopyFromParent, 0, 0); XSetWindowBackground(display,main,WhitePixel(display,0)); XSetWindowBackground(display,grouptran,BlackPixel(display,0)); XSetWindowBackground(display,child,WhitePixel(display,0)); XSetTransientForHint(display, grouptran, RootWindow(display,0)); XSetTransientForHint(display, child, grouptran); wmhints = XAllocWMHints(); wmhints->flags = WindowGroupHint; wmhints->window_group = group; XSetWMHints(display, main, wmhints); XSetWMHints(display, grouptran, wmhints); XSetWMHints(display, child, wmhints); XFree(wmhints); XMapWindow(display, main); XMapWindow(display, grouptran); XMapWindow(display, child); XFlush(display); while (1) { XNextEvent(display, &report); } return 1; }
int toolwin_win_create(ToolWin *tw) { tw->win = XCreateSimpleWindow(dpy, root, 20, 20, tw->w, tw->h, 0, 0, 0); tw->buf = XCreatePixmap(dpy, root, tw->w, tw->h, DefaultDepth(dpy,scr)); cairo_surface_t *t = cairo_xlib_surface_create(dpy, tw->buf, DefaultVisual(dpy,scr), tw->w, tw->h); tw->ctx = cairo_create(t); cairo_surface_destroy(t); cairo_set_font_face(tw->ctx,conf.font); cairo_set_font_size(tw->ctx,conf.font_size); XSelectInput(dpy, tw->win, EVENT_MASK); XSetTransientForHint(dpy, tw->win, win); XSetWMProtocols(dpy, tw->win, &WM_DELETE_WINDOW, 1); XSizeHints *hints = XAllocSizeHints(); hints->min_width = hints->max_width = tw->w; hints->min_height = hints->max_height = tw->h; hints->flags = PMinSize | PMaxSize; XSetWMNormalHints(dpy, tw->win, hints); XFree(hints); XStoreName(dpy, tw->win, tw->name); if (tw->backing) tw->backing(tw); else toolwin_backing(tw); XSetWindowBackgroundPixmap(dpy, tw->win, tw->buf); XFlush(dpy); return 0; }
int main(void) { Display *d; Window r, f, t = None; XSizeHints h; XEvent e; d = XOpenDisplay(NULL); if (!d) exit(1); r = DefaultRootWindow(d); f = XCreateSimpleWindow(d, r, 100, 100, 400, 400, 0, 0, 0); h.min_width = h.max_width = h.min_height = h.max_height = 400; h.flags = PMinSize | PMaxSize; XSetWMNormalHints(d, f, &h); XStoreName(d, f, "floating"); XMapWindow(d, f); XSelectInput(d, f, ExposureMask); while (1) { XNextEvent(d, &e); if (t == None) { sleep(5); t = XCreateSimpleWindow(d, r, 50, 50, 100, 100, 0, 0, 0); XSetTransientForHint(d, t, f); XStoreName(d, t, "transient"); XMapWindow(d, t); XSelectInput(d, t, ExposureMask); } } XCloseDisplay(d); exit(0); }
void QXlibWindow::setVisible(bool visible) { #ifdef MYX11_DEBUG qDebug() << "QTestLiteWindow::setVisible" << visible << hex << x_window; #endif if (isTransient(widget())) { Window parentXWindow = x_window; if (widget()->parentWidget()) { QWidget *widgetParent = widget()->parentWidget()->window(); if (widgetParent && widgetParent->platformWindow()) { QXlibWindow *parentWidnow = static_cast<QXlibWindow *>(widgetParent->platformWindow()); parentXWindow = parentWidnow->x_window; } } XSetTransientForHint(mScreen->display()->nativeDisplay(),x_window,parentXWindow); } if (visible) { //ensure that the window is viewed in correct position. doSizeHints(); XMapWindow(mScreen->display()->nativeDisplay(), x_window); } else { XUnmapWindow(mScreen->display()->nativeDisplay(), x_window); } }
bool GtkToolkitColorChooser::Show(X11Types::Window parent, uint32_t initial_color) { GdkColor old_color = GtkUtils::ColorrefToGdkColor(initial_color); gtk_color_selection_set_current_color ( GTK_COLOR_SELECTION(m_color_selector), &old_color); // we have to show dialog before running it gtk_widget_show(m_dialog); // otherwise this will result in nasty crash inside gtk XSetTransientForHint(GDK_WINDOW_XDISPLAY(gtk_widget_get_window(m_dialog)), GDK_WINDOW_XID(gtk_widget_get_window(m_dialog)), parent); GtkUtils::SetResourceName(m_dialog, "colorselectordialog"); gint result = gtk_dialog_run(GTK_DIALOG(m_dialog)); GdkColor new_color; gtk_color_selection_get_current_color( GTK_COLOR_SELECTION(m_color_selector), &new_color); m_color = GtkUtils::GdkColorToColorref(&new_color); gtk_widget_destroy (m_dialog); GtkUtils::ProcessEvents(); return (GTK_RESPONSE_OK == result); }
void QmlApplicationViewer::setMainQmlFile(const QString &file) { Atom atomMInvokedBy = XInternAtom(QX11Info::display(), "_MEEGOTOUCH_WM_INVOKED_BY", False); Display *display = QX11Info::display(); XChangeProperty(display, d->view->winId(), atomMInvokedBy, XA_WINDOW, 32, PropModeReplace, (unsigned char *)&parentWindowId, 1); XSetTransientForHint(display, d->view->winId(), parentWindowId); Atom atomWindowType = XInternAtom(QX11Info::display(), "_MEEGOTOUCH_NET_WM_WINDOW_TYPE_MAPPLICATION", False); XChangeProperty(QX11Info::display(), d->view->winId(), XInternAtom(QX11Info::display(), "_NET_WM_WINDOW_TYPE", False), XA_ATOM, 32, PropModeAppend, (unsigned char*) &atomWindowType, 1); d->view->rootContext()->setContextProperty("actor", this); d->view->rootContext()->setContextProperty("unamenumeric", QVariant::fromValue(false)); d->view->rootContext()->setContextProperty("xservice", QString(XSERVICE)); d->view->rootContext()->setContextProperty("serverset", QVariant(false)); d->view->rootContext()->setContextProperty("encryptionset", QVariant(false)); d->view->rootContext()->setContextProperty("extratextvisible", QVariant(false)); d->mainQmlFile = d->adjustPath(file); d->view->setSource(QUrl::fromLocalFile(d->mainQmlFile)); QObject* themeObject = qvariant_cast<QObject*>(d->view->rootContext()->contextProperty("theme")); if ( themeObject ) themeObject->setProperty("inverted", true); QObject* screenObject = qvariant_cast<QObject*>(d->view->rootContext()->contextProperty("screen")); if ( screenObject ) screenObject->setProperty("allowedOrientations", 1); }
bool KMenuBar::eventFilter(QObject *obj, QEvent *ev) { if(d->topLevel) { if(parentWidget() && obj == parentWidget()->topLevelWidget()) { if(ev->type() == QEvent::Resize) return false; // ignore resizing of parent, QMenuBar would try to adjust size if(ev->type() == QEvent::Accel || ev->type() == QEvent::AccelAvailable) { if(QApplication::sendEvent(topLevelWidget(), ev)) return true; } if(ev->type() == QEvent::ShowFullScreen) // will update the state properly setTopLevelMenuInternal(d->topLevel); } if(parentWidget() && obj == parentWidget() && ev->type() == QEvent::Reparent) { #ifdef Q_WS_X11 XSetTransientForHint(qt_xdisplay(), winId(), parentWidget()->topLevelWidget()->winId()); #endif setShown(parentWidget()->isTopLevel() || parentWidget()->isVisible()); } if(parentWidget() && !parentWidget()->isTopLevel() && obj == parentWidget()) { // if the parent is not toplevel, KMenuBar needs to match its visibility status if(ev->type() == QEvent::Show) { #ifdef Q_WS_X11 XSetTransientForHint(qt_xdisplay(), winId(), parentWidget()->topLevelWidget()->winId()); #endif show(); } if(ev->type() == QEvent::Hide) hide(); } } else { if(parentWidget() && obj == parentWidget()->topLevelWidget()) { if(ev->type() == QEvent::WindowStateChange && !parentWidget()->topLevelWidget()->isFullScreen()) setTopLevelMenuInternal(d->wasTopLevel); } } return QMenuBar::eventFilter(obj, ev); }
/** * Specify that a window is transient for another top-level window and should be handled accordingly. * @param win the transient window * @param forwin the toplevel window */ EAPI void ecore_x_icccm_transient_for_set(Ecore_X_Window win, Ecore_X_Window forwin) { LOGFN(__FILE__, __LINE__, __FUNCTION__); XSetTransientForHint(_ecore_x_disp, win, forwin); if (_ecore_xlib_sync) ecore_x_sync(); }
bool window::create() { if(hwnd) return true; int width = xlib::width(place); int height = xlib::height(place); hwnd = XCreateSimpleWindow ( env, RootWindow((Display*)env,0), left(place), top(place), width, height, 0, WhitePixel((Display*)env,0), WhitePixel((Display*)env,0)); if(atomDelete != None) atomDelete = XInternAtom ( env, "WM_DELETE_WINDOW", false ); if ( !is_root() ) { // keeps this window in front of its parent at all times XSetTransientForHint ( env, hwnd, hwnd_parent ); // make sure the app doesn't get killed when this // window gets destroyed XSetWMProtocols ( env, hwnd, &atomDelete, 1 ); } if ( hwnd == 0 ) return false; gc = XCreateGC(env, hwnd, 0, 0); //rbuf_data = new unsigned char[ width * height * (env.bpp / 8)]; //rbuf.attach(rbuf_data, width, height, width * (env.bpp / 8) ); /* buffer = new image(width, height); ximg = XCreateImage(env, env.visual, env.depth, ZPixmap, 0, (char*)buffer->pmap.buf(), width, height, env.sys_bpp, width * (env.sys_bpp / 8)); ximg->byte_order = env.byte_order; */ set_background ( back_color ); created(); return true; }
void KMenuBar::setTopLevelMenuInternal(bool top_level) { if(d->forcedTopLevel) top_level = true; d->wasTopLevel = top_level; if(parentWidget() && parentWidget()->topLevelWidget()->isFullScreen()) top_level = false; if(isTopLevelMenu() == top_level) return; d->topLevel = top_level; if(isTopLevelMenu()) { #ifdef Q_WS_X11 d->selection = new KSelectionWatcher(KMenuBarPrivate::makeSelectionAtom(), DefaultScreen(qt_xdisplay())); connect(d->selection, SIGNAL(newOwner(Window)), this, SLOT(updateFallbackSize())); connect(d->selection, SIGNAL(lostOwner()), this, SLOT(updateFallbackSize())); #endif d->frameStyle = frameStyle(); d->lineWidth = lineWidth(); d->margin = margin(); d->fallback_mode = false; bool wasShown = !isHidden(); reparent(parentWidget(), WType_TopLevel | WStyle_Tool | WStyle_Customize | WStyle_NoBorder, QPoint(0, 0), false); #ifdef Q_WS_X11 KWin::setType(winId(), NET::TopMenu); if(parentWidget()) XSetTransientForHint(qt_xdisplay(), winId(), parentWidget()->topLevelWidget()->winId()); #endif QMenuBar::setFrameStyle(NoFrame); QMenuBar::setLineWidth(0); QMenuBar::setMargin(0); updateFallbackSize(); d->min_size = QSize(0, 0); if(parentWidget() && !parentWidget()->isTopLevel()) setShown(parentWidget()->isVisible()); else if(wasShown) show(); } else { #ifdef Q_WS_X11 delete d->selection; d->selection = NULL; #endif setBackgroundMode(PaletteButton); setFrameStyle(d->frameStyle); setLineWidth(d->lineWidth); setMargin(d->margin); setMinimumSize(0, 0); setMaximumSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); updateMenuBarSize(); if(parentWidget()) reparent(parentWidget(), QPoint(0, 0), !isHidden()); } }
void InitMessageWindowProperty (MessageWindow *messageWindow) { FcitxLightUI* lightui = messageWindow->owner; Display *dpy = lightui->dpy; XSetTransientForHint (dpy, messageWindow->window, DefaultRootWindow (dpy)); LightUISetWindowProperty(lightui, messageWindow->window, FCITX_WINDOW_DIALOG, "Fcitx - Message"); XSetWMProtocols(dpy, messageWindow->window, &lightui->killAtom, 1); }
void open_windows() { int i; int scrap; XSetWindowAttributes attributes; XSizeHints *hints = XAllocSizeHints(); attributes.backing_store = WhenMapped; attributes.cursor = XCreateFontCursor(display, XC_X_cursor); main_window = XCreateWindow(display, DefaultRootWindow(display), w_x, w_y, w_width, w_height, 0, CopyFromParent, InputOutput, CopyFromParent, CWCursor | CWBackingStore, &attributes); hints->flags = PPosition | PSize | PMinSize | PMaxSize | PWinGravity; hints->x = w_x; hints->y = w_y; hints->width = w_width; hints->height = w_height; hints->min_width = hints->max_width = w_width; hints->min_height = hints->max_height = w_height; hints->win_gravity = CenterGravity; XSetWMNormalHints(display, main_window, hints); XStoreName(display, main_window, "SSH Authentication Passphrase Request"); /* This is a dialog box, I think. */ XSetTransientForHint(display, main_window, DefaultRootWindow(display)); XFree(hints); cancel_button = XCreateWindow(display, main_window, w_width - relief - margin - b_width, w_height - relief - margin - b_height, b_width, b_height, 0, CopyFromParent, InputOutput, CopyFromParent, CWCursor | CWBackingStore, &attributes); leds = (w_width - relief * 2 - margin * 2 + (led_width - led_i_width)) / led_width; scrap = (w_width - relief * 2 - margin * 2 + (led_width - led_i_width)) % led_width; leds_x = relief + margin + scrap/2; led_state = ssh_xmalloc(sizeof(int) * leds); for (i = 0; i < leds; i++) led_state[i] = 0; attributes.cursor = XCreateFontCursor(display, XC_top_left_arrow); XChangeWindowAttributes(display, cancel_button, CWCursor | CWBackingStore, &attributes); }
/*! \internal Wraps the Motif dialog by setting the X window for the QtMotifDialog to the X window id of the dialog shell. */ void QtMotifDialog::realize( Widget w ) { // use the winid of the dialog shell, reparent any children we have if ( XtWindow( w ) != winId() ) { XSync(QtMotif::display(), FALSE); XtSetMappedWhenManaged( d->shell, False ); // save the window title QString wtitle = windowTitle(); if (wtitle.isEmpty()) { char *t = 0; XtVaGetValues(w, XtNtitle, &t, NULL); wtitle = QString::fromLocal8Bit(t); } setWindowTitle(QString()); // make sure setWindowTitle() works below QString icontext = windowIconText(); if (icontext.isEmpty()) { char *iconName = 0; XtVaGetValues(w, XtNiconName, &iconName, NULL); icontext = QString::fromLocal8Bit(iconName); } setWindowIconText(QString()); // make sure setWindowTitle() works below Window newid = XtWindow(w); QObjectList list = children(); for (int i = 0; i < list.size(); ++i) { QWidget *widget = qobject_cast<QWidget*>(list.at(i)); if (!widget || widget->isWindow()) continue; XReparentWindow(widget->x11Info().display(), widget->winId(), newid, widget->x(), widget->y()); } QApplication::syncX(); create( newid, true, true ); // restore the window title and icon text if (!wtitle.isEmpty()) setWindowTitle(wtitle); if (!icontext.isEmpty()) setWindowIconText(icontext); // if this dialog was created without a QWidget parent, then the transient // for will be set to the root window, which is not acceptable. // instead, set it to the window id of the shell's parent if ( ! parent() && XtParent( d->shell ) ) XSetTransientForHint(x11Info().display(), newid, XtWindow(XtParent(d->shell))); } QtMotif::registerWidget( this ); }
static void force_quit_dialog_realize (GtkWidget *dialog, void *data) { WnckWindow *win = data; gdk_error_trap_push (); XSetTransientForHint (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), GDK_WINDOW_XID (gtk_widget_get_window (dialog)), wnck_window_get_xid (win)); gdk_display_sync (gdk_display_get_default ()); gdk_error_trap_pop_ignored (); }
int main () { Display *display; Window parent, child; XEvent report; Atom state, modal; int x=10,y=10,h=400,w=400; XEvent ce; display = XOpenDisplay(NULL); if (display == NULL) { fprintf(stderr, "couldn't connect to X server :0\n"); return 0; } state = XInternAtom(display, "_NET_WM_STATE", True); modal = XInternAtom(display, "_NET_WM_STATE_MODAL", True); parent = XCreateWindow(display, RootWindow(display, 0), x, y, w, h, 10, CopyFromParent, CopyFromParent, CopyFromParent, 0, 0); child = XCreateWindow(display, RootWindow(display, 0), x, y, w/2, h/2, 10, CopyFromParent, CopyFromParent, CopyFromParent, 0, 0); XSetWindowBackground(display,parent,WhitePixel(display,0)); XSetWindowBackground(display,child,BlackPixel(display,0)); XSetTransientForHint(display, child, parent); XMapWindow(display, parent); XMapWindow(display, child); XFlush(display); ce.xclient.type = ClientMessage; ce.xclient.message_type = state; ce.xclient.display = display; ce.xclient.window = child; ce.xclient.format = 32; ce.xclient.data.l[0] = 1; ce.xclient.data.l[1] = modal; ce.xclient.data.l[2] = 0; XSendEvent(display, RootWindow(display, DefaultScreen(display)), False, SubstructureNotifyMask | SubstructureRedirectMask, &ce); while (1) { XNextEvent(display, &report); } return 1; }
virtual void create() { if ( ! m_window ) { m_window = XCreateSimpleWindow ( m_display, RootWindow((void*)m_display,0), m_rect.origin().x(), m_rect.origin().y(), m_rect.width(), m_rect.height(), 0, WhitePixel((void*)m_display,0), WhitePixel((void*)m_display,0)); set_background ( m_background ); if ( m_is_child ) { // keeps this window in front of its parent at all times XSetTransientForHint ( m_display, id(), m_parent ); // make sure the app doesn't get killed when this // window gets destroyed m_atom[0] = XInternAtom ( m_display, "WM_DELETE_WINDOW", false ); XSetWMProtocols ( m_display, m_window, m_atom, 1 ); } if ( m_window == 0 ) { } on_create(); } m_event_dispatcher.register_window ( this ); }
void InitXlibMenu(XlibMenu* menu) { FcitxClassicUI* classicui = menu->owner; char strWindowName[] = "Fcitx Menu Window"; XSetWindowAttributes attrib; unsigned long attribmask; int depth; Colormap cmap; Visual * vs; Display* dpy = classicui->dpy; int iScreen = classicui->iScreen; vs = ClassicUIFindARGBVisual(classicui); ClassicUIInitWindowAttribute(classicui, &vs, &cmap, &attrib, &attribmask, &depth); //开始只创建一个简单的窗口不做任何动作 menu->menuWindow = XCreateWindow(dpy, RootWindow(dpy, iScreen), 0, 0, MENU_WINDOW_WIDTH, MENU_WINDOW_HEIGHT, 0, depth, InputOutput, vs, attribmask, &attrib); if (menu->menuWindow == (Window) NULL) return; XSetTransientForHint(dpy, menu->menuWindow, DefaultRootWindow(dpy)); menu->menu_x_cs = cairo_xlib_surface_create( dpy, menu->menuWindow, vs, MENU_WINDOW_WIDTH, MENU_WINDOW_HEIGHT); menu->menu_cs = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, MENU_WINDOW_WIDTH, MENU_WINDOW_HEIGHT); XSelectInput(dpy, menu->menuWindow, KeyPressMask | ExposureMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask | LeaveWindowMask | StructureNotifyMask); ClassicUISetWindowProperty(classicui, menu->menuWindow, FCITX_WINDOW_MENU, strWindowName); menu->iPosX = 100; menu->iPosY = 100; menu->width = cairo_image_surface_get_height(menu->menu_cs); }
void X11::windowConfigure(Display *disp, Window root, Window w, X11WindowType wtype) { XSetWindowAttributes attr; switch(wtype) { case X11_WINDOW_TYPE_NORMAL: /* Set focus on this window */ setActive(disp, root, w, True); break; case X11_WINDOW_TYPE_DESKTOP: break; case X11_WINDOW_TYPE_DOCK: attr.override_redirect = True; XChangeWindowAttributes(disp, w, CWOverrideRedirect, &attr); break; case X11_WINDOW_TYPE_TOOLBAR: break; case X11_WINDOW_TYPE_UTILITY: break; case X11_WINDOW_TYPE_SPLASH: break; case X11_WINDOW_TYPE_DIALOG: break; case X11_WINDOW_TYPE_MENU: case X11_WINDOW_TYPE_POPUP_MENU: skipTaskbarHint(disp, w, True); /* Transient window */ attr.override_redirect = True; XChangeWindowAttributes(disp, w, CWOverrideRedirect, &attr); XSetTransientForHint(disp, w, root); break; default: break; } }
void InitXlibMenu(XlibMenu* menu) { FcitxLightUI* lightui = menu->owner; char strWindowName[]="Fcitx Menu Window"; XSetWindowAttributes attrib; unsigned long attribmask; int depth; Colormap cmap; Visual * vs; XGCValues xgv; GC gc; Display* dpy = lightui->dpy; int iScreen = lightui->iScreen; vs= NULL; LightUIInitWindowAttribute(lightui, &vs, &cmap, &attrib, &attribmask, &depth); //开始只创建一个简单的窗口不做任何动作 menu->menuWindow =XCreateWindow (dpy, RootWindow (dpy, iScreen), 0, 0, MENU_WINDOW_WIDTH,MENU_WINDOW_HEIGHT, 0, depth, InputOutput, vs, attribmask, &attrib); if (menu->menuWindow == (Window) NULL) return; XSetTransientForHint (dpy, menu->menuWindow, DefaultRootWindow (dpy)); menu->pixmap = XCreatePixmap(dpy, menu->menuWindow, MENU_WINDOW_WIDTH, MENU_WINDOW_HEIGHT, depth); menu->xftDraw = XftDrawCreate(dpy, menu->pixmap, DefaultVisual (dpy, DefaultScreen (dpy)), DefaultColormap (dpy, DefaultScreen (dpy))); XSelectInput (dpy, menu->menuWindow, KeyPressMask | ExposureMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask | LeaveWindowMask | StructureNotifyMask ); LightUISetWindowProperty(lightui, menu->menuWindow, FCITX_WINDOW_MENU, strWindowName); menu->iPosX=100; menu->iPosY=100; }
/* * ------------------------------------------------------------------------ * Name: PdmShellPresent * * Description: * * Displays the application shell as a transient for the window * passed via the -window command line parameter. * * * Return value: * * True if successful. * */ static void PdmShellPresent(PdmShell* me) { int parent_abs_x, parent_abs_y; Position x, y; Dimension width, height; Window dummy_child; /* * get the absolute screen coordinates of the parent window */ XTranslateCoordinates(me->display, me->parent_window, me->parent_attr.root, 0, 0, &parent_abs_x, &parent_abs_y, &dummy_child); /* * get the dimensions of the PDM window */ XtRealizeWidget(me->widget); XtVaGetValues(me->widget, XmNwidth, &width, XmNheight, &height, NULL); /* * determine the origin of the PDM popup such that it is * centered w.r.t. the parent window */ x = parent_abs_x + me->parent_attr.width/2 - width/2; y = parent_abs_y + me->parent_attr.height/2 - height/2; /* * update the app shell position */ XtVaSetValues(me->widget, XmNx, x, XmNy, y, NULL); /* * present the PDM as transient for the passed video window * * Note: this only works if the passed video window is a * top-level window; i.e. one that the window manager * manages. */ XSetTransientForHint(me->display, XtWindow(me->widget), me->parent_window); /* * map the PDM popup */ XtMapWidget(me->widget); }
// Make the GTK dialog passed in (p_widget) transient for the toplevel or // default stack -- i.e. it will float above it. void make_front_widget ( GtkWidget *p_widget) { Window t_window = MCdefaultstackptr -> getwindow(); if (t_window == DNULL && MCtopstackptr != DNULL) t_window = MCtopstackptr -> getwindow(); gtk_widget_realize( GTK_WIDGET( p_widget )) ; if ( t_window != NULL) { GdkWindow * gdk_window = NULL ; gdk_window = GTK_WIDGET ( p_widget ) -> window ; if ( gdk_window != NULL ) XSetTransientForHint ( ((MCScreenDC*)MCscreen) -> getDisplay(), GDK_WINDOW_XWINDOW ( ( gdk_window ) ), t_window ) ; else gtk_window_set_keep_above ( GTK_WINDOW ( p_widget ) , True ) ; } }
Window create_simple_window(Display* display, int width, int height, int x, int y) {/*创建一个简单的窗口*/ /*获得屏幕号码*/ int screen_num = DefaultScreen(display); /*窗口边缘宽度*/ int win_border_width = 2; Window win; /*创建一个简单的窗口作为屏幕上根窗口的直接孩子。参数意义依次如下: *所在的显示是哪个 *该显示号和屏幕号下的根窗口作为父窗口 *窗口的x坐标 *窗口的y坐标 *窗口的宽度 *窗口的高度 *窗口的边缘像素宽度 *窗口的前景色为白 *窗口的背景色为黑 * */ win = XCreateSimpleWindow(display, RootWindow(display, screen_num), x, y, width, height, win_border_width, WhitePixel(display, screen_num), BlackPixel(display, screen_num)); /*没有这个调用也能创建窗口,这个是什么作用??? *设置指定窗口的WM_TRANSIENT_FOR属性为RootWindow(display, screen_num)?? *WM_TRANSIENT_FOR属性由程序来设置,用于告诉窗口管理器是一个短暂的top-level窗口 * */ XSetTransientForHint(display, win, RootWindow(display, screen_num)); /* make the window actually appear on the screen. */ /*这句话使窗口出现在屏幕上*/ XMapWindow(display, win); /* flush all pending requests to the X server. */ /*把所有的请求提交给X server,如果没有这句话,那么窗口也不会被显示出来的*/ XFlush(display); return win; }
static void on_realize (GtkWidget *dialog, gpointer data) { Window xid; xid = (Window) GPOINTER_TO_INT (data); #if GTK_CHECK_VERSION(3, 22, 0) gdk_x11_display_error_trap_push (gtk_widget_get_display (dialog)); #else gdk_error_trap_push (); #endif XSetTransientForHint (gdk_x11_get_default_xdisplay (), GDK_WINDOW_XID (gtk_widget_get_window (dialog)), xid); #if GTK_CHECK_VERSION(3, 22, 0) gdk_x11_display_error_trap_pop_ignored (gtk_widget_get_display (dialog)); #else gdk_error_trap_pop_ignored (); #endif }
void emX11WindowPort::WindowFlagsChanged() { int i; SetModalState(false); if (FullscreenUpdateTimer) { delete FullscreenUpdateTimer; FullscreenUpdateTimer=NULL; } if (Screen.GrabbingWinPort==this) Screen.GrabbingWinPort=NULL; XMutex.Lock(); XFreeGC(Disp,Gc); XMutex.Unlock(); Gc=NULL; if (InputContext) { XMutex.Lock(); XDestroyIC(InputContext); XMutex.Unlock(); InputContext=NULL; } Screen.WCThread->RemoveWindow(Win); XMutex.Lock(); XDestroyWindow(Disp,Win); XMutex.Unlock(); Win=None; PreConstruct(); for (i=0; i<Screen.WinPorts.GetCount(); i++) { if ( Screen.WinPorts[i]->Owner==this && Screen.WinPorts[i]->Win!=None ) { XMutex.Lock(); XSetTransientForHint(Disp,Screen.WinPorts[i]->Win,Win); XMutex.Unlock(); } } }
void InitWindowProperty (void) { XTextProperty tp; char strOutput[100]; char *ps; Atom about_wm_window_type = XInternAtom (dpy, "_NET_WM_WINDOW_TYPE", False); Atom type_toolbar = XInternAtom (dpy, "_NET_WM_WINDOW_TYPE_TOOLBAR", False); XSetTransientForHint (dpy, aboutWindow, DefaultRootWindow (dpy)); XChangeProperty (dpy, aboutWindow, about_wm_window_type, XA_ATOM, 32, PropModeReplace, (void *) &type_toolbar, 1); about_protocol_atom = XInternAtom (dpy, "WM_PROTOCOLS", False); about_kill_atom = XInternAtom (dpy, "WM_DELETE_WINDOW", False); XSetWMProtocols (dpy, aboutWindow, &about_kill_atom, 1); if (bIsUtf8) { size_t l1, l2; char *p; p = AboutCaption; ps = strOutput; l1 = strlen (AboutCaption); l2 = 99; l1 = iconv (convUTF8, (ICONV_CONST char **) (&p), &l1, &ps, &l2); *ps = '\0'; ps = strOutput; } else ps = AboutCaption; tp.value = (void *) ps; tp.encoding = XA_STRING; tp.format = 16; tp.nitems = strlen (ps); XSetWMName (dpy, aboutWindow, &tp); }
/*ARGSUSED*/ static void x_set_icccm_hints(Display *dpy, Window w, char *name, char *wm_icon_name, XSizeHints *psizehints, XWMHints *pwmhints, Window main_window) { XStoreName(dpy,w,name); XSetIconName(dpy,w,wm_icon_name); XSetWMNormalHints(dpy,w,psizehints); XSetWMHints(dpy,w,pwmhints); XSetClassHint(dpy,w,&classhint); /* in order for some wm's to iconify, the window shouldn't be transient. e.g. Motif wm */ if (main_window != None) { if (set_transient) XSetTransientForHint(dpy,w,main_window); } if (enable_delete) XSetWMProtocols(dpy,w,&XA_WM_DELETE_WINDOW,1); }
bool wxPopupWindow::Create( wxWindow *parent, int style ) { if (!CreateBase( parent, -1, wxDefaultPosition, wxDefaultSize, style, wxDefaultValidator, wxT("popup") )) { wxFAIL_MSG( wxT("wxPopupWindow creation failed") ); return false; } // All dialogs should really have this style m_windowStyle = style; m_windowStyle |= wxTAB_TRAVERSAL; wxPoint pos( 20,20 ); wxSize size( 20,20 ); wxPoint pos2 = pos; wxSize size2 = size; m_parent = parent; if (m_parent) m_parent->AddChild( this ); Display *xdisplay = wxGlobalDisplay(); int xscreen = DefaultScreen( xdisplay ); Visual *xvisual = DefaultVisual( xdisplay, xscreen ); Window xparent = RootWindow( xdisplay, xscreen ); Colormap cm = DefaultColormap( xdisplay, xscreen); #if wxUSE_TWO_WINDOWS bool need_two_windows = ((( wxSUNKEN_BORDER | wxRAISED_BORDER | wxSIMPLE_BORDER | wxHSCROLL | wxVSCROLL ) & m_windowStyle) != 0); #else bool need_two_windows = false; #endif #if wxUSE_NANOX long xattributes_mask = 0; #else XSetWindowAttributes xattributes; long xattributes_mask = 0; m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); m_backgroundColour.CalcPixel( (WXColormap) cm); m_foregroundColour = *wxBLACK; m_foregroundColour.CalcPixel( (WXColormap) cm); xattributes_mask |= CWBackPixel; xattributes.background_pixel = m_backgroundColour.GetPixel(); xattributes_mask |= CWBorderPixel; xattributes.border_pixel = BlackPixel( xdisplay, xscreen ); xattributes_mask |= CWOverrideRedirect | CWSaveUnder; xattributes.override_redirect = True; xattributes.save_under = True; xattributes_mask |= CWEventMask; #endif if (need_two_windows) { #if !wxUSE_NANOX xattributes.event_mask = ExposureMask | StructureNotifyMask | ColormapChangeMask; #endif Window xwindow = XCreateWindow( xdisplay, xparent, pos.x, pos.y, size.x, size.y, 0, DefaultDepth(xdisplay,xscreen), InputOutput, xvisual, xattributes_mask, &xattributes ); #if wxUSE_NANOX XSelectInput( xdisplay, xwindow, ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask | KeymapStateMask | FocusChangeMask | ColormapChangeMask | StructureNotifyMask | PropertyChangeMask ); #endif // Set background to None which will prevent X11 from clearing the // background comletely. XSetWindowBackgroundPixmap( xdisplay, xwindow, None ); m_mainWindow = (WXWindow) xwindow; wxAddWindowToTable( xwindow, (wxWindow*) this ); // XMapWindow( xdisplay, xwindow ); #if !wxUSE_NANOX xattributes.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask | KeymapStateMask | FocusChangeMask | ColormapChangeMask | StructureNotifyMask | PropertyChangeMask | VisibilityChangeMask ; #endif if (HasFlag( wxSUNKEN_BORDER) || HasFlag( wxRAISED_BORDER)) { pos2.x = 2; pos2.y = 2; size2.x -= 4; size2.y -= 4; } else if (HasFlag( wxSIMPLE_BORDER )) { pos2.x = 1; pos2.y = 1; size2.x -= 2; size2.y -= 2; } else { pos2.x = 0; pos2.y = 0; } xwindow = XCreateWindow( xdisplay, xwindow, pos2.x, pos2.y, size2.x, size2.y, 0, DefaultDepth(xdisplay,xscreen), InputOutput, xvisual, xattributes_mask, &xattributes ); // Set background to None which will prevent X11 from clearing the // background comletely. XSetWindowBackgroundPixmap( xdisplay, xwindow, None ); #if wxUSE_NANOX XSelectInput( xdisplay, xwindow, ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask | KeymapStateMask | FocusChangeMask | ColormapChangeMask | StructureNotifyMask | PropertyChangeMask ); #endif m_clientWindow = (WXWindow) xwindow; wxAddClientWindowToTable( xwindow, (wxWindow*) this ); m_isShown = false; XMapWindow( xdisplay, xwindow ); } else { // One window #if !wxUSE_NANOX xattributes.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask | KeymapStateMask | FocusChangeMask | ColormapChangeMask | StructureNotifyMask | PropertyChangeMask | VisibilityChangeMask ; #endif Window xwindow = XCreateWindow( xdisplay, xparent, pos.x, pos.y, size.x, size.y, 0, DefaultDepth(xdisplay,xscreen), InputOutput, xvisual, xattributes_mask, &xattributes ); #if wxUSE_NANOX XSelectInput( xdisplay, xwindow, ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask | KeymapStateMask | FocusChangeMask | ColormapChangeMask | StructureNotifyMask | PropertyChangeMask ); #endif // Set background to None which will prevent X11 from clearing the // background comletely. XSetWindowBackgroundPixmap( xdisplay, xwindow, None ); m_mainWindow = (WXWindow) xwindow; m_clientWindow = (WXWindow) xwindow; wxAddWindowToTable( xwindow, (wxWindow*) this ); m_isShown = false; // XMapWindow( xdisplay, xwindow ); } XSetTransientForHint( xdisplay, (Window) m_mainWindow, xparent ); #if wxUSE_NANOX // Switch off WM wxSetWMDecorations( (Window) m_mainWindow, 0 ); #else XWMHints wm_hints; wm_hints.flags = InputHint | StateHint /* | WindowGroupHint */; wm_hints.input = True; wm_hints.initial_state = NormalState; XSetWMHints( xdisplay, (Window) m_mainWindow, &wm_hints); #endif return true; }
bool VstPlugin::processMessage( const message & _m ) { switch( _m.id ) { case IdVstPluginWindowID: m_pluginWindowID = _m.getInt(); if( m_embedMethod == "none" ) { #ifdef LMMS_BUILD_WIN32 // We're changing the owner, not the parent, // so this is legal despite MSDN's warning SetWindowLongPtr( (HWND)(intptr_t) m_pluginWindowID, GWLP_HWNDPARENT, (LONG_PTR) gui->mainWindow()->winId() ); #endif #ifdef LMMS_BUILD_LINUX XSetTransientForHint( QX11Info::display(), m_pluginWindowID, gui->mainWindow()->winId() ); #endif } break; case IdVstPluginEditorGeometry: m_pluginGeometry = QSize( _m.getInt( 0 ), _m.getInt( 1 ) ); break; case IdVstPluginName: m_name = _m.getQString(); break; case IdVstPluginVersion: m_version = _m.getInt(); break; case IdVstPluginVendorString: m_vendorString = _m.getQString(); break; case IdVstPluginProductString: m_productString = _m.getQString(); break; case IdVstCurrentProgram: m_currentProgram = _m.getInt(); break; case IdVstCurrentProgramName: m_currentProgramName = _m.getQString(); break; case IdVstProgramNames: m_allProgramNames = _m.getQString(); break; case IdVstPluginUniqueID: // TODO: display graphically in case of failure printf("unique ID: %s\n", _m.getString().c_str() ); break; case IdVstParameterDump: { m_parameterDump.clear(); const int num_params = _m.getInt(); int p = 0; for( int i = 0; i < num_params; ++i ) { VstParameterDumpItem item; item.index = _m.getInt( ++p ); item.shortLabel = _m.getString( ++p ); item.value = _m.getFloat( ++p ); m_parameterDump["param" + QString::number( item.index )] = QString::number( item.index ) + ":" + /*uncomented*/ /*QString( item.shortLabel )*/ QString::fromStdString(item.shortLabel) + ":" + QString::number( item.value ); } break; } default: return RemotePlugin::processMessage( _m ); } return true; }
X11Window::X11Window( intf_thread_t *pIntf, GenericWindow &rWindow, X11Display &rDisplay, bool dragDrop, bool playOnDrop, X11Window *pParentWindow, GenericWindow::WindowType_t type ): OSWindow( pIntf ), m_rDisplay( rDisplay ), m_pParent( pParentWindow ), m_dragDrop( dragDrop ), m_pDropTarget( NULL ), m_type ( type ) { XSetWindowAttributes attr; unsigned long valuemask; std::string name_type; if( type == GenericWindow::FullscreenWindow ) { m_wnd_parent = DefaultRootWindow( XDISPLAY ); int i_screen = DefaultScreen( XDISPLAY ); attr.event_mask = ExposureMask | StructureNotifyMask; attr.background_pixel = BlackPixel( XDISPLAY, i_screen ); attr.backing_store = Always; valuemask = CWBackingStore | CWBackPixel | CWEventMask; if( NET_WM_STATE_FULLSCREEN == None ) { attr.override_redirect = True; valuemask = valuemask | CWOverrideRedirect; } name_type = "Fullscreen"; } else if( type == GenericWindow::VoutWindow ) { m_wnd_parent = pParentWindow->m_wnd; int i_screen = DefaultScreen( XDISPLAY ); attr.event_mask = ExposureMask | StructureNotifyMask; attr.backing_store = Always; attr.background_pixel = BlackPixel( XDISPLAY, i_screen ); valuemask = CWBackingStore | CWBackPixel | CWEventMask; name_type = "VoutWindow"; } else if( type == GenericWindow::FscWindow ) { m_wnd_parent = DefaultRootWindow( XDISPLAY ); attr.event_mask = ExposureMask | StructureNotifyMask; valuemask = CWEventMask; name_type = "FscWindow"; } else { m_wnd_parent = DefaultRootWindow( XDISPLAY ); attr.event_mask = ExposureMask | StructureNotifyMask; valuemask = CWEventMask; name_type = "TopWindow"; } // Create the window m_wnd = XCreateWindow( XDISPLAY, m_wnd_parent, -10, 0, 10, 10, 0, 0, InputOutput, CopyFromParent, valuemask, &attr ); // wait for X server to process the previous commands XSync( XDISPLAY, false ); // Set the colormap for 8bpp mode if( XPIXELSIZE == 1 ) { XSetWindowColormap( XDISPLAY, m_wnd, m_rDisplay.getColormap() ); } // Select events received by the window long event_mask; if( type == GenericWindow::VoutWindow ) { event_mask = ExposureMask|KeyPressMask| LeaveWindowMask|FocusChangeMask; } else { event_mask = ExposureMask|KeyPressMask| PointerMotionMask|ButtonPressMask|ButtonReleaseMask| LeaveWindowMask|FocusChangeMask; } XSelectInput( XDISPLAY, m_wnd, event_mask ); // Store a pointer on the generic window in a map X11Factory *pFactory = (X11Factory*)X11Factory::instance( getIntf() ); pFactory->m_windowMap[m_wnd] = &rWindow; // Changing decorations struct { unsigned long flags; unsigned long functions; unsigned long decorations; signed long input_mode; unsigned long status; } motifWmHints; Atom hints_atom = XInternAtom( XDISPLAY, "_MOTIF_WM_HINTS", False ); motifWmHints.flags = 2; // MWM_HINTS_DECORATIONS; motifWmHints.decorations = 0; XChangeProperty( XDISPLAY, m_wnd, hints_atom, hints_atom, 32, PropModeReplace, (unsigned char *)&motifWmHints, sizeof( motifWmHints ) / sizeof( uint32_t ) ); // Drag & drop if( m_dragDrop ) { // Create a Dnd object for this window m_pDropTarget = new X11DragDrop( getIntf(), m_rDisplay, m_wnd, playOnDrop, &rWindow ); // Register the window as a drop target Atom xdndAtom = XInternAtom( XDISPLAY, "XdndAware", False ); char xdndVersion = 4; XChangeProperty( XDISPLAY, m_wnd, xdndAtom, XA_ATOM, 32, PropModeReplace, (unsigned char *)&xdndVersion, 1 ); // Store a pointer to be used in X11Loop pFactory->m_dndMap[m_wnd] = m_pDropTarget; } // Change the window title std::string name_window = "VLC (" + name_type + ")"; XStoreName( XDISPLAY, m_wnd, name_window.c_str() ); // Set the WM_TRANSIENT_FOR property if( type == GenericWindow::FscWindow ) { // Associate the fsc window to the fullscreen window VoutManager* pVoutManager = VoutManager::instance( getIntf() ); GenericWindow* pWin = pVoutManager->getVoutMainWindow(); Window wnd = (Window) pWin->getOSHandle(); XSetTransientForHint( XDISPLAY, m_wnd, wnd ); } else { // Associate the regular top-level window to the offscren main window XSetTransientForHint( XDISPLAY, m_wnd, m_rDisplay.getMainWindow() ); } // initialize Class Hint XClassHint classhint; classhint.res_name = (char*) "vlc"; classhint.res_class = (char*) "Vlc"; XSetClassHint( XDISPLAY, m_wnd, &classhint ); // copies WM_HINTS from the main window XWMHints *wm = XGetWMHints( XDISPLAY, m_rDisplay.getMainWindow() ); if( wm ) { XSetWMHints( XDISPLAY, m_wnd, wm ); XFree( wm ); } // initialize WM_CLIENT_MACHINE char* hostname = NULL; long host_name_max = sysconf( _SC_HOST_NAME_MAX ); if( host_name_max <= 0 ) host_name_max = _POSIX_HOST_NAME_MAX; hostname = new char[host_name_max]; if( hostname && gethostname( hostname, host_name_max ) == 0 ) { hostname[host_name_max - 1] = '\0'; XTextProperty textprop; textprop.value = (unsigned char *) hostname; textprop.encoding = XA_STRING; textprop.format = 8; textprop.nitems = strlen( hostname ); XSetWMClientMachine( XDISPLAY, m_wnd, &textprop); } delete[] hostname; // initialize EWMH pid pid_t pid = getpid(); assert( NET_WM_PID != None ); XChangeProperty( XDISPLAY, m_wnd, NET_WM_PID, XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&pid, 1 ); }
static int motDialogMapMethod(Ihandle* ih) { Widget dialog_manager; InativeHandle* parent; int mwm_decor = 0; int num_args = 0; Arg args[20]; if (iupAttribGetInt(ih, "DIALOGFRAME")) { iupAttribSetStr(ih, "RESIZE", "NO"); iupAttribSetStr(ih, "MAXBOX", "NO"); iupAttribSetStr(ih, "MINBOX", "NO"); } /****************************/ /* Create the dialog shell */ /****************************/ if (iupAttribGet(ih, "TITLE")) mwm_decor |= MWM_DECOR_TITLE; if (iupAttribGetInt(ih, "MENUBOX")) mwm_decor |= MWM_DECOR_MENU; if (iupAttribGetInt(ih, "MINBOX")) mwm_decor |= MWM_DECOR_MINIMIZE; if (iupAttribGetInt(ih, "MAXBOX")) mwm_decor |= MWM_DECOR_MAXIMIZE; if (iupAttribGetInt(ih, "RESIZE")) mwm_decor |= MWM_DECOR_RESIZEH; if (iupAttribGetInt(ih, "BORDER")) mwm_decor |= MWM_DECOR_BORDER; iupmotSetArg(args, num_args, XmNmappedWhenManaged, False); /* so XtRealizeWidget will not show the dialog */ iupmotSetArg(args, num_args, XmNdeleteResponse, XmDO_NOTHING); iupmotSetArg(args, num_args, XmNallowShellResize, True); /* Used so the BulletinBoard can control the shell size */ iupmotSetArg(args, num_args, XmNtitle, ""); iupmotSetArg(args, num_args, XmNvisual, iupmot_visual); if (iupmotColorMap()) iupmotSetArg(args, num_args, XmNcolormap, iupmotColorMap()); if (mwm_decor != 0x7E) iupmotSetArg(args, num_args, XmNmwmDecorations, mwm_decor); if (iupAttribGetInt(ih, "SAVEUNDER")) iupmotSetArg(args, num_args, XmNsaveUnder, True); parent = iupDialogGetNativeParent(ih); if (parent) ih->handle = XtCreatePopupShell(NULL, topLevelShellWidgetClass, (Widget)parent, args, num_args); else ih->handle = XtAppCreateShell(NULL, "dialog", topLevelShellWidgetClass, iupmot_display, args, num_args); if (!ih->handle) return IUP_ERROR; XmAddWMProtocolCallback(ih->handle, iupmot_wm_deletewindow, motDialogCBclose, (XtPointer)ih); XtAddEventHandler(ih->handle, FocusChangeMask, False, (XtEventHandler)iupmotFocusChangeEvent, (XtPointer)ih); XtAddEventHandler(ih->handle, EnterWindowMask, False, (XtEventHandler)iupmotEnterLeaveWindowEvent, (XtPointer)ih); XtAddEventHandler(ih->handle, LeaveWindowMask, False, (XtEventHandler)iupmotEnterLeaveWindowEvent, (XtPointer)ih); XtAddEventHandler(ih->handle, StructureNotifyMask, False, (XtEventHandler)motDialogCBStructureNotifyEvent, (XtPointer)ih); XtAddCallback(ih->handle, XmNdestroyCallback, (XtCallbackProc)motDialogDestroyCallback, (XtPointer)ih); /*****************************/ /* Create the dialog manager */ /*****************************/ dialog_manager = XtVaCreateManagedWidget( "dialog_manager", xmBulletinBoardWidgetClass, ih->handle, XmNmarginWidth, 0, XmNmarginHeight, 0, XmNwidth, 100, /* set this to avoid size calculation problems */ XmNheight, 100, XmNborderWidth, 0, XmNshadowThickness, 0, XmNnoResize, iupAttribGetInt(ih, "RESIZE")? False: True, XmNresizePolicy, XmRESIZE_NONE, /* no automatic resize of children */ XmNuserData, ih, /* used only in motDialogConfigureNotify */ XmNnavigationType, XmTAB_GROUP, NULL); XtOverrideTranslations(dialog_manager, XtParseTranslationTable("<Configure>: iupDialogConfigure()")); XtAddCallback(dialog_manager, XmNhelpCallback, (XtCallbackProc)iupmotHelpCallback, (XtPointer)ih); XtAddEventHandler(dialog_manager, KeyPressMask, False,(XtEventHandler)iupmotKeyPressEvent, (XtPointer)ih); /* force the BGCOLOR to match the DLGBGCOLOR */ motDialogSetBgColorAttrib(ih, IupGetGlobal("DLGBGCOLOR")); /* initialize the widget */ XtRealizeWidget(ih->handle); /* child dialogs must be always on top of the parent */ if (parent) XSetTransientForHint(iupmot_display, XtWindow(ih->handle), XtWindow(parent)); if (mwm_decor != 0x7E) /* some decoration was changed */ motDialogSetWindowManagerStyle(ih); /* Ignore VISIBLE before mapping */ iupAttribSetStr(ih, "VISIBLE", NULL); if (IupGetGlobal("_IUP_SET_DLGFGCOLOR")) { iupmotSetGlobalColorAttrib(dialog_manager, XmNforeground, "DLGFGCOLOR"); IupSetGlobal("_IUP_SET_DLGFGCOLOR", NULL); } return IUP_NOERROR; }