五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

(五)GTK4 鍵盤鼠標(biāo)事件

2023-04-09 12:27 作者:FineClassFuture  | 我要投稿

????GTK的教程就是gtk-demo,說明文檔就是API文檔https://docs.gtk.org/gtk4

????gtk4-demo中原本應(yīng)該看例子drawing area,但是這繪制效果......看了下,只是drawing area的事件,沒有參考意義。

????gtk4-demo中print例子還是drawing?area只能選顏色,但沒有任何繪制效果,失敗的例子?

????gtk4-demo中有g(shù)estures,看了下翻譯是手勢,還是drawing?area。

????

????進(jìn)入文檔主頁?https://docs.gtk.org/gtk4/,看到有個(gè)“Overview of GTK input and event handling”

????Inside?GTK, every such input device is represented by a?GdkDevice?object.

????使用GdkDevice來表示輸入設(shè)備

????有這么一張圖

Event controllers and gestures

Event controllers are standalone objects that can perform specific actions upon received?GdkEvents. These are tied to a widget, and can be told of the event propagation phase at which they will manage the?events.

Gestures are a set of specific controllers that are prepared to handle pointer and/or touch events, each gesture implementation attempts to recognize specific actions out the received events, notifying of the state/progress accordingly to let the widget react to those. On multi-touch gestures, every interacting touch sequence will be tracked?independently.

Since gestures are “simple” units, it is not uncommon to tie several together to perform higher level actions, grouped gestures handle the same event sequences simultaneously, and those sequences share a same state across all grouped gestures. Some examples of grouping may?be:

  • A “drag” and a “swipe” gestures may want grouping. The former will report events as the dragging happens, the latter will tell the swipe X/Y velocities only after recognition has?finished.

  • Grouping a “drag” gesture with a “pan” gesture will only effectively allow dragging in the panning orientation, as both gestures share?state.

  • If “press” and “l(fā)ong press” are wanted simultaneously, those would need?grouping.

Shortcuts are handled by?GtkShortcutController, which is a complex event handler that can either activate shortcuts itself, or propagate them to another controller, depending on its?scope.


????在github上找到個(gè)例子,是個(gè)小游戲

????https://github.com/lavalfils/poc_gtk4_2D_action_game

瞬間回到小時(shí)候了

????看看如何捕捉鍵盤事件

// --- add keyboard callback ---

GtkEventController *keyboard = gtk_event_controller_key_new();

gtk_widget_add_controller(window, keyboard);

g_signal_connect(keyboard, "key-pressed", G_CALLBACK(key_pressed), window);

g_signal_connect(keyboard, "key-released", G_CALLBACK(key_released), window);


這樣就可以在文檔里搜索了

GTK另一個(gè)麻煩(煩人)的地方,小版本更改中也會(huì)把一些API/參數(shù)更改掉



現(xiàn)在還有 鼠標(biāo)按鍵事件 怎么獲???

(五)GTK4 鍵盤鼠標(biāo)事件的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國家法律
湖州市| 阜阳市| 毕节市| 芦山县| 安国市| 湟中县| 五河县| 卢湾区| 泰兴市| 株洲县| 鄂尔多斯市| 垣曲县| 南郑县| 北安市| 太和县| 景洪市| 灌阳县| 迁西县| 澎湖县| 蒙城县| 台东县| 五莲县| 固原市| 青龙| 普兰县| 田东县| 乐平市| 老河口市| 芦山县| 武川县| 平江县| 施秉县| 淮滨县| 禄劝| 北宁市| 林周县| 克山县| 衡南县| 黄平县| 浦江县| 塔河县|