Privacy policyContactsAbout siteOpinionsGitHubDonate
© EVILEG 2015-2018
Recommend hosting
TIMEWEB

XGrabKey

HotKey, linux, X11, XGrabKey

Syntax

XGrabKey(display, keycode, modifiers, grab_window, owner_events, pointer_mode, keyboard_mode)
      Display *    display;
      int          keycode;
      unsigned int modifiers;
      Window       grab_window;
      Bool         owner_events;
      int          pointer_mode, keyboard_mode;

Arguments

display	        // Specifies the connection to the X server.
keycode	        // Specifies the KeyCode or AnyKey.
modifiers       // Specifies the set of keymasks or AnyModifier. 
                // The mask is the bitwise inclusive OR of the valid keymask bits.
grab_window     // Specifies the grab window.
owner_events    // Specifies a Boolean value that indicates whether the keyboard events 
                // are to be reported as usual.
pointer_mode    // Specifies further processing of pointer events. 
                // You can pass GrabModeSync or GrabModeAsync.
keyboard_mode	// Specifies further processing of keyboard events. 
                // You can pass GrabModeSync or GrabModeAsync.

Description

The XGrabKey() function establishes a passive grab on the keyboard. In the future, the keyboard is actively grabbed (as for XGrabKeyboard() ), the last-keyboard-grab time is set to the time at which the key was pressed (as transmitted in the KeyPress event), and the KeyPress event is reported if all of the following conditions are true:

  • The keyboard is not grabbed and the specified key (which can itself be a modifier key) is logically pressed when the specified modifier keys are logically down, and no other modifier keys are logically down.
  • Either the grab_window is an ancestor of (or is) the focus window, or the grab_window is a descendant of the focus window and contains the pointer.
  • A passive grab on the same key combination does not exist on any ancestor of grab_window.

The interpretation of the remaining arguments is as for XGrabKeyboard() . The active grab is terminated automatically when the logical state of the keyboard has the specified key released (independent of the logical state of the modifier keys).

Note that the logical state of a device (as seen by client applications) may lag the physical state if device event processing is frozen.

A modifiers argument of AnyModifier is equivalent to issuing the request for all possible modifier combinations (including the combination of no modifiers). It is not required that all modifiers specified have currently assigned KeyCodes. A keycode argument of AnyKey is equivalent to issuing the request for all possible KeyCodes. Otherwise, the specified keycode must be in the range specified by min_keycode and max_keycode in the connection setup, or a BadValue error results.

If some other client has issued a XGrabKey() with the same key combination on the same window, a BadAccess error results. When using AnyModifier or AnyKey , the request fails completely, and a BadAccess error results (no grabs are established) if there is a conflicting grab for any combination.

XGrabKey() can generate BadAccess , BadValue , and BadWindow errors.

Diagnostics

BadAccess - A client attempted to free a color map entry that it did not already allocate.

BadAccess - A client attempted to store into a read-only color map entry.

BadValue - Some numeric value falls outside the range of values accepted by the request. Unless a specific range is specified for an argument, the full range defined by the argument's type is accepted. Any argument defined as a set of alternatives can generate this error.

BadWindow - A value for a Window argument does not name a defined Window.

See also XUngrabKey()

Virtual hosting with 10 percent discount
Virtual hosting with 10 percent discount
EVILEG offers reliable hosting with a 10% discount for virtual hosting and 5% for VPS

Comments

Only authorized users can post comments.
Please, Log in or Sign up
N
March 23, 2019, 7:52 a.m.
Nico03

C++ - Test 001. The first program and data types

  • Result:80points,
  • Rating points4
Y
March 22, 2019, 9:39 a.m.
Yavlados

Qt - Test 001. Signals and slots

  • Result:21points,
  • Rating points-10
Last comments
March 22, 2019, 12:32 p.m.
Евгений Легоцкой

Ну может бибилотеки не те положили? У вас сборка для MinGW, а либы для MSVC.
ВН
March 22, 2019, 11:08 a.m.
Волчонок Над-Пропастью

Из кьюта приложение не хочет запускаться, аварийно завершается, но каких-либо ошибок не выдаёт. Оно открывается, после нажатия "старт" зависает и завершается. Если не из кьюта запускать дебаг ...
March 21, 2019, 3:49 p.m.
Евгений Легоцкой

серьезно? Эта ошибка 404 уже даже не относится к данному вопросу. В каких-то urls в вашем проекте. Вопросы, которые не относятся непосредственно к статье, задавайте, пожалуйста на...
АБ
March 21, 2019, 3 p.m.
Артем Бел

а это где? сейчас ошибка в debag такая: Page not found (404)Request Method: GETRequest URL: http://amadowshop.site/accounts/profile/
March 21, 2019, 12:47 p.m.
Евгений Легоцкой

не вижу здесь проблемы, поменяйте url для callback в приложения oauth в социальных сетях https://amadowshop.site/auth/verify/complete/facebook/
Now discuss on the forum
m
March 22, 2019, 7:40 p.m.
monevich

int main(int argc, char *argv[]){ QApplication a(argc, argv); MainWindow w; w.show(); if (argc==2) { w.openFile(argv[1]); } return a.exec();} Допустим...
March 22, 2019, 12:29 p.m.
Дмитрий

Да, мьютекс добавил, но в том потоке, где сигнал вызывается.
ВН
March 22, 2019, 9:04 a.m.
Волчонок Над-Пропастью

Да, на эту проблему! Зато у меня теперь новая, ругается на подключение QMediaPlayer, пишет, что не находит подобного файла или библиотеки. Пока не нашла как исправить, только вариант с переуст...
March 22, 2019, 8:58 a.m.
Михаиллл

4) это , похоже, для создания видоизмененных страниц, для анимации. 3,5) добавить фвйл/qt/ui.qml
March 22, 2019, 8:04 a.m.
Евгений Легоцкой

Привет. Если там std::vector , то наверное можно заранее подготовить вектор с необходимым количеством элементов и просто устанавливать значение по индексу элемента. Но в данном слу...
Join us in social networks

For registered users on the site there is a minimum amount of advertising