File: qinputcontexthangul_x11.cpp

package info (click to toggle)
qimhangul 0.2.0-5
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 1,508 kB
  • ctags: 221
  • sloc: sh: 10,860; cpp: 648; makefile: 40
file content (33 lines) | stat: -rw-r--r-- 777 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <ctype.h>

#include <QWidget>
#include <QX11Info>

#include "hangul.h"
#include "qinputcontexthangul.h"

#include <X11/Xlib.h>

void QInputContextHangul::setModeInfo(int mode)
{
    Display* display = NULL;
    int screen = 0;

    QWidget* focus = focusWidget();
    if (focus != NULL) {
	display = focus->x11Info().display();
	screen = focus->x11Info().appScreen();
    }

    if (display != NULL) {
	long data = mode;
	Window window = RootWindow(display, screen);
	Atom status = XInternAtom(display, "_HANGUL_INPUT_MODE", False);
	Atom type = XInternAtom(display, "INTEGER", False);

	if (window != None && status != None && type != None) {
	    XChangeProperty(display, window, status, type,
		    32, PropModeReplace, (const unsigned char *)&data, 1);
	}
    }
}