Esempio n. 1
0
/*
 ****************************************************************
 *	Limpa a janela de mensagens				*
 ****************************************************************
 */
void
clear_msg_win (void)
{
	const WINDATA	*wp = &msg;

	if (msg_len == 0)
		return;

	XUnmapWindow (display, msg_yes.win);
	XUnmapWindow (display, msg_no.win);

	XClearWindow (display, wp->win);

	draw_shadow
	(	wp->win,
		wp->triple.top_gc, wp->triple.bottom_gc,
		0, 0,
		wp->width, wp->height
	);

	msg_len = 0;

}	/* end clear_msg_win */
Esempio n. 2
0
void CloseAllSubMenuWindow(XlibMenu *xlibMenu)
{
    FcitxClassicUI* classicui = xlibMenu->owner;
    FcitxMenuItem *menu;
    for (menu = (FcitxMenuItem *) utarray_front(&xlibMenu->menushell->shell);
            menu != NULL;
            menu = (FcitxMenuItem *) utarray_next(&xlibMenu->menushell->shell, menu)
        ) {
        if (menu->type == MENUTYPE_SUBMENU && menu->subMenu) {
            CloseAllSubMenuWindow((XlibMenu *)menu->subMenu->uipriv[classicui->isfallback]);
        }
    }
    XUnmapWindow(xlibMenu->owner->dpy, xlibMenu->menuWindow);
}
Esempio n. 3
0
File: vk.c Progetto: areslp/fcitx
void SwitchVK(FcitxVKState *vkstate)
{
    FcitxInstance* instance = vkstate->owner;
    if (vkstate->vkWindow == NULL)
        vkstate->vkWindow = CreateVKWindow(vkstate);
    VKWindow *vkWindow = vkstate->vkWindow;
    if (!vkstate->iVKCount)
        return;

    vkstate->bVK = !vkstate->bVK;

    if (vkstate->bVK) {
        int             x, y;
        int dwidth, dheight;
        InvokeVaArgs(vkstate->owner, FCITX_X11, GETSCREENSIZE,
                     &dwidth, &dheight);

        if (!FcitxUISupportMainWindow(instance)) {
            x = dwidth / 2 - VK_WINDOW_WIDTH / 2;
            y = 40;
        } else {
            int mx = 0, my = 0, mw = 0, mh = 0;
            FcitxUIGetMainWindowSize(instance, &mx, &my, &mw, &mh);
            x = mx;
            y = my + mh + 2;
            if ((y + VK_WINDOW_HEIGHT) >= dheight)
                y = my - VK_WINDOW_HEIGHT - 2;
            if (y < 0)
                y = 0;
        }
        if ((x + VK_WINDOW_WIDTH) >= dwidth)
            x = dwidth - VK_WINDOW_WIDTH - 1;
        if (x < 0)
            x = 0;


        XMoveWindow(vkWindow->dpy, vkWindow->window, x, y);
        DisplayVKWindow(vkWindow);
        FcitxUICloseInputWindow(instance);

        FcitxInputContext* ic = FcitxInstanceGetCurrentIC(instance);

        if (ic && FcitxInstanceGetCurrentState(instance) == IS_CLOSED)
            FcitxInstanceEnableIM(instance, ic, true);
    } else {
        XUnmapWindow(vkWindow->dpy, vkWindow->window);
        FcitxInstanceCleanInputWindow(instance);
        FcitxUIUpdateInputWindow(instance);
    }
}
Esempio n. 4
0
int main() {
    EGLContextType *context = NULL;
    // X display and window
    Display * x11Display = XOpenDisplay(NULL);
    CHECK_HANDLE_RET(x11Display, NULL, "XOpenDisplay", -1);
    Window x11RootWindow = DefaultRootWindow(x11Display);

    // may remove the attrib
    XSetWindowAttributes x11WindowAttrib;
    x11WindowAttrib.event_mask = ExposureMask | KeyPressMask;

    // create with video size, simplify it
    Window x11Window = XCreateWindow(x11Display, x11RootWindow,
        0, 0, 800, 600, 0, CopyFromParent, InputOutput,
        CopyFromParent, CWEventMask, &x11WindowAttrib);
    XMapWindow(x11Display, x11Window);
    XSync(x11Display, 0);

    context = eglInit(x11Display, x11Window, 0, 0);
    // GLuint textureId = createTestTexture();
    XID pixmap = createPixmap(x11Display, x11Window);
    GLuint textureId = createTextureFromPixmap(context, pixmap);
    drawTextures(context, &textureId, 1);

    EGLBoolean running = EGL_TRUE;
    while (running) {
        XEvent x_event;
        XNextEvent(x11Display, &x_event);
        switch (x_event.type) {
        case Expose:
            glClear(GL_COLOR_BUFFER_BIT
                | GL_DEPTH_BUFFER_BIT
            );
            drawTextures(context, &textureId, 1);
            break;
        case KeyPress:
            running = EGL_FALSE;
            break;
        default:
            break;
        }
    }

    XUnmapWindow(x11Display, x11Window);
    XDestroyWindow(x11Display, x11Window);
    XCloseDisplay(x11Display);
    INFO("exit successfully");
    return 0;
}
Esempio n. 5
0
	void ChoosePositionPushButton::mousePressEvent(QMouseEvent *event)
	{
		QPushButton::mousePressEvent(event);

		mSearching = true;
		update();

#ifdef Q_OS_UNIX
        mShownWindows.clear();

        for(QWidget *widget: qApp->topLevelWidgets())
        {
            if(mMainWindow == widget)
                continue;

            if(widget->isVisible() && !widget->windowTitle().isEmpty())
            {
                mShownWindows.append(widget);

                XUnmapWindow(QX11Info::display(), widget->winId());
            }
        }

        if(mMainWindow)
            mMainWindow->hide();
#endif
#ifdef Q_OS_WIN
        for(QWidget *widget: qApp->topLevelWidgets())
			widget->setWindowOpacity(0.0f);
#endif

		QCursor newCursor(*mCrossIcon);

		emit chooseStarted();

#ifdef Q_OS_WIN
        mPreviousCursor = SetCursor(LoadCursor(0, IDC_CROSS));
#endif
#ifdef Q_OS_UNIX
        QCoreApplication::instance()->installNativeEventFilter(this);

        if(XGrabPointer(QX11Info::display(), DefaultRootWindow(QX11Info::display()), True, ButtonReleaseMask, GrabModeAsync, GrabModeAsync,
                        None, mCrossCursor, CurrentTime) != GrabSuccess)
        {
            QMessageBox::warning(this, tr("Choose a window"), tr("Unable to grab the pointer."));
            event->ignore();
        }
#endif
    }
Esempio n. 6
0
void
toolbar_client_hide(Client *c)
{
  Wm   *w = c->wm;

  if (c->flags & CLIENT_IS_MINIMIZED || client_get_state(c) == IconicState) 
    return;
   
  client_set_state(c,IconicState);
  c->flags |= CLIENT_IS_MINIMIZED; 

  c->ignore_unmap++;
  XUnmapWindow(w->dpy, c->window);
  
  if (c->flags & CLIENT_TITLE_HIDDEN_FLAG)
    {
      XUnmapWindow(w->dpy, c->frame);
    }
  else
    {
      client_buttons_delete_all(c);   
  
      c->x = wm_get_offsets_size(c->wm, WEST,  NULL, False);
  
      c->y = c->y + c->height 
               - theme_frame_defined_height_get(c->wm->mbtheme, FRAME_UTILITY_MIN);
    }

  toolbar_client_move_resize(c);

  toolbar_client_redraw(c, False);
  
  dbg("hiding toolbar y is now %i", c->y);

  wm_update_layout(c->wm, c, c->height - toolbar_win_offset(c));
}
Esempio n. 7
0
/*
 * Class:     org_jdesktop_jdic_dock_internal_impl_UnixDockService
 * Method:    mapWindow
 * Signature: (JZ)V
 */
JNIEXPORT void JNICALL Java_org_jdesktop_jdic_dock_internal_impl_UnixDockService_mapWindow(JNIEnv *env, jobject obj, jlong win, jboolean b)
{
    (*LockIt)(env);

    if (b) {
	dprintf("mapped window id is %x\n", win);
	XMapWindow(display, win);
    }
    else {
	dprintf("unmapped window id is %x\n", win);	
	XUnmapWindow(display, win);
    }

    (*UnLockIt)(env);
}
Esempio n. 8
0
/**
 * Destroy a CTT window.
 */
void
ctt_destroy_window(Display *dpy, Window parent) {
  int ctt_window = alltray_ctt_windowlist_get_ctt_for_parent(parent);

  if(ctt_window != 0) {
    // The windows may already be unmapped or destroyed.
    XSetErrorHandler(ctt_handle_x11_error);

    XUnmapWindow(dpy, ctt_window);
    XDestroyWindow(dpy, ctt_window);
    XSync(dpy, False);

    XSetErrorHandler(NULL);
  }
}
Esempio n. 9
0
static void
_cg_winsys_onscreen_set_visibility(cg_onscreen_t *onscreen,
                                   bool visibility)
{
    cg_device_t *dev = CG_FRAMEBUFFER(onscreen)->dev;
    cg_renderer_t *renderer = dev->display->renderer;
    cg_xlib_renderer_t *xlib_renderer = _cg_xlib_renderer_get_data(renderer);
    cg_onscreen_egl_t *onscreen_egl = onscreen->winsys;
    cg_onscreen_xlib_t *xlib_onscreen = onscreen_egl->platform;

    if (visibility)
        XMapWindow(xlib_renderer->xdpy, xlib_onscreen->xwin);
    else
        XUnmapWindow(xlib_renderer->xdpy, xlib_onscreen->xwin);
}
//==============================================================================
void VstPluginExternalEditor::visibilityChanged ()
{
    if (isShowing())
    {
#if defined(LINUX)
        if (handle) XMapRaised (display, handle);
#endif
    }
    else
    {
#if defined(LINUX)
        if (handle) XUnmapWindow (display, handle);
#endif
    }
}
Esempio n. 11
0
void CloseAllSubMenuWindow(XlibMenu *xlibMenu)
{
    MenuShell *menu;
    for (menu = (MenuShell *) utarray_front(&xlibMenu->menushell->shell);
            menu != NULL;
            menu = (MenuShell *) utarray_next(&xlibMenu->menushell->shell, menu)
        )
    {
        if (menu->type == MENUTYPE_SUBMENU && menu->subMenu)
        {
            CloseAllSubMenuWindow((XlibMenu *)menu->subMenu->uipriv);
        }
    }
    XUnmapWindow(xlibMenu->owner->dpy, xlibMenu->menuWindow);
}
void X11Device::setVisible(bool visible) {
    Assert(m_initialized);

    if (visible && !m_visible) {
        X11Session *session = static_cast<X11Session *>(getSession());
        XMapRaised(session->m_display, m_window);
        XSync(session->m_display, 0);
        m_visible = true;
    } else if (!visible && m_visible) {
        X11Session *session = static_cast<X11Session *>(getSession());
        XUnmapWindow(session->m_display, m_window);
        XSync(session->m_display, 0);
        m_visible = false;
    }
}
Esempio n. 13
0
void GLWindow::destroy() {
    // hide window
    if (this->window != None) {
        XUnmapWindow(this->display, this->window);
    }

    // destroy opengl framebuffer
    if (this->glxWindow != None) {
        glXDestroyWindow(this->display, this->glxWindow);
        this->glxWindow = None;
    }

    // destroy window
    if (this->window != None) {
        XDestroyWindow(this->display, this->window);
        this->window = None;
    }

    // destroy colormap
    if (this->colormap != None) {
        XFreeColormap(this->display, this->colormap);
        this->colormap = None;
    }

    // destroy framebuffer configuration
    if (this->visualinfo != NULL) {
        XFree(this->visualinfo);
        this->visualinfo = NULL;
    }

    // destroy opengl context
    if (this->glxContext != NULL) {
        glXDestroyContext(this->display, this->glxContext);
        this->glxContext = NULL;
    }

    // free opengl framebuffer configurations
    if (this->glxConfigs != NULL) {
        XFree(this->glxConfigs);
        this->glxConfigs = NULL;
    }

    this->visible = false;
    this->x = this->y = 0;
    this->_width = this->_height = 0;
    this->mouse = false;
    this->mouseX = this->mouseY = 0;
}
Esempio n. 14
0
XVWindow::~XVWindow() {
	if (_isInitialized && _XShmInfo.shmaddr) {
		XShmDetach(_display, &_XShmInfo);
		shmdt(_XShmInfo.shmaddr);
	}
	if (_XVImage) {
		XFree(_XVImage);
	}
	if (_gc) {
		XFree(_gc);
	}
	if (_XVWindow) {
		XUnmapWindow(_display, _XVWindow);
		XDestroyWindow(_display, _XVWindow);
	}
}
void wsVisibleWindow(wsTWindow *win, int show)
{
    switch (show) {
    case wsShowWindow:
        XMapRaised(wsDisplay, win->WindowID);
        if (vo_fs_type & vo_wm_FULLSCREEN)
            win->isFullScreen = False;
        break;

    case wsHideWindow:
        XUnmapWindow(wsDisplay, win->WindowID);
        break;
    }

    XFlush(wsDisplay);
}
Esempio n. 16
0
void SplashReconfigureNow(Splash * splash) {
    SplashCenter(splash);
    if (splash->window) {
        XUnmapWindow(splash->display, splash->window);
        XMoveResizeWindow(splash->display, splash->window,
            splash->x, splash->y,
            splash->width, splash->height);
        SplashUpdateSizeHints(splash);
    }
    if (splash->maskRequired) {
        SplashUpdateShape(splash);
    } else {
        SplashRevertShape(splash);
    }
    SplashRedrawWindow(splash);
}
Esempio n. 17
0
static DWORD
DrvShowWindow(LPARAM dwParm1, LPARAM dwParm2, LPVOID lpStruct)
{
    DWORD dwShow = (DWORD)dwParm1;
    Window frame_win = (Window)lpStruct;
    PRIVATEDISPLAY *Disp = GETDP();

    if (frame_win) {
	if (dwShow == DSW_SHOW)
	    XMapRaised(Disp->display, frame_win);
	else
	    XUnmapWindow(Disp->display, frame_win);
    }

    return 1L;
}
Esempio n. 18
0
/**
@brief    This is an internal function used to change the frame mode indicated on the frame. It mimics that used to change the frame name, but luckily the mode pixmaps can be pre-generated
@return   void
**/
static void
change_mode_pulldown_text_pixmap(Display *display, struct Frame *frame, int index, struct Themes *themes) {
  if(frame->widgets[mode_dropdown_text].widget) {
    XUnmapWindow(display, frame->widgets[mode_dropdown_text].widget);

    for(int j = 0; j <= inactive; j++) if(themes->window_type[frame->theme_type][mode_dropdown_text].exists)
    if(themes->window_type[frame->theme_type][index].state_p[j]){
      XSetWindowBackgroundPixmap(display, frame->widgets[mode_dropdown_text].state[j]
      , themes->window_type[frame->theme_type][index].state_p[j]);
    }

    XFlush(display);
    XMapWindow(display, frame->widgets[mode_dropdown_text].widget);
    XFlush(display);
  }
}
Esempio n. 19
0
//---------------------------------------------------------------------------
void CInternalWindow::SetVisible( bool bVisible/*=true*/ )
{
#ifdef _WIN32
	if (bVisible)
		ShowWindow( m_handle, SW_SHOWDEFAULT );
	else
		ShowWindow( m_handle, SW_HIDE );
	UpdateWindow( m_handle );
#elif defined(X_WIN_PRESENT)
	if (bVisible)
		XMapWindow(m_dipslay, m_window);
	else
		XUnmapWindow(m_dipslay, m_window);
	XFlush(m_display);
#endif
}
Esempio n. 20
0
void x_frame_set_visible(XObject* f, Bool visible)
{
	if(f->obj.type==XFRAME)
	{
		if(f->frame.visible!=visible)
		{
			f->frame.visible=visible;
			if(f->frame.visible)
				XMapWindow(dis,f->frame.obj.win);
			else
				XUnmapWindow(dis,f->frame.obj.win);
		}
	}
	else
		fprintf(stderr,"Warning: x_frame_set_visible: Wrong type of first argument\n");
}
Esempio n. 21
0
void Client::hide()
{
    if (isHidden()) {
	fprintf(stderr, "wm2: Client already hidden in Client::hide\n");
	return;
    }

    m_border->unmap();
    XUnmapWindow(display(), m_window);

//    if (isActive()) windowManager()->setActiveClient(0);
    if (isActive()) windowManager()->clearFocus();

    setState(IconicState);
    windowManager()->addToHiddenList(this);
}
Esempio n. 22
0
void CStdWindow::Clear() {
#ifdef USE_X11
  // Destroy window
  if (wnd) {
    CStdAppPrivate::SetWindow(wnd, 0);
    XUnmapWindow(dpy, wnd);
    XDestroyWindow(dpy, wnd);
    if (Info) XFree(Info);
    if (Hints) XFree(Hints);

    // Might be necessary when the last window is closed
    XFlush(dpy);
  }
  wnd = renderwnd = 0;
#endif
}
Esempio n. 23
0
void
shade_client(Client * c)
{
  if(!c->shaded) {
    c->shaded = 1;
    XResizeWindow(disp, c->frame, c->width, TITLEBAR_HEIGHT);
    c->ignore_unmap++;
    XUnmapWindow(disp, c->window);
    icccm_set_state(c, IconicState);
  } else {
    c->shaded = 0;
    XMapWindow(disp, c->window);
    XResizeWindow(disp, c->frame, c->width, c->height + TITLEBAR_HEIGHT);
    icccm_set_state(c, NormalState);
  }
}
Esempio n. 24
0
void destroyinput(Input *i)
{
	Input *p;

	if (i->hidden)
		memset(i->text, 0, sizeof(i->text));
	XUnmapWindow(dpy, i->win);
	XDestroyWindow(dpy, i->win);

	for (p = inputs; p && p->next != i; p = p->next);
	if (p)
		p->next = i->next;
	else
		inputs = i->next;
	free(i);
}
Esempio n. 25
0
static void
_cogl_winsys_onscreen_set_visibility (CoglOnscreen *onscreen,
                                      CoglBool visibility)
{
  CoglContext *context = COGL_FRAMEBUFFER (onscreen)->context;
  CoglRenderer *renderer = context->display->renderer;
  CoglXlibRenderer *xlib_renderer =
    _cogl_xlib_renderer_get_data (renderer);
  CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
  CoglOnscreenXlib *xlib_onscreen = onscreen_egl->platform;

  if (visibility)
    XMapWindow (xlib_renderer->xdpy, xlib_onscreen->xwin);
  else
    XUnmapWindow (xlib_renderer->xdpy, xlib_onscreen->xwin);
}
void
cairo_5c_gui_set_shown (cairo_5c_surface_t *c5s, Bool shown)
{
    cairo_5c_gui_t *gui = c5s->u.window.gui;

    if (!gui)
	return;

    if (!gui->window)
	return;

    if (shown)
	XMapWindow (gui->global->dpy, gui->window);
    else
	XUnmapWindow (gui->global->dpy, gui->window);
}
Esempio n. 27
0
void WindowData::RecreateWindow(const GLXFBConfig & glx_fbconfig)
{

    handle_map_window->erase(GetWindow());
    XUnmapWindow(GetDisplay(), GetWindow());
    XDestroyWindow(GetDisplay(), GetWindow());


    XVisualInfo *vi = glXGetVisualFromFBConfig(GetDisplay(), glx_fbconfig);

    XSetWindowAttributes dummy_swa;
    XSetWindowAttributes swa;
    Colormap cmap;
    swa.colormap = cmap = XCreateColormap(GetDisplay(), RootWindow(GetDisplay(), vi->screen), vi->visual, AllocNone);
    swa.background_pixmap = None;
    swa.border_pixel = 0;
    swa.event_mask = StructureNotifyMask;

    Window created_window = XCreateWindow(GetDisplay(), DefaultRootWindow(GetDisplay()), 0, 0, window_events->GetWidth(), window_events->GetHeight(), 0, vi->depth, InputOutput, vi->visual, CWBorderPixel|CWColormap|CWEventMask, &swa);

    SetWindow(created_window);

    XFree(vi);
    XStoreName(GetDisplay(), GetWindow(), "GL 3.0 Window");

    XSync(GetDisplay(), false);
    XFlush(GetDisplay());

    int input_flags = 0;
    input_flags |= PointerMotionMask;
    input_flags |= ExposureMask;
    input_flags |= KeyPressMask;
    input_flags |= KeyReleaseMask;
    input_flags |= ButtonPressMask;
    input_flags |= ButtonReleaseMask;
    input_flags |= StructureNotifyMask;
    input_flags |= FocusChangeMask;

    XSelectInput(GetDisplay(), GetWindow(), input_flags);

    Atom wmDeleteMessage = XInternAtom(GetDisplay(), "WM_DELETE_WINDOW", False);
    XSetWMProtocols(GetDisplay(), GetWindow(), &wmDeleteMessage, 1);

    handle_map_window->insert(std::make_pair(GetWindow(), window_events));
    window_events->MakeActive();
    window_events->Configure(window_events->Maximizable(), window_events->Minimizable(), window_events->Resizable());
}
Esempio n. 28
0
BOOL xf_floatbar_toggle_fullscreen(xfFloatbar* floatbar, bool fullscreen)
{
	int i, size;
	bool visible = False;
	xfContext* xfc;

	if (!floatbar || !floatbar->xfc)
		return FALSE;

	xfc = floatbar->xfc;

	/* Only visible if enabled */
	if (floatbar->flags & 0x0001)
	{
		/* Visible if fullscreen and flag visible in fullscreen mode */
		visible |= ((floatbar->flags & 0x0010) != 0) && fullscreen;
		/* Visible if window and flag visible in window mode */
		visible |= ((floatbar->flags & 0x0020) != 0) && !fullscreen;
	}

	if (visible)
	{
		if (!create_floatbar(floatbar))
			return FALSE;

		XMapWindow(xfc->display, floatbar->handle);
		size = ARRAYSIZE(floatbar->buttons);

		for (i = 0; i < size; i++)
		{
			XMapWindow(xfc->display, floatbar->buttons[i]->handle);
		}

		/* If default is hidden (and not sticky) don't show on fullscreen state changes */
		if (((floatbar->flags & 0x0004) == 0) && !floatbar->locked)
			floatbar->y = -FLOATBAR_HEIGHT + 1;

		xf_floatbar_hide_and_show(floatbar);
	}
	else if (floatbar->created)
	{
		XUnmapSubwindows(xfc->display, floatbar->handle);
		XUnmapWindow(xfc->display, floatbar->handle);
	}

	return TRUE;
}
Esempio n. 29
0
void cancel_resize(WWindow *wwin)
{
	WScreen *scr=SCREEN_OF(wwin);
	
	if(!resize_mode)
		return;
	
	resize_mode=FALSE;

	reset_timer(&resize_timer);
	
	if(XOR_RESIZE){
		res_draw_rubberband(scr, wwin->geom);
		XUngrabServer(wglobal.dpy);
	}
	XUnmapWindow(wglobal.dpy, scr->grdata.moveres_win);
}
Esempio n. 30
0
void closegraph()
{
    CHECKINIT(closegraph);

    XUnmapWindow(display, window);
    XDestroyWindow(display, window);
 	XFreePixmap(display,shadow);
// 	XFreePixmap(display,icon_pixmap);
    XFree(wm_hints);
    XFree(size_hints);
    XFreeGC(display, gc);
//    XUnloadFont( display, font );
    XCloseDisplay(display);

    init = 0;    
    return;
}