void Gesture::set_mouse_button( unsigned int button_P ) { if( button == button_P ) return; if( !_enabled ) { button = button_P; return; } grab_mouse( false ); button = button_P; grab_mouse( true ); }
vbutton * buttonmenu_no_backdrop(button * buttons, Sint32 numbuttons, Sint32 redraw) { Sint32 i; for (i=1; i < MAX_BUTTONS; i++) // skip # 0! { if (allbuttons[i]) delete allbuttons[i]; allbuttons[i] = NULL; } for (i=0; i < numbuttons; i++) { allbuttons[i] = new vbutton(buttons[i].x,buttons[i].y, buttons[i].sizex, buttons[i].sizey, buttons[i].myfun, buttons[i].arg1, buttons[i].label, buttons[i].hotkey); myscreen->draw_box(allbuttons[i]->xloc-1, allbuttons[i]->yloc-1, allbuttons[i]->xend, allbuttons[i]->yend, 0, 0, 1); } release_mouse(); //if (redraw) // myscreen->buffer_to_screen(0, 0, 320, 200); grab_mouse(); return allbuttons[0]; }
void Gesture::update_grab() { if( _enabled && handlers.count() > 0 && ( exclude == NULL || !exclude->match( Window_data( windows_handler->active_window())))) { kapp->removeX11EventFilter( this ); // avoid being installed twice kapp->installX11EventFilter( this ); // CHECKME at se grabuje jen kdyz je alespon jedno gesto? grab_mouse( true ); } else { grab_mouse( false ); kapp->removeX11EventFilter( this ); } }
static void sorter(const char *cmd) { int i, j, n, nn = show->cur, grid, pn = -1; grid = (int) ceil(sqrt(show->nslides)); cairo_surface_t *t = cairo_image_surface_create(0, show->w, show->h); cairo_t *ctx = cairo_create(t); cairo_scale(ctx, MARGIN/(float)grid, MARGIN/(float)grid); cairo_translate(ctx, (show->w * (1-MARGIN))/2.0, (show->w * (1-MARGIN))/2.0); grab_mouse(); XEvent ev; XDefineCursor(dpy, wshow, None); while (True) { if (nn != pn) { pn = nn; cairo_set_source_rgba(ctx, 0, 0, 0, 1); cairo_paint(ctx); for (j = 0; j < grid; j++) for (i = 0; i < grid; i++) { if ( (n=j * grid + i) >= show->nslides ) break; cairo_set_source_surface(ctx, show->slide[n], (show->w * i)/MARGIN, (show->h * j)/MARGIN); cairo_paint_with_alpha(ctx,(n == nn ? 1.0 : 0.5)); } cairo_set_source_surface(show->target[0].ctx, t, 0, 0); cairo_paint(show->target[0].ctx); XFlush(dpy); } XMaskEvent(dpy,PointerMotionMask|ButtonPressMask|KeyPressMask,&ev); if (ev.type == KeyPress) { switch (XkbKeycodeToKeysym(dpy, ev.xkey.keycode, 0, 0)) { case 'h': case XK_Right: nn++; break; case 'j': case XK_Down: nn += grid; break; case 'k': case XK_Up: nn -= grid; break; case 'l': case XK_Left: nn--; break; case XK_space: case XK_Return: goto full_break_change; break; default: goto full_break_no_change; } if (nn < 0) nn = 0; else if (nn >= show->nslides) nn = show->nslides - 1; } else if (ev.type == ButtonPress) { if (ev.xbutton.button == 1) break; else if (ev.xbutton.button == 2) goto full_break_no_change; else if (ev.xbutton.button == 3) goto full_break_no_change; } else if (ev.type == MotionNotify) { nn = (ev.xbutton.y * grid / show->h) * grid + (ev.xbutton.x * grid / show->w); } } full_break_change: show->cur = nn; full_break_no_change: XUngrabKeyboard(dpy, CurrentTime); XUngrabPointer(dpy, CurrentTime); cairo_destroy(ctx); cairo_surface_destroy(t); XDefineCursor(dpy, wshow, invisible_cursor); draw(None); }
void Gesture::update_grab() { kDebug() << "Enabled:" << _enabled; kDebug() << "Handler:" << handlers.count(); kDebug() << "Exclude:" << exclude << " Match? " << (exclude && exclude->match( Window_data( windows_handler->active_window()))); if( _enabled && handlers.count() > 0 && ( exclude == NULL || !exclude->match( Window_data( windows_handler->active_window())))) { kapp->removeX11EventFilter( this ); // avoid being installed twice kapp->installX11EventFilter( this ); // CHECKME grab only when there's at least one gesture? grab_mouse( true ); } else { grab_mouse( false ); kapp->removeX11EventFilter( this ); } }
void vbutton::vdisplay(Sint32 status) { if(hidden || no_draw) return; if (!status) // do normal { vdisplay(); return; } text& mytext = myscreen->text_normal; if (mypixie) // then use the graphic { mypixie->draw(xloc, yloc, myscreen->viewob[0]); if (label.size()) mytext.write_xy( (short) ( ((xloc+xend)/2) - (((label.size()-1)* (mytext.letters.w+1) )/2)) , (short) (yloc + (height-(mytext.letters.h))/2), label.c_str(), (unsigned char) DARK_BLUE, 1); } else { if (status == 1) { myscreen->draw_box(xloc,yloc,xend-1,yend-1,BUTTON_FACING-3,1,1); // front myscreen->draw_box(xloc,yloc,xend-2,yloc,BUTTON_BOTTOM,1,1); // top edge myscreen->draw_box(xloc,yloc+1,xloc,yend-2,BUTTON_RIGHT,1,1); // left myscreen->draw_box(xend-1,yloc+1,xend-1,yend-2,BUTTON_LEFT,1,1); // right myscreen->draw_box(xloc+1,yend-1,xend-1,yend-1,BUTTON_TOP,1,1); // bottom if (label.size()) mytext.write_xy( (short) ( ((xloc+xend)/2) - (((label.size()-1)* (mytext.letters.w+1) )/2)) , (short) (yloc + (height-(mytext.letters.h))/2), label.c_str(), (unsigned char) DARK_BLUE, 1); myscreen->buffer_to_screen(xloc,yloc,xend-xloc,yend-yloc); } else if (status == 2) // special (red) button.. { myscreen->draw_box(xloc,yloc,xend-1,yend-1,BUTTON_FACING+32,1,1); // front myscreen->draw_box(xloc,yloc,xend-2,yloc,BUTTON_TOP+32,1,1); // top edge myscreen->draw_box(xloc,yloc+1,xloc,yend-2,BUTTON_LEFT+32,1,1); // left myscreen->draw_box(xend-1,yloc+1,xend-1,yend-2,BUTTON_RIGHT+32,1,1); // right myscreen->draw_box(xloc+1,yend-1,xend-1,yend-1,BUTTON_BOTTOM+32,1,1); // bottom if (label.size()) mytext.write_xy( (short) ( ((xloc+xend)/2) - (((label.size()-1)* (mytext.letters.w+1) )/2)) , (short) (yloc + (height-(mytext.letters.h))/2), label.c_str(), (unsigned char) DARK_BLUE, 1); } } release_mouse(); //buffers: myscreen->buffer_to_screen(0, 0, 320, 200); // Zardus: following isn't really needed and it messes up the fading //myscreen->buffer_to_screen(xloc,yloc,xend-xloc,yend-yloc); grab_mouse(); }
void C4Window::GrabMouse(bool grab) { if (grab) { // Don't grab the mouse while the game window isn't focused. if (Application.Active) grab_mouse(GTK_WIDGET(window)); mouse_was_grabbed = true; } else { ungrab_mouse(); mouse_was_grabbed = false; } }
//after this point old code void clearmenu(button *buttons, short numbuttons) { short i; // First remove the mouse .. release_mouse(); for (i=0; i < numbuttons; i++) { myscreen->fastbox(buttons[i].x-1, buttons[i].y-1, buttons[i].sizex+3, buttons[i].sizey+3, 0, 1); } // Clear the WHOLE screen //myscreen->clearbuffer(); //commented out temporarily to see if ok // DARK_BLUEisplay the mouse grab_mouse(); }
static void pens(const char *cmd) { cairo_surface_t *buf, *cbuf, *t; cairo_t *ctx; char str[CURSOR_STRING_MAX]; Theme q; sscanf(cmd, "%*s %lf %lf %lf %lf %lf %s\n", &q.R, &q.G, &q.B, &q.A, &q.e, str); XWarpPointer(dpy, None, wshow, 0, 0, 0, 0, sw/2, sh/2); /* create duplicate buffers */ t = cairo_xlib_surface_create(dpy, wshow, vis, sw, sh); buf = cairo_surface_create_similar(t, CAIRO_CONTENT_COLOR, sw, sh); cbuf = cairo_surface_create_similar(t, CAIRO_CONTENT_COLOR, sw, sh); ctx = cairo_create(cbuf); cairo_set_source_surface(ctx, t, 0, 0); cairo_paint(ctx); cairo_destroy(ctx); ctx = cairo_create(buf); cairo_set_source_surface(ctx, t, 0, 0); cairo_paint(ctx); cairo_surface_destroy(t); /* set drawing parameters */ cairo_set_line_join(ctx, CAIRO_LINE_JOIN_ROUND); cairo_set_line_cap(ctx, CAIRO_LINE_CAP_ROUND); cairo_set_source_rgba(ctx, q.R, q.G, q.B, q.A); cairo_set_line_width(ctx, q.e); // set font cairo_set_font_size(ctx, q.e); grab_mouse(); /* call appropriate sub function */ cairo_move_to(ctx, sw/2, sh/2); if (strncasecmp(cmd,"pen",3)==0) pen(ctx, buf, cbuf, &q); else if (strncasecmp(cmd,"dot",3)==0) dot(ctx, buf, cbuf, &q); else if (strncasecmp(cmd,"cust",4)==0) custom(ctx, buf, cbuf, &q, str); else if (strncasecmp(cmd,"zoom",4)==0) zoom(ctx, buf, cbuf, &q); /* clean up */ XUngrabPointer(dpy, CurrentTime); cairo_surface_destroy(buf); cairo_surface_destroy(cbuf); cairo_destroy(ctx); XDefineCursor(dpy, wshow, invisible_cursor); }
static gboolean grab_mouse_fn(gpointer user_data) { // Grabbing may not be possible immediately after focusing the window, so // try again if we don't succeed. return !grab_mouse((GtkWidget*) user_data); }
bool Config::maySwitchToAnotherMenu() { if (lp_CONFIG->quickstart) { if (time_out || pArea->get_state("config_confirm.b_cancel_changes" ) || key[KEY_ESC]) { I_Msg( TA3D::TA3D_IM_GUI_MSG, "config_confirm.hide"); TA3D::Settings::Restore(TA3D::Paths::ConfigFile); TA3D::Settings::Load(); save = false; lp_CONFIG->quickstart = false; lp_CONFIG->quickrestart = true; lp_CONFIG->restorestart = true; *saved_config = *lp_CONFIG; return true; } else if (pArea->get_state("config_confirm.b_confirm")) { I_Msg( TA3D::TA3D_IM_GUI_MSG, "config_confirm.hide"); lp_CONFIG->quickstart = false; saved_config->quickstart = false; TA3D::Settings::Save(); // Keep settings :) } } if (pArea->get_state( "*.b_activate")) { Gui::GUIOBJ::Ptr obj = pArea->get_object("*.l_files"); if (obj && obj->Text.size() > obj->Pos) { sound_manager->setPlayListFileMode( obj->Pos, false, false); obj->Text[ obj->Pos ][ 1 ] = '*'; } } if (pArea->get_state( "*.b_deactivate")) { Gui::GUIOBJ::Ptr obj = pArea->get_object("*.l_files"); if (obj && obj->Text.size() > obj->Pos) { sound_manager->setPlayListFileMode( obj->Pos, false, true); obj->Text[ obj->Pos ][ 1 ] = ' '; } } if (pArea->get_state( "*.b_battle" ) ) { Gui::GUIOBJ::Ptr obj = pArea->get_object("*.l_files"); if (obj && obj->Text.size() > obj->Pos) { sound_manager->setPlayListFileMode(obj->Pos, true, false); obj->Text[ obj->Pos ][1] = 'B'; } } if (pArea->get_state("*.b_ok")) { save = true; return true; // On "OK", leave the menu } if (pArea->get_state( "*.b_cancel" ) ) // On "cancel", leave return true; lp_CONFIG->showfps = pArea->get_state( "*.showfps"); if (pArea->get_value("*.fps_limit") >= 0) { Gui::GUIOBJ::Ptr obj = pArea->get_object("*.fps_limit"); if (obj && obj->Data != uint32(-1)) { obj->Text[0] = fps_limits[obj->Value]; switch (obj->Value) { case 0: lp_CONFIG->fps_limit = 50; break; case 1: lp_CONFIG->fps_limit = 60; break; case 2: lp_CONFIG->fps_limit = 70; break; case 3: lp_CONFIG->fps_limit = 80; break; case 4: lp_CONFIG->fps_limit = 90; break; case 5: lp_CONFIG->fps_limit = 100; break; default: lp_CONFIG->fps_limit = -1; } } } if (lp_CONFIG->grab_inputs != pArea->get_state("*.grab_inputs")) { lp_CONFIG->grab_inputs = pArea->get_state("*.grab_inputs"); grab_mouse(lp_CONFIG->grab_inputs); } if (lp_CONFIG->sound_volume != pArea->get_value("*.sound_volume")) { lp_CONFIG->sound_volume = pArea->get_value("*.sound_volume"); sound_manager->setVolume(lp_CONFIG->sound_volume); } if (lp_CONFIG->music_volume != pArea->get_value("*.music_volume")) { lp_CONFIG->music_volume = pArea->get_value("*.music_volume"); sound_manager->setMusicVolume(lp_CONFIG->music_volume); } lp_CONFIG->unitTextureQuality = pArea->get_value("*.texture_quality"); lp_CONFIG->menuTransparency = float(pArea->get_value("*.interface_transparency")) / 255.0f; lp_CONFIG->shadowmap_size = uint8(pArea->get_value("*.shadow_map_size")); lp_CONFIG->far_sight = pArea->get_state("*.far_sight"); lp_CONFIG->anisotropy = sint16(pArea->get_value("*.anisotropy")); lp_CONFIG->mouse_sensivity = float(pArea->get_value("*.mouse_sensitivity")) * 0.01f; lp_CONFIG->ortho_camera = pArea->get_state("*.disable_perspective"); lp_CONFIG->right_click_interface = pArea->get_state("*.right_click_interface"); lp_CONFIG->disable_GLSL = pArea->get_state("*.disable_GLSL"); lp_CONFIG->underwater_bright = pArea->get_state("*.underwater_bright"); lp_CONFIG->use_texture_compression = pArea->get_state("*.use_texture_compression"); lp_CONFIG->low_definition_map = pArea->get_state("*.low_definition_map"); lp_CONFIG->render_sky = pArea->get_state( "*.sky"); lp_CONFIG->particle = pArea->get_state( "*.particle"); lp_CONFIG->explosion_particles = pArea->get_state( "*.explosion_particles"); lp_CONFIG->waves = pArea->get_state( "*.waves"); lp_CONFIG->height_line = pArea->get_state( "*.height_line"); lp_CONFIG->detail_tex = pArea->get_state( "*.detail_tex"); lp_CONFIG->draw_console_loading = pArea->get_state( "*.draw_console_loading"); lp_CONFIG->fullscreen = pArea->get_state( "*.fullscreen"); lp_CONFIG->use_texture_cache = pArea->get_state( "*.use_texture_cache"); lp_CONFIG->developerMode = pArea->get_state("*.developer_mode"); lp_CONFIG->tooltips = pArea->get_state("*.tool_tips"); if (pArea->get_value( "*.camera_zoom" ) >= 0) { Gui::GUIOBJ::Ptr obj = pArea->get_object( "*.camera_zoom"); if (obj && obj->Value >= -1) { obj->Text[0] = obj->Text[1 + obj->Value]; lp_CONFIG->camera_zoom = uint8(obj->Value); } } if (pArea->get_value( "*.camera_def_angle" ) >= 0) { Gui::GUIOBJ::Ptr obj = pArea->get_object( "*.camera_def_angle"); if (obj && obj->Value >= 0) { obj->Text[0] = obj->Text[ 1 + obj->Value ]; lp_CONFIG->camera_def_angle = obj->Text[0].to<float>(); } } if (pArea->get_value( "*.camera_def_h" ) >= 0) { Gui::GUIOBJ::Ptr obj = pArea->get_object( "*.camera_def_h"); if (obj && obj->Value >= 0) { obj->Text[0] = obj->Text[1 + obj->Value]; lp_CONFIG->camera_def_h = obj->Text[0].to<float>(); } } if (pArea->get_value( "*.camera_zoom_speed" ) >= 0) { Gui::GUIOBJ::Ptr obj = pArea->get_object( "*.camera_zoom_speed"); if (obj && obj->Value >= 0) { obj->Text[0] = obj->Text[ 1 + obj->Value ]; lp_CONFIG->camera_zoom_speed = obj->Text[0].to<float>(); } } if (pArea->get_value( "*.LANG" ) >= 0) { Gui::GUIOBJ::Ptr obj = pArea->get_object( "*.LANG"); if (obj && obj->Value != -1) { obj->Text[0] = obj->Text[1 + obj->Value]; lp_CONFIG->Lang = languageList[obj->Value].englishCaption(); } } if (pArea->get_value("*.screenres") >= 0) { Gui::GUIOBJ::Ptr obj = pArea->get_object( "*.screenres"); if (obj && obj->Value != -1) { obj->Text[0] = obj->Text[ 1 + obj->Value ]; lp_CONFIG->screen_width = uint16(res_width[ obj->Value ]); lp_CONFIG->screen_height = uint16(res_height[ obj->Value ]); lp_CONFIG->color_depth = uint8(res_bpp[ obj->Value ]); } } if (pArea->get_value("*.shadow_quality") >= 0) { Gui::GUIOBJ::Ptr obj = pArea->get_object("*.shadow_quality"); if (obj && obj->Value != -1) { obj->Text[0] = obj->Text[1 + obj->Value]; lp_CONFIG->shadow_quality = sint16(obj->Value); } } if (pArea->get_value("*.timefactor") >= 0) { Gui::GUIOBJ::Ptr obj = pArea->get_object( "*.timefactor"); if (obj && obj->Value != -1) { obj->Text[0] = obj->Text[ 1 + obj->Value ]; lp_CONFIG->timefactor = float(obj->Value + 1); } } if (pArea->get_value( "*.fsaa" ) >= 0) { Gui::GUIOBJ::Ptr obj = pArea->get_object( "*.fsaa"); if (obj && obj->Value != -1) { obj->Text[0] = obj->Text[ 1 + obj->Value ]; lp_CONFIG->fsaa = sint16(obj->Value << 1); } } if (pArea->get_value("*.water_quality") >= 0) { Gui::GUIOBJ::Ptr obj = pArea->get_object("*.water_quality"); if (obj && obj->Value != -1) { obj->Text[0] = obj->Text[ 1 + obj->Value ]; lp_CONFIG->water_quality = sint16(obj->Value); } } if (pArea->get_value("*.mod") >= 0) { Gui::GUIOBJ::Ptr obj = pArea->get_object( "*.mod"); if (obj && obj->Value != -1) { obj->Text[0] = obj->Text[ 1 + obj->Value]; lp_CONFIG->last_MOD = obj->Value > 0 ? String("mods/") << obj->Text[0] << '/' : String(); } } if (pArea->get_value( "*.skin" ) >= 0) { Gui::GUIOBJ::Ptr obj = pArea->get_object( "*.skin"); if (obj && obj->Value != -1) { obj->Text[0] = obj->Text[1 + obj->Value]; lp_CONFIG->skin_name = obj->Value >= 0 ? String("gui/") << obj->Text[0] : String(); } } if (key[KEY_ESC]) // Leave menu on ESC return true; return false; }
LRESULT APIENTRY DD_WindowProc(HWND hWnd, UINT msg, UINT wParam, LONG lParam) { GF_Event evt; DDContext *ctx; GF_VideoOutput *vout = (GF_VideoOutput *) GetWindowLong(hWnd, GWL_USERDATA); if (!vout) return DefWindowProc (hWnd, msg, wParam, lParam); ctx = (DDContext *)vout->opaque; switch (msg) { case WM_SIZE: /*always notify GPAC since we're not sure the owner of the window is listening to these events*/ evt.type = GF_EVENT_SIZE; evt.size.width = LOWORD(lParam); evt.size.height = HIWORD(lParam); vout->on_event(vout->evt_cbk_hdl, &evt); break; case WM_CLOSE: if (hWnd==ctx->os_hwnd) { evt.type = GF_EVENT_QUIT; vout->on_event(vout->evt_cbk_hdl, &evt); } return 1; case WM_DESTROY: if (ctx->owns_hwnd || (hWnd==ctx->fs_hwnd)) { PostQuitMessage (0); } else if (ctx->orig_wnd_proc) { /*restore window proc*/ SetWindowLong(ctx->os_hwnd, GWL_WNDPROC, ctx->orig_wnd_proc); ctx->orig_wnd_proc = 0L; } break; case WM_ACTIVATE: #if 1 if (ctx->fullscreen && (LOWORD(wParam)==WA_INACTIVE) && (hWnd==ctx->fs_hwnd)) { evt.type = GF_EVENT_SHOWHIDE; vout->on_event(vout->evt_cbk_hdl, &evt); } #endif break; case WM_SETCURSOR: if (ctx->cur_hwnd==hWnd) DD_SetCursor(vout, ctx->cursor_type); return 1; case WM_ERASEBKGND: //InvalidateRect(ctx->cur_hwnd, NULL, TRUE); //break; case WM_PAINT: if (ctx->cur_hwnd==hWnd) { evt.type = GF_EVENT_REFRESH; vout->on_event(vout->evt_cbk_hdl, &evt); } break; case WM_KILLFOCUS: if (hWnd==ctx->os_hwnd) ctx->has_focus = 0; break; case WM_MOUSEMOVE: if (ctx->cur_hwnd!=hWnd) break; if (ctx->last_mouse_pos != lParam) { ctx->last_mouse_pos = lParam; DD_SetCursor(vout, (ctx->cursor_type==GF_CURSOR_HIDE) ? ctx->cursor_type_backup : ctx->cursor_type); evt.type = GF_EVENT_MOUSEMOVE; DD_GetCoordinates(lParam, &evt); vout->on_event(vout->evt_cbk_hdl, &evt); mouse_start_timer(ctx, hWnd, vout); } break; case WM_TIMER: if (wParam==10) { if (ctx->fullscreen && (ctx->cursor_type!=GF_CURSOR_HIDE)) { if (gf_sys_clock() > MOUSE_HIDE_TIMEOUT + ctx->last_mouse_move) { ctx->cursor_type_backup = ctx->cursor_type; DD_SetCursor(vout, GF_CURSOR_HIDE); KillTimer(hWnd, ctx->timer); ctx->timer = 0; } } } break; case WM_LBUTTONDOWN: case WM_LBUTTONDBLCLK: grab_mouse(ctx, vout); evt.type = GF_EVENT_MOUSEDOWN; DD_GetCoordinates(lParam, &evt); evt.mouse.button = GF_MOUSE_LEFT; vout->on_event(vout->evt_cbk_hdl, &evt); if (!ctx->has_focus && (hWnd==ctx->os_hwnd)) { ctx->has_focus = 1; SetFocus(ctx->os_hwnd); } break; case WM_LBUTTONUP: release_mouse(ctx, hWnd, vout); evt.type = GF_EVENT_MOUSEUP; DD_GetCoordinates(lParam, &evt); evt.mouse.button = GF_MOUSE_LEFT; vout->on_event(vout->evt_cbk_hdl, &evt); break; case WM_RBUTTONDOWN: case WM_RBUTTONDBLCLK: grab_mouse(ctx, vout); evt.type = GF_EVENT_MOUSEDOWN; DD_GetCoordinates(lParam, &evt); evt.mouse.button = GF_MOUSE_RIGHT; vout->on_event(vout->evt_cbk_hdl, &evt); if (!ctx->has_focus && (hWnd==ctx->os_hwnd)) { ctx->has_focus = 1; SetFocus(ctx->os_hwnd); } break; case WM_RBUTTONUP: release_mouse(ctx, hWnd, vout); evt.type = GF_EVENT_MOUSEUP; DD_GetCoordinates(lParam, &evt); evt.mouse.button = GF_MOUSE_RIGHT; vout->on_event(vout->evt_cbk_hdl, &evt); mouse_start_timer(ctx, hWnd, vout); break; case WM_MBUTTONDOWN: case WM_MBUTTONDBLCLK: grab_mouse(ctx, vout); evt.type = GF_EVENT_MOUSEDOWN; evt.mouse.button = GF_MOUSE_MIDDLE; DD_GetCoordinates(lParam, &evt); vout->on_event(vout->evt_cbk_hdl, &evt); if (!ctx->has_focus && (hWnd==ctx->os_hwnd)) { ctx->has_focus = 1; SetFocus(ctx->os_hwnd); } break; case WM_MBUTTONUP: release_mouse(ctx, hWnd, vout); evt.type = GF_EVENT_MOUSEUP; DD_GetCoordinates(lParam, &evt); evt.mouse.button = GF_MOUSE_MIDDLE; vout->on_event(vout->evt_cbk_hdl, &evt); mouse_start_timer(ctx, hWnd, vout); break; case WM_MOUSEWHEEL: if (ctx->cur_hwnd==hWnd) { DD_SetCursor(vout, (ctx->cursor_type==GF_CURSOR_HIDE) ? ctx->cursor_type_backup : ctx->cursor_type); evt.type = GF_EVENT_MOUSEWHEEL; DD_GetCoordinates(lParam, &evt); evt.mouse.wheel_pos = FLT2FIX( ((Float) (s16) HIWORD(wParam)) / WHEEL_DELTA ); vout->on_event(vout->evt_cbk_hdl, &evt); mouse_start_timer(ctx, hWnd, vout); } return 1; /*there's a bug on alt state (we miss one event)*/ case WM_SYSKEYDOWN: case WM_SYSKEYUP: case WM_KEYUP: case WM_KEYDOWN: w32_translate_key(wParam, lParam, &evt.key); evt.type = ((msg==WM_SYSKEYDOWN) || (msg==WM_KEYDOWN)) ? GF_EVENT_KEYDOWN : GF_EVENT_KEYUP; vout->on_event(vout->evt_cbk_hdl, &evt); break; case WM_CHAR: evt.type = GF_EVENT_TEXTINPUT; evt.character.unicode_char = wParam; vout->on_event(vout->evt_cbk_hdl, &evt); break; } return DefWindowProc (hWnd, msg, wParam, lParam); }