Beispiel #1
0
/* x_keyboard_exit
 *  Shut down the X11 keyboard driver.
 */
static void x_keyboard_exit(void)
{
   if (!xkeyboard_installed)
      return;
   xkeyboard_installed = 0;

   XLOCK();

#ifdef ALLEGRO_XWINDOWS_WITH_XIM

   if (xic) {
      XDestroyIC(xic);
      xic = NULL;
   }

   if (xim) {
      XCloseIM(xim);
      xim = NULL;
   }

#endif

   if (xmodmap) {
      XFreeModifiermap(xmodmap);
      xmodmap = NULL;
   }

   if (keysyms) {
      XFree(keysyms);
      keysyms = NULL;
   }

   XUNLOCK();
}
Beispiel #2
0
static void
InitI18N(Widget ctxw)
{
    LoginWidget ctx = (LoginWidget)ctxw;
    XIM         xim = (XIM) NULL;
    char *p;

    ctx->login.xic = (XIC) NULL;

    if ((p = XSetLocaleModifiers("@im=none")) != NULL && *p)
	xim = XOpenIM(XtDisplay(ctx), NULL, NULL, NULL);

    if (!xim) {
	LogError("Failed to open input method\n");
	return;
    }

    ctx->login.xic = XCreateIC(xim,
	XNInputStyle, (XIMPreeditNothing|XIMStatusNothing),
	XNClientWindow, ctx->core.window,
	XNFocusWindow,  ctx->core.window, NULL);

    if (!ctx->login.xic) {
	LogError("Failed to create input context\n");
	XCloseIM(xim);
    }
    return;
}
Beispiel #3
0
void _glfwPlatformTerminate(void)
{
    if (_glfw.x11.cursor)
    {
        XFreeCursor(_glfw.x11.display, _glfw.x11.cursor);
        _glfw.x11.cursor = (Cursor) 0;
    }

    free(_glfw.x11.clipboardString);

    if (_glfw.x11.im)
    {
        XCloseIM(_glfw.x11.im);
        _glfw.x11.im = NULL;
    }

    _glfwTerminateJoysticks();
    _glfwTerminateContextAPI();

    if (_glfw.x11.display)
    {
        XCloseDisplay(_glfw.x11.display);
        _glfw.x11.display = NULL;
    }
}
static void
xim_info_display_closed (GdkDisplay *display,
			 gboolean    is_error,
			 GtkOXIMInfo *info)
{
  GSList *ics, *tmp_list;

  open_ims = g_slist_remove (open_ims, info);

  ics = info->ics;
  info->ics = NULL;

  for (tmp_list = ics; tmp_list; tmp_list = tmp_list->next)
    set_ic_client_window (tmp_list->data, NULL);

  g_slist_free (ics);

  if (info->preedit_set)
    g_signal_handler_disconnect (info->settings, info->preedit_set);
  if (info->display_closed_cb)
    g_signal_handler_disconnect (display, info->display_closed_cb);

  if (info->xim_styles)
    XFree (info->xim_styles);
  g_free (info->locale);

  if (info->im)
    XCloseIM (info->im);

  g_free (info);
}
Beispiel #5
0
void _glfwPlatformTerminate(void)
{
    if (_glfw.x11.cursor)
    {
        XFreeCursor(_glfw.x11.display, _glfw.x11.cursor);
        _glfw.x11.cursor = (Cursor) 0;
    }

    free(_glfw.x11.clipboardString);

    if (_glfw.x11.im)
    {
        XCloseIM(_glfw.x11.im);
        _glfw.x11.im = NULL;
    }

#if defined(_GLFW_EGL)
    _glfwTerminateEGL();
#endif

    if (_glfw.x11.display)
    {
        XCloseDisplay(_glfw.x11.display);
        _glfw.x11.display = NULL;
    }

    // NOTE: This needs to be done after XCloseDisplay, as libGL registers
    //       cleanup callbacks that get called by it
#if defined(_GLFW_GLX)
    _glfwTerminateGLX();
#endif

    _glfwTerminateJoysticksLinux();
    _glfwTerminateThreadLocalStoragePOSIX();
}
Beispiel #6
0
void xwl_shutdown()
{
	i32 i;
	xwl_window_handle_t * wh;

	for( i = 0; i < XWL_MAX_WINDOW_HANDLES; ++i )
	{
		wh = &xwl_windowHandles[i];

		if ( wh->handle.handle )
		{
			// destroy window
		}

		memset( wh, 0, sizeof(xwl_window_handle_t) );
	}

#if LINUX
    if ( currentInputMethod )
    {
        XCloseIM( currentInputMethod );
        XCloseDisplay( currentDisplay );
        currentInputMethod = 0;
        currentDisplay = 0;
    }
#endif

#if __APPLE__
	xwl_osx_shutdown();
#endif
}
Beispiel #7
0
void _glfwPlatformTerminate(void)
{
    if (_glfw.x11.cursor)
    {
        XFreeCursor(_glfw.x11.display, _glfw.x11.cursor);
        _glfw.x11.cursor = (Cursor) 0;
    }

    free(_glfw.x11.clipboardString);

    if (_glfw.x11.im)
    {
        XCloseIM(_glfw.x11.im);
        _glfw.x11.im = NULL;
    }

    if (_glfw.x11.display)
    {
        XCloseDisplay(_glfw.x11.display);
        _glfw.x11.display = NULL;
    }

    // NOTE: This needs to be done after XCloseDisplay, as libGL registers
    //       cleanup callbacks that get called by it
    _glfwTerminateContextAPI();
    _glfwTerminateJoysticks();
}
Beispiel #8
0
void
TkpCloseDisplay(
    TkDisplay *dispPtr)
{
    TkSendCleanup(dispPtr);

    TkFreeXId(dispPtr);

    TkWmCleanup(dispPtr);

#ifdef TK_USE_INPUT_METHODS
    if (dispPtr->inputXfs) {
	XFreeFontSet(dispPtr->display, dispPtr->inputXfs);
    }
    if (dispPtr->inputMethod) {
	XCloseIM(dispPtr->inputMethod);
    }
#endif

    if (dispPtr->display != 0) {
	Tcl_DeleteFileHandler(ConnectionNumber(dispPtr->display));
	(void) XSync(dispPtr->display, False);
	(void) XCloseDisplay(dispPtr->display);
    }
}
Beispiel #9
0
void OS_X11::finalize() {

	if(main_loop)
		memdelete(main_loop);
	main_loop=NULL;

	spatial_sound_server->finish();
	memdelete(spatial_sound_server);
	spatial_sound_2d_server->finish();
	memdelete(spatial_sound_2d_server);

	//if (debugger_connection_console) {
//		memdelete(debugger_connection_console);
//}

#ifdef JOYDEV_ENABLED
	memdelete(joystick);
#endif
	memdelete(input);

	memdelete(sample_manager);

	audio_server->finish();
	memdelete(audio_server);

	visual_server->finish();
	memdelete(visual_server);
	memdelete(rasterizer);

	physics_server->finish();
	memdelete(physics_server);

	physics_2d_server->finish();
	memdelete(physics_2d_server);

	XUnmapWindow( x11_display, x11_window );
	XDestroyWindow( x11_display, x11_window );

#if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED)
	memdelete(context_gl);
#endif
	for(int i=0;i<CURSOR_MAX;i++) {
		if( cursors[i] != None )
			XFreeCursor( x11_display, cursors[i] );
		if( img[i] != NULL )
			XcursorImageDestroy( img[i] );
	};

	XDestroyIC( xic );
	XCloseIM( xim );

	XCloseDisplay(x11_display);
	if (xmbstring)
		memfree(xmbstring);


	args.clear();
}
Beispiel #10
0
void
x_destroy()
{
    debug(".");
    XFreeFontSet(X.dpy, X.font);
    XFreeFontSet(X.dpy, X.bold_font);
    XDestroyIC(X.xic);
    XCloseIM(X.xim);
    XFreePixmap(X.dpy, X.pixmap);
    XFreeGC(X.dpy, X.gc);
    XCloseDisplay(X.dpy);
}
Beispiel #11
0
    static void _cleanX11Package()
    {
        if ( X11Package::ourInputMethod )
        {
            XCloseIM( X11Package::ourInputMethod );
            X11Package::ourInputMethod = 0;
        }

        X11Package::ourRootWindow = 0;
        X11Package::ourScreen = 0;
        XCloseDisplay(  X11Package::ourDisplay );
        X11Package::ourDisplay = 0;
    }
Beispiel #12
0
void _glfwPlatformTerminate(void)
{
    if (_glfw.x11.x11xcb.handle)
    {
        dlclose(_glfw.x11.x11xcb.handle);
        _glfw.x11.x11xcb.handle = NULL;
    }

    if (_glfw.x11.helperWindowHandle)
    {
        if (XGetSelectionOwner(_glfw.x11.display, _glfw.x11.CLIPBOARD) ==
            _glfw.x11.helperWindowHandle)
        {
            _glfwPushSelectionToManagerX11();
        }

        XDestroyWindow(_glfw.x11.display, _glfw.x11.helperWindowHandle);
        _glfw.x11.helperWindowHandle = None;
    }

    if (_glfw.x11.hiddenCursorHandle)
    {
        XFreeCursor(_glfw.x11.display, _glfw.x11.hiddenCursorHandle);
        _glfw.x11.hiddenCursorHandle = (Cursor) 0;
    }

    free(_glfw.x11.clipboardString);

    if (_glfw.x11.im)
    {
        XCloseIM(_glfw.x11.im);
        _glfw.x11.im = NULL;
    }

    _glfwTerminateEGL();

    if (_glfw.x11.display)
    {
        XCloseDisplay(_glfw.x11.display);
        _glfw.x11.display = NULL;
    }

    // NOTE: This needs to be done after XCloseDisplay, as libGL registers
    //       cleanup callbacks that get called by it
    _glfwTerminateGLX();

#if defined(__linux__)
    _glfwTerminateJoysticksLinux();
#endif
    _glfwTerminateThreadLocalStoragePOSIX();
}
Beispiel #13
0
void X11Window::terminate()
{
    if(m_cursor != None) {
        XUndefineCursor(m_display, m_window);
        m_cursor = None;
    }

    if(m_hiddenCursor) {
        XFreeCursor(m_display, m_hiddenCursor);
        m_hiddenCursor = 0;
    }

    for(Cursor cursor : m_cursors)
        XFreeCursor(m_display, cursor);
    m_cursors.clear();

    if(m_window) {
        XDestroyWindow(m_display, m_window);
        m_window = 0;
    }

    if(m_colormap) {
        XFreeColormap(m_display, m_colormap);
        m_colormap = 0;
    }

    internalDestroyGLContext();

    if(m_visual) {
        XFree(m_visual);
        m_visual = 0;
    }

    if(m_xic) {
        XDestroyIC(m_xic);
        m_xic = 0;
    }

    if(m_xim) {
        XCloseIM(m_xim);
        m_xim = 0;
    }

    if(m_display) {
        XCloseDisplay(m_display);
        m_display = 0;
    }

    m_visible = false;
}
Beispiel #14
0
void x11_destroy_input_context(XIM *xim, XIC *xic)
{
   if (*xic)
   {
      XDestroyIC(*xic);
      *xic = NULL;
   }

   if (*xim)
   {
      XCloseIM(*xim);
      *xim = NULL;
   }
}
void
CXWindowsPrimaryScreen::onPreClose()
{
	CDisplayLock display(m_screen);
	if (m_ic != NULL) {
		XDestroyIC(m_ic);
		m_ic = NULL;
	}
	if (m_im != NULL) {
		XCloseIM(m_im);
		m_im = NULL;
	}
	m_lastKeycode = 0;
}
Beispiel #16
0
int _glfwPlatformInit(void)
{
    // HACK: If the current locale is C, apply the environment's locale
    //       This is done because the C locale breaks character input
    if (strcmp(setlocale(LC_CTYPE, NULL), "C") == 0)
        setlocale(LC_CTYPE, "");

    XInitThreads();

    _glfw.x11.display = XOpenDisplay(NULL);
    if (!_glfw.x11.display)
    {
        _glfwInputError(GLFW_PLATFORM_ERROR, "X11: Failed to open X display");
        return GL_FALSE;
    }

    _glfw.x11.screen = DefaultScreen(_glfw.x11.display);
    _glfw.x11.root = RootWindow(_glfw.x11.display, _glfw.x11.screen);
    _glfw.x11.context = XUniqueContext();

    if (!initExtensions())
        return GL_FALSE;

    _glfw.x11.cursor = createNULLCursor();

    if (XSupportsLocale())
    {
        XSetLocaleModifiers("");

        _glfw.x11.im = XOpenIM(_glfw.x11.display, 0, 0, 0);
        if (_glfw.x11.im)
        {
            if (!hasUsableInputMethodStyle())
            {
                XCloseIM(_glfw.x11.im);
                _glfw.x11.im = NULL;
            }
        }
    }

    if (!_glfwInitContextAPI())
        return GL_FALSE;

    if (!_glfwInitJoysticks())
        return GL_FALSE;

    _glfwInitTimer();

    return GL_TRUE;
}
Beispiel #17
0
// will also unmap the window if still displayed
void textbox_free(textbox *tb)
{
	if (tb->flags & TB_EDITABLE)
	{
		XDestroyIC(tb->xic);
		XCloseIM(tb->xim);
	}

	if (tb->text) free(tb->text);
	if (tb->prompt) free(tb->prompt);
	if (tb->font) XftFontClose(display, tb->font);

	XDestroyWindow(display, tb->window);
	free(tb);
}
Beispiel #18
0
////////////////////////////////////////////////////////////
/// Close the display
////////////////////////////////////////////////////////////
void WindowImplX11::CloseDisplay()
{
    // Decrease the number of windows
    ourWindowsCount--;

    // If all windows have been destroyed, then we can close the display
    if (ourWindowsCount == 0)
    {
        // Close the input method object
        if (ourInputMethod)
            XCloseIM(ourInputMethod);

        XCloseDisplay(ourDisplay);
        ourDisplay = NULL;
    }
}
Beispiel #19
0
void DesktopWindowLinux::freeResources()
{
    delete m_eventSource;
    if (m_context)
        destroyGLContext();
    if (m_window)
        XDestroyWindow(m_display, m_window);
    if (m_cursor)
        XFreeCursor(m_display, m_cursor);
    if (m_display)
        XCloseDisplay(m_display);
    if (m_ic)
        XDestroyIC(m_ic);
    if (m_im)
        XCloseIM(m_im);
}
Beispiel #20
0
void destroygui()
{
	XDestroyIC(ic);
	XCloseIM(im);
	while (inputs)
		destroyinput(inputs);
	XFreeGC(dpy, dc.gc);
	XFreePixmap(dpy, dc.drawable);
	XFreeCursor(dpy, cursor);
	if (dc.font.set)
		XFreeFontSet(dpy, dc.font.set);
	else
		XFreeFont(dpy, dc.font.xfont);

	XSync(dpy, False);
}
Beispiel #21
0
void StXDisplay::close() {
    if(hInputCtx != None) {
        XDestroyIC(hInputCtx);
        hInputCtx = None;
    }
    if(hInputMethod != None) {
        XCloseIM(hInputMethod);
        hInputMethod = None;
    }
    if(hDisplay != NULL) {
        XCloseDisplay(hDisplay);
        hDisplay = NULL;
    }
    if(hVisInfo != NULL) {
        XFree(hVisInfo);
        hVisInfo = NULL;
    }
}
Beispiel #22
0
static void
scalefilterFiniDisplay (CompPlugin  *p,
	    		CompDisplay *d)
{
    FILTER_DISPLAY (d);

    UNWRAP (fd, d, handleEvent);
    UNWRAP (fd, d, handleEcompEvent);

    if (fd->xic)
	XDestroyIC (fd->xic);
    if (fd->xim)
	XCloseIM (fd->xim);

    freeScreenPrivateIndex (d, fd->screenPrivateIndex);

    free (fd);
}
Beispiel #23
0
void
X11_VideoQuit(_THIS)
{
    SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;

    if (data->classname) {
        SDL_free(data->classname);
    }
#ifdef X_HAVE_UTF8_STRING
    if (data->im) {
        XCloseIM(data->im);
    }
#endif

    X11_QuitModes(_this);
    X11_QuitKeyboard(_this);
    X11_QuitMouse(_this);
}
Beispiel #24
0
X11InputMethod::~X11InputMethod()
{
	/* I hope it is safe to call this even if we haven't registered
	 * any callbacks.  (If it is also sufficient to call this once to
	 * undo all matching XRegisterIMInstantiateCallback()s, we could
	 * remove the other call to this function.)
	 */
	XUnregisterIMInstantiateCallback(m_display, NULL, NULL, NULL, XIMInstantiateCallback, (XPointer)this);
	while (m_ic_list != 0)
	{
		ICList * ic = m_ic_list;
		ic->ic->InputMethodIsDeleted();
		m_ic_list = ic->next;
		OP_DELETE(ic);
	};
	if(m_xim)
		XCloseIM(m_xim);
}
Beispiel #25
0
void t_keyboard_shutdown(void)
{
	GSList *it;
	XFreeModifiermap(modmap);
	modmap = NULL;
	XFree(keymap);
	keymap = NULL;
	for(it = xic_all; it; it = g_slist_next(it)) {
		struct t_ic *ic = it->data;
		if(ic->xic) {
			XDestroyIC(ic->xic);
			ic->xic = NULL;
		}
	}
	if(xim)
		XCloseIM(xim);
	xim = NULL;
	xim_style = 0;
	started = FALSE;
}
Beispiel #26
0
BrowserControl::~BrowserControl()
{
    delete m_eventSource;

    delete m_backButton;
    delete m_forwardButton;
    delete m_refreshButton;
    delete m_urlBar;
    delete m_toolBar;
    delete m_browserWindow;

    if (m_ic)
        XDestroyIC(m_ic);

    if (m_im)
        XCloseIM(m_im);

    if (m_display)
        XCloseDisplay(m_display);
}
Beispiel #27
0
void ui_cleanup(void)
{
	XDestroyWindow(ui->dpy, ui->w[ui->cur].win);
	XUngrabKeyboard(ui->dpy, CurrentTime);
	XUngrabPointer(ui->dpy, CurrentTime);
	XDestroyIC(ui->w[0].xic);
	XCloseIM(ui->xim);

	if (ui->w[ui->cur].canvas)
		XFreePixmap(ui->dpy, ui->w[ui->cur].canvas);
	if (ui->w[ui->cur].gc)
		XFreeGC(ui->dpy, ui->w[ui->cur].gc);
	if (ui->dpy)
		XCloseDisplay(ui->dpy);

	cairo_destroy(ui->w[ui->cur].c);
	cairo_surface_destroy(ui->w[ui->cur].cs);
	pango_font_description_free(ui->w[ui->cur].pangofont);
	g_object_unref(ui->w[ui->cur].pangolayout);
	xfree(ui);
}
Beispiel #28
0
void xim_init(void)
{
	GSList *it;
	gchar *aname, *aclass;
	aname = g_strdup(g_get_prgname());
	if(!aname)
		aname = g_strdup("obt");
	aclass = g_strdup(aname);
	if(g_ascii_islower(aclass[0]))
		aclass[0] = g_ascii_toupper(aclass[0]);
	xim = XOpenIM(t_display, NULL, aname, aclass);
	if(!xim)
		g_message("Failed to open an Input Method");
	else {
		XIMStyles *xim_styles = NULL;
		char *r;
		r = XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL);
		if(r || !xim_styles)
			g_message("Input Method does not support any styles");
		if(xim_styles) {
			int i;
			for(i = 0; i < xim_styles->count_styles; ++i) {
				if(xim_styles->supported_styles[i] == (XIMPreeditNothing | XIMStatusNothing)) {
					xim_style = xim_styles->supported_styles[i];
					break;
				}
			}
			XFree(xim_styles);
		}
		if(!xim_style) {
			g_message("Input Method does not support a usable style");
			XCloseIM(xim);
			xim = NULL;
		}
	}
	for(it = xic_all; it; it = g_slist_next(it))
		t_keyboard_context_renew(it->data);
	g_free(aclass);
	g_free(aname);
}
Beispiel #29
0
int cvrun(int argc, char ** argv) {
        int attr[] = {
                GLX_RGBA,
                GLX_DOUBLEBUFFER,
                GLX_RED_SIZE, 1,
                GLX_GREEN_SIZE, 1,
                GLX_BLUE_SIZE, 1,
                GLX_DEPTH_SIZE, 1,
                None};
        XVisualInfo * vi;
        g_dpy = XOpenDisplay(0);
        g_xim = XOpenIM(g_dpy, 0, 0, 0);
        cvInject(CVE_INIT, 0, 0);
        openwin(cvInject(CVQ_XPOS, 0, 0),
                cvInject(CVQ_YPOS, 0, 0),
                cvInject(CVQ_WIDTH, 0, 0),
                cvInject(CVQ_HEIGHT, 0, 0), 1);
        vi = glXChooseVisual(g_dpy, scr(), attr);
        g_ctx = glXCreateContext(g_dpy, vi, 0, True);
        XFree(vi);

        map();
        ((int(*)(int))glXGetProcAddress((GLubyte*)"glXSwapIntervalSGI"))(1);
        cvInject(CVE_GLINIT, 0, 0);
        while (!g_done) {
                XEvent e;
                if (XCheckWindowEvent(g_dpy, g_win, EVMASK, &e)
                    || XCheckTypedWindowEvent(g_dpy, g_win, ClientMessage, &e))
                        handle(g_dpy, g_win, g_xic, &e);
                glXSwapBuffers(g_dpy, g_win);
                cvInject(CVE_UPDATE, 0, 0);
        }
        cvInject(CVE_GLTERM, 0, 0);
                closewin();
                glXDestroyContext(g_dpy, g_ctx);
        XCloseIM(g_xim);
        XCloseDisplay(g_dpy);
        return cvInject(CVE_TERM, 0, 0);
}
Beispiel #30
0
/* x_keyboard_exit
 *  Shut down the X11 keyboard driver.
 */
static void x_keyboard_exit(void)
{
    if (!xkeyboard_installed)
        return;
    xkeyboard_installed = 0;

    ALLEGRO_SYSTEM_XGLX *s = (void *)al_get_system_driver();

    _al_mutex_lock(&s->lock);

#ifdef ALLEGRO_XWINDOWS_WITH_XIM

    if (xic) {
        XDestroyIC(xic);
        xic = NULL;
    }

    if (xim) {
        XCloseIM(xim);
        xim = NULL;
    }

#endif

    if (xmodmap) {
        XFreeModifiermap(xmodmap);
        xmodmap = NULL;
    }

    if (keysyms) {
        XFree(keysyms);
        keysyms = NULL;
    }

    _al_mutex_unlock(&s->lock);
}