NPError NPN_GetValue(NPP instance, NPNVariable variable, void *ret_value) { notice("...getValue: %d", (int) variable); { uint32_t *p = ret_value; notice(" %x %x %x %x", p[0], p[1], p[2], p[3]); } if(variable >= ((NPNVariable)1000) && variable <= ((NPNVariable)1011)) { iface_getvalue(variable, ret_value); return 0; } switch(variable) { case kSupportedDrawingModel_ANPGetValue: // This is not a mistake: it replicates a bug in Android. *((uint32_t *) ret_value) = kBitmap_ANPDrawingModel & kSurface_ANPDrawingModel; break; case kJavaContext_ANPGetValue: notice("kJavaContext_ANPGetValue"); *((jobject *) ret_value) = android_context; break; case NPNVWindowNPObject: { int window_id; if(get_window_object(food, &window_id)) { perror("get_window_object"); _abort(); } *((NPObject **) ret_value) = new_idproxy_object(window_id); break; } default: notice("unknown GetValue! returning with error"); *((uint32_t *) ret_value) = 0xdeadbee1; return NPERR_GENERIC_ERROR; } return 0; }
void Input::end_frame() { auto device = core::get_subsystem<graphics::WindowDevice>(); // _window_size = core::get_subsystem<graphics::WindowDevice>()->get_window_size(); _last_mouse_position = get_mouse_position(); // check for focus change this frame if( device->get_window_flags() & SDL_WINDOW_INPUT_FOCUS ) { if( !_input_focus ) { reset_state(); if( !_mouse_visible ) SDL_ShowCursor(SDL_FALSE); } _input_focus = true; } else { if( _input_focus ) { reset_state(); SDL_ShowCursor(SDL_TRUE); } _input_focus = false; } // recenter mouse if no mouse visibility if( _input_focus && !_mouse_visible && !_touch_emulation ) { SDL_WarpMouseInWindow((SDL_Window*)device->get_window_object(), _window_size[0]/2, _window_size[1]/2); } }