本文整理汇总了C++中WindowInfo::char_callback方法的典型用法代码示例。如果您正苦于以下问题:C++ WindowInfo::char_callback方法的具体用法?C++ WindowInfo::char_callback怎么用?C++ WindowInfo::char_callback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WindowInfo
的用法示例。
在下文中一共展示了WindowInfo::char_callback方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: process_event
static int process_event(XEvent* event) {
KeySym sym;
WindowInfo* info = find_handle(event->xany.window);
if (!info)
return 1;
if (event->type == ClientMessage) {
if ((Atom)event->xclient.data.l[0] == s_wm_delete_window) {
info->update = 0;
mfb_close(info);
return 0;
}
}
switch (event->type)
{
case KeyPress:
{
sym = XLookupKeysym(&event->xkey, 0);
if (handle_special_keys(info, event, 1))
break;
if (info->key_callback)
info->key_callback(info->rust_data, sym, 1);
if (info->char_callback) {
unsigned int t = keySym2Unicode(sym);
if (t != -1)
info->char_callback(info->rust_data, t);
}
break;
}
case KeyRelease:
{
if (handle_special_keys(info, event, 0))
break;
sym = XLookupKeysym(&event->xkey, 0);
if (info->key_callback)
info->key_callback(info->rust_data, sym, 0);
break;
}
case ButtonPress:
{
if (!info->shared_data)
break;
if (event->xbutton.button == Button1)
info->shared_data->state[0] = 1;
else if (event->xbutton.button == Button2)
info->shared_data->state[1] = 1;
else if (event->xbutton.button == Button3)
info->shared_data->state[2] = 1;
else if (event->xbutton.button == Button4)
info->shared_data->scroll_y = 10.0f;
else if (event->xbutton.button == Button5)
info->shared_data->scroll_y = -10.0f;
else if (event->xbutton.button == Button6)
info->shared_data->scroll_x = 10.0f;
else if (event->xbutton.button == Button7)
info->shared_data->scroll_y = -10.0f;
break;
}
case ButtonRelease:
{
if (!info->shared_data)
break;
if (event->xbutton.button == Button1)
info->shared_data->state[0] = 0;
else if (event->xbutton.button == Button2)
info->shared_data->state[1] = 0;
else if (event->xbutton.button == Button3)
info->shared_data->state[2] = 0;
break;
}
case ConfigureNotify:
{
info->width = event->xconfigure.width;
info->height = event->xconfigure.height;
break;
}
}
return 1;
}