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
Support the author Donate

Comments

Only authorized users can post comments.
Please, Log in or Sign up
N
June 25, 2019, 2:41 p.m.
Nico03

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

  • Result:40points,
  • Rating points-8
S
June 25, 2019, 9:16 a.m.
SabaNtuy

C ++ - Test 004. Pointers, Arrays and Loops

  • Result:40points,
  • Rating points-8
SZ
June 24, 2019, 5:49 p.m.
Serg Zhi

C++ - Тест 003. Условия и циклы

  • Result:78points,
  • Rating points2
Last comments
June 24, 2019, 10:23 a.m.
Евгений Легоцкой

Хорошо, ну будут проблемы помимо того, что касается статей, то не стесняйтесь задавать вопросы на форуме.
МБ
June 24, 2019, 10:21 a.m.
Михаил Булатов

Извиняюсь, все работает(из-за невнимательности).
June 24, 2019, 9:52 a.m.
Евгений Легоцкой

Придётся делать ещё сигнал в дочернем qml и пробрасывать через коннекты и обработчики. А вообще нужно смотреть конкретный код и что вы пытаетесь сделать. Так что лучше будет, если вы зад...
June 21, 2019, 8:31 a.m.
Ruslan Polupan

Вот моя строка по которой все отлично сработало %cqtdeployer% -bin c:/CentralMposKeys/CentalMposKeys.exe -qmake c:/Qt/5.12.2/mingw73_64/bin/qmake.exe
June 21, 2019, 8:24 a.m.
Андрей Янкович

Возможно кому то пригодится сqtdeployer для windows работает точно так же как и для Linux разница лишь в команде запуска Linux: cqtdeployer Windows: %cqtdeployer...
Now discuss on the forum
June 26, 2019, 6:10 p.m.
Евгений Легоцкой

Попробуйте включить все триггеры редактирования у TableView, а потом уже немного поиграться с ними, если заработает. tableView->setEditTriggers(QAbstractItemView::AllEditTriggers);
June 26, 2019, 4:22 p.m.
Михаиллл

Похоже никак и нужно использовать вебвью
June 26, 2019, 4:13 p.m.
Михаиллл

Таке попробовал сделать так, но не работает вы вырубается при загрузкею.Может быть вы знаете, как это можно исправить? //import QtWebEngine 1.9import QtWebView 1.13Item { width: 4...
June 26, 2019, 7:55 a.m.
Михаиллл

Пробовал перезапускать qmake, удалять папку билд. Не помогало. Потом перезапустил сам Qt, и помогло. Жутко глючит. Сейчас опять сталкиваюсь с подобными багами.
June 26, 2019, 7:07 a.m.
Евгений Легоцкой

Да, работает. Но это решение подходит в основном для отоюражения статической информацию, которая не меняется. А TableView или ListView позволяют работать с моделями данных и редактировать их, ...
Looking for a Job?
10,000.00 руб. - 15,000.00 руб.
Нужен помощник для создания API.
Moscow, Moscow, Russia
25,000.00 руб. - 30,000.00 руб.
Разработчик Qt/C++
Barnaul, Altai Krai, Russia

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

EVILEG
About
Services
Join us
© EVILEG 2015-2019
Recommend hosting TIMEWEB