// ANativeActivity_onCreate implements the application's entry point. // // This is the function that must be in the native code to instantiate // the application's native activity. It is called with the activity // instance; if the code is being instantiated from a // previously saved instance, the savedState will be non-NULL and // point to the saved data. You must make any copy of this data you // need – it will be released after you return from this function. // // See https://developer.android.com/ndk/reference/group___native_activity.html // // The Activity may be created and destroyed multiple times throughout // the life of a single process. Each time, onCreate is called. void ANativeActivity_onCreate(ANativeActivity *activity, void* savedState, size_t savedStateSize) { if (!main_running) { // Call the Go main.main. uintptr_t mainPC = (uintptr_t)dlsym(RTLD_DEFAULT, "main.main"); if (!mainPC) { LOG_FATAL("missing main.main"); } callMain(mainPC); main_running = 1; } // Set the native activity callbacks, see: // https://developer.android.com/ndk/reference/struct_a_native_activity_callbacks.html activity->callbacks->onStart = onStart; activity->callbacks->onResume = onResume; activity->callbacks->onSaveInstanceState = onSaveInstanceState; activity->callbacks->onPause = onPause; activity->callbacks->onStop = onStop; activity->callbacks->onDestroy = onDestroy; activity->callbacks->onWindowFocusChanged = onWindowFocusChanged; activity->callbacks->onNativeWindowCreated = onNativeWindowCreated; activity->callbacks->onNativeWindowRedrawNeeded = onNativeWindowRedrawNeeded; activity->callbacks->onNativeWindowDestroyed = onNativeWindowDestroyed; activity->callbacks->onInputQueueCreated = onInputQueueCreated; activity->callbacks->onInputQueueDestroyed = onInputQueueDestroyed; activity->callbacks->onConfigurationChanged = onConfigurationChanged; activity->callbacks->onLowMemory = onLowMemory; onCreate(activity); }
void Window::initialize() { // Setup default behaviours (to get a consistent behaviour across different implementations) setVisible(true); setMouseCursorVisible(true); setVerticalSyncEnabled(false); setKeyRepeatEnabled(true); // Get and cache the initial size of the window m_size = m_impl->getSize(); glewExperimental = GL_TRUE; GLenum res = glewInit(); if (res != GLEW_OK) { std::cout << glewGetErrorString(res) << std::endl; } // Reset frame time m_clock.restart(); // Activate the window setActive(); // Notify the derived class onCreate(); }
void win_system::messageRouter(csystem *src, int msg, param lparam, param rparam) { if (src == this) { return; } csystem::messageRouter(src, msg, lparam, rparam); switch (msg) { // crashutils global messages case MSG_START: onStart(); break; case MSG_INIT_NSD: onInitNSD((NSF*)lparam, (NSD*)rparam); break; // window system local messages case WSM_CREATE: onCreate(); break; } if (mainWindow) { param params[2]; params[0] = lparam; params[1] = rparam; main_window_com *mwc = (main_window_com*)mainWindow; mwc->BroadcastMessage((UINT)msg, (WPARAM)1, (LPARAM)params); } }
LRESULT __stdcall COverlappedWindow::wndProc(UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_CREATE: onCreate(); return 0; case WM_TIMER: onTimer(); return 0; case WM_CLOSE: onClose(); return 0; case WM_DESTROY: OnDestroy(); return 0; case WM_PAINT: handlePaint(); return 0; default: return ::DefWindowProc(handle, uMsg, wParam, lParam); } }
void Window::create(uint32_t nVersion, const char *pszName, unsigned short nWidth, unsigned short nHeight, bool bFullScreen, HWND hParent) { m_strName = pszName; m_nWidth = nWidth; m_nHeight = nHeight; m_bFullScreen = bFullScreen; m_bSizing = false; DWORD dwStyle = WS_CLIPCHILDREN | WS_CLIPSIBLINGS | (bFullScreen ? WS_POPUP : WS_OVERLAPPEDWINDOW); DWORD dwExStyle = (bFullScreen ? WS_EX_TOPMOST : 0); #ifdef _DEBUG // There's nothing worse than hitting a breakpoint with a top-most full-screen window dwExStyle = 0; #endif RECT wr = { 0, 0, nWidth, nHeight }; AdjustWindowRect(&wr, WS_OVERLAPPEDWINDOW, FALSE); LONG w = wr.right - wr.left, h = wr.bottom - wr.top; m_hWnd = ::CreateWindowEx(dwExStyle, WINDOW_CLASS_NAME, pszName, dwStyle, 50, 50, w, h, hParent, NULL, m_hInstance, this); if(m_hWnd == NULL) VKLogException("Failed to create window"); m_lWindows.push_back(m_hWnd); ::ShowWindow(m_hWnd, SW_SHOWNORMAL); vk.create(m_hInstance, m_hWnd, true, pszName, nVersion); onCreate(); RECT rect; ::GetClientRect(m_hWnd, &rect); onSize(rect.right - rect.left, rect.bottom - rect.top); }
LRESULT basic_window::WndProc(HWND hWnd, INT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_CREATE: onCreate(uMsg, wParam, lParam); break; case WM_COMMAND: onCommand(uMsg, wParam, lParam); break; case WM_NOTIFY: onNotify(uMsg, wParam, lParam); break; case WM_PAINT: onPaint(uMsg, wParam, lParam); break; case WM_LBUTTONDOWN: onClick(uMsg, wParam, lParam); break; case WM_RBUTTONDOWN: onRClick(uMsg, wParam, lParam); break; case WM_MOUSEMOVE: onMouse(uMsg, wParam, lParam); break; case WM_DESTROY: onDestroy(uMsg, wParam, lParam); break; case WM_CLOSE: { PostQuitMessage(0); // send quit message return 0; // jump back } default: onOther(uMsg, wParam, lParam); break; } return DefProc(hWnd, uMsg, wParam, lParam); }
LRESULT __stdcall CMyNotepad::wndProc(UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_CREATE: onCreate(); return 0; case WM_CLOSE: onClose(); return 0; case WM_SIZE: onSize(); return 0; case WM_DESTROY: onDestroy(); return 0; case WM_PAINT: handlePaint(); return 0; case WM_COMMAND: onCommand(wParam, lParam); return 0; default: return ::DefWindowProc(handle, uMsg, wParam, lParam); } }
// Runtime entry point when using NativeActivity. void ANativeActivity_onCreate(ANativeActivity *activity, void* savedState, size_t savedStateSize) { current_vm = activity->vm; InitGoRuntime(); // These functions match the methods on Activity, described at // http://developer.android.com/reference/android/app/Activity.html activity->callbacks->onStart = onStart; activity->callbacks->onResume = onResume; activity->callbacks->onSaveInstanceState = onSaveInstanceState; activity->callbacks->onPause = onPause; activity->callbacks->onStop = onStop; activity->callbacks->onDestroy = onDestroy; activity->callbacks->onWindowFocusChanged = onWindowFocusChanged; activity->callbacks->onNativeWindowCreated = onNativeWindowCreated; activity->callbacks->onNativeWindowResized = onNativeWindowResized; activity->callbacks->onNativeWindowRedrawNeeded = onNativeWindowRedrawNeeded; activity->callbacks->onNativeWindowDestroyed = onNativeWindowDestroyed; activity->callbacks->onInputQueueCreated = onInputQueueCreated; activity->callbacks->onInputQueueDestroyed = onInputQueueDestroyed; // TODO(crawshaw): Type mismatch for onContentRectChanged. //activity->callbacks->onContentRectChanged = onContentRectChanged; activity->callbacks->onConfigurationChanged = onConfigurationChanged; activity->callbacks->onLowMemory = onLowMemory; onCreate(activity); }
LRESULT Window::wndProc(UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_CREATE: { if (onCreate()) break; return 0; } case WM_DESTROY: { if (onDestroy()) break; return 0; } case WM_CLOSE: { if (onClose()) break; return 0; } case WM_MOUSEMOVE: { if (onMouseMove(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))) break; return 0; } case WM_LBUTTONDOWN: { if (onMouseDown(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0)) break; return 0; } case WM_RBUTTONDOWN: { if (onMouseDown(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 1)) break; return 0; } case WM_MBUTTONDOWN: { if (onMouseDown(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 2)) break; return 0; } case WM_LBUTTONUP: { if (onMouseUp(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0)) break; return 0; } case WM_RBUTTONUP: { if (onMouseUp(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 1)) break; return 0; } case WM_MBUTTONUP: { if (onMouseUp(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 2)) break; return 0; } case WM_PAINT: { if (onPaint()) break; return 0; } case WM_SIZE: { if (onSizeChanged()) break; return 0; } case WM_KEYDOWN: { if (onKeyDown((UINT)wParam)) break; return 0; } case WM_KEYUP: { if (onKeyUp((UINT)wParam)) break; return 0; } case WM_COMMAND: { if (SendMessage(reinterpret_cast<HWND>(lParam), WM_COMMAND_REFLECT, wParam, lParam)) break; return 0; } } if (mBaseWndProc != sGlobalWndProc) { LRESULT r = CallWindowProc(mBaseWndProc, mHWND, uMsg, wParam, lParam); return r; } else { LRESULT r = DefWindowProc(mHWND, uMsg, wParam, lParam); return r; } }
CreateGroupBox::CreateGroupBox(const MTPVector<MTPInputUser> &users) : _users(users), _createRequestId(0), _name(this, st::newGroupName, lang(lng_dlg_new_group_name)), _create(this, lang(lng_dlg_create_group), st::btnSelectDone), _cancel(this, lang(lng_cancel), st::btnSelectCancel), _hiding(false), a_opacity(0, 1) { _width = st::addContactWidth; _height = st::addContactTitleHeight + st::addContactPadding.top() + _name.height() + st::addContactPadding.bottom() + _create.height(); _name.setGeometry(st::addContactPadding.left(), st::addContactTitleHeight + st::addContactPadding.top(), _width - st::addContactPadding.left() - st::addContactPadding.right(), _name.height()); int32 buttonTop = _name.y() + _name.height() + st::addContactPadding.bottom(); _cancel.move(0, buttonTop); _create.move(_width - _create.width(), buttonTop); connect(&_create, SIGNAL(clicked()), this, SLOT(onCreate())); connect(&_cancel, SIGNAL(clicked()), this, SLOT(onCancel())); resize(_width, _height); showAll(); _cache = myGrab(this, rect()); hideAll(); }
Building::Building() { base_center = Vector3f(0,0,0); x_dim = 1.5; z_dim = 1.5; y_dim = 5; random_seed = (int)time(NULL); onCreate(); }
void GlfwApp::createFullscreenWindow(const glm::uvec2 & size, GLFWmonitor * monitor) { windowSize = size; preCreate(); const GLFWvidmode * currentMode = glfwGetVideoMode(monitor); window = glfwCreateWindow(windowSize.x, windowSize.y, "glfw", monitor, nullptr); assert(window != 0); onCreate(); }
/*-------------------------------------------------------------------------*/ LRESULT CALLBACK NHCommandWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { PNHCmdWindow data; int i; switch (message) { case WM_CREATE: onCreate( hWnd, wParam, lParam ); break; case WM_PAINT: onPaint(hWnd); break; case WM_SIZE: LayoutCmdWindow(hWnd); break; case WM_LBUTTONDOWN: onMouseDown(hWnd, wParam, lParam); return 0; case WM_MOUSEMOVE: /* proceed only if if have mouse focus (set in onMouseDown() - left mouse button is pressed) */ if( GetCapture()==hWnd ) { onMouseMove(hWnd, wParam, lParam); return 0; } else { return 1; } break; case WM_LBUTTONUP: /* proceed only if if have mouse focus (set in onMouseDown()) */ if( GetCapture()==hWnd ) { onMouseUp(hWnd, wParam, lParam); return 0; } else { return 1; } break; case WM_DESTROY: data = (PNHCmdWindow)GetWindowLong(hWnd, GWL_USERDATA); for(i=0; i<=NH_CMDPAD_FONT_MAX; i++ ) if( data->font[i] ) DeleteObject(data->font[i]); free(data); SetWindowLong(hWnd, GWL_USERDATA, (LONG)0); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return FALSE; }
WFrame::WFrame(MainController *pC, Data *pR) { c = pC; r = pR; r->setController(c); onCreate(); manageConnections(); }
ServiceContext::UniqueClient ServiceContext::makeClient(std::string desc, transport::SessionHandle session) { std::unique_ptr<Client> client(new Client(std::move(desc), this, std::move(session))); onCreate(client.get(), _clientObservers); { stdx::lock_guard<stdx::mutex> lk(_mutex); invariant(_clients.insert(client.get()).second); } return UniqueClient(client.release()); }
bool AbstractWindow::create( ) { if ( m_isCreated ) { osre_warn( Tag, "Surface already created." ); return true; } m_isCreated = onCreate(); return m_isCreated; }
void DocAccessibleParent::MaybeInitWindowEmulation() { if (!nsWinUtils::IsWindowEmulationStarted()) { return; } // XXX get the bounds from the tabParent instead of poking at accessibles // which might not exist yet. Accessible* outerDoc = OuterDocOfRemoteBrowser(); if (!outerDoc) { return; } RootAccessible* rootDocument = outerDoc->RootAccessible(); MOZ_ASSERT(rootDocument); bool isActive = true; nsIntRect rect(CW_USEDEFAULT, CW_USEDEFAULT, 0, 0); if (Compatibility::IsDolphin()) { rect = Bounds(); nsIntRect rootRect = rootDocument->Bounds(); rect.x = rootRect.x - rect.x; rect.y -= rootRect.y; auto tab = static_cast<dom::TabParent*>(Manager()); tab->GetDocShellIsActive(&isActive); } nsWinUtils::NativeWindowCreateProc onCreate([this](HWND aHwnd) -> void { IAccessibleHolder hWndAccHolder; ::SetPropW(aHwnd, kPropNameDocAccParent, reinterpret_cast<HANDLE>(this)); SetEmulatedWindowHandle(aHwnd); IAccessible* rawHWNDAcc = nullptr; if (SUCCEEDED(::AccessibleObjectFromWindow(aHwnd, OBJID_WINDOW, IID_IAccessible, (void**)&rawHWNDAcc))) { hWndAccHolder.Set(IAccessibleHolder::COMPtrType(rawHWNDAcc)); } Unused << SendEmulatedWindow(reinterpret_cast<uintptr_t>(mEmulatedWindowHandle), hWndAccHolder); }); HWND parentWnd = reinterpret_cast<HWND>(rootDocument->GetNativeWindow()); DebugOnly<HWND> hWnd = nsWinUtils::CreateNativeWindow(kClassNameTabContent, parentWnd, rect.x, rect.y, rect.width, rect.height, isActive, &onCreate); MOZ_ASSERT(hWnd); }
void Window::init(bool maximize) { setVisible(true, maximize); setMouseCursorVisible(true); setVSyncEnabled(false); setKeyRepeatEnabled(true); setFramerateLimit(0); mSize = mBase->getSize(); mClock.restart(); setActive(); onCreate(); }
LRESULT CALLBACK MessageRouterHelper::DlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { UNREFERENCED_PARAMETER(wParam); UNREFERENCED_PARAMETER(lParam); switch (message) { case WM_STREAMEVENT_COLOR: //UpdateStreams(1); break; case WM_STREAMEVENT_DEPTH: //UpdateStreams(2); break; case WM_INITDIALOG: // store window handle m_hWnd = hWnd; onCreate(); break; case WM_CLOSE: DestroyWindow(hWnd); onDestroy(); break; case WM_DESTROY: PostQuitMessage(0); break; case WM_COMMAND: processUIMessage(wParam, lParam); break; case WM_HSCROLL: onSliderChanged(wParam, lParam); break; case WM_VSCROLL: onSliderScroll(wParam, lParam); break; case WM_NOTIFY: switch (((LPNMHDR)lParam)->code) { case TCN_SELCHANGE: { int iPage = TabCtrl_GetCurSel(GetDlgItem(m_hWnd, IDC_TAB2)); onTabSelected(iPage); } break; } default: break; } return FALSE; }
DBClientBase* DBConnectionPool::_finishCreate( const string& host , DBClientBase* conn ){ { scoped_lock L(_mutex); PoolForHost& p = _pools[host]; p.createdOne(); } onCreate( conn ); onHandedOut( conn ); return conn; }
BOOL dialog::DlgProc(HWND hWnd, INT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_INITDIALOG: return onInitDialog(uMsg, wParam, lParam); break; case WM_CREATE: return onCreate(uMsg, wParam, lParam); break; case WM_COMMAND: return onCommand(uMsg, wParam, lParam); break; default: return onOther(uMsg, wParam, lParam); break; } //return DefMDIChildProc(hWnd, uMsg, wParam, lParam) }
void Identification::rename(uint64_t id, const std::string& name, const std::string& layer){ onDestroy(id); Identifier* identifier = _engine.manager.getComponent<Identifier>(id); strcpy_s(identifier->name, name.c_str()); if (layer != "") strcpy_s(identifier->layer, layer.c_str()); onCreate(id); }
void GlfwApp::createWindow(const glm::uvec2 & size, const glm::ivec2 & position) { windowSize = size; windowPosition = position; preCreate(); window = glfwCreateWindow(size.x, size.y, "glfw", nullptr, nullptr); if (!window) { FAIL("Unable to create rendering window"); } if ((position.x > INT_MIN) && (position.y > INT_MIN)) { glfwSetWindowPos(window, position.x, position.y); } onCreate(); }
void onCreate( SpinSlider * pThis ) { auto gridLayout = new QGridLayout( pThis ); if ( orientation_ == Qt::Horizontal ) { gridLayout->setHorizontalSpacing(6); gridLayout->setVerticalSpacing(2); } else { gridLayout->setHorizontalSpacing(2); gridLayout->setVerticalSpacing(2); } onCreate( gridLayout, 0, 0, pThis ); }
void WindowBase::initialize() { // Setup default behaviors (to get a consistent behavior across different implementations) setVisible(true); setMouseCursorVisible(true); setKeyRepeatEnabled(true); // Get and cache the initial size of the window m_size = m_impl->getSize(); // Notify the derived class onCreate(); }
bool mxWindow::handleMessage( LRESULT *lRes, UINT uMsg, WPARAM wParam, LPARAM lParam ) { switch (uMsg) { case MM_MCINOTIFY: return onMciNotify(wParam, lParam); case WM_CLOSE: return onClose(); case WM_COMMAND: return onCommand( LOWORD(wParam), reinterpret_cast<HWND>(lParam), HIWORD(wParam)); case WM_CREATE: return onCreate(lRes, reinterpret_cast<CREATESTRUCT*>(lParam)); case WM_DESTROY: return onDestroy(); case WM_ERASEBKGND: return onEraseBkgnd(lRes, reinterpret_cast<HDC>(wParam)); case WM_LBUTTONDBLCLK: return onLButtonDown(TRUE, mxPoint(lParam), wParam); case WM_LBUTTONDOWN: return onLButtonDown(FALSE, mxPoint(lParam), wParam); case WM_MOUSEMOVE: return onMouseMove(mxPoint(lParam), wParam); case WM_PAINT: { mxPaintDC dc(this); return onPaint(&dc); } case WM_SIZE: return onSize(wParam, mxSize(lParam)); case WM_TIMER: return onTimer(wParam); } return false; }
// Entry point from our subclassed NativeActivity. // // By here, the Go runtime has been initialized (as we are running in // -buildmode=c-shared) but the first time it is called, Go's main.main // hasn't been called yet. // // The Activity may be created and destroyed multiple times throughout // the life of a single process. Each time, onCreate is called. void ANativeActivity_onCreate(ANativeActivity *activity, void* savedState, size_t savedStateSize) { if (!main_running) { JNIEnv* env = activity->env; // Note that activity->clazz is mis-named. JavaVM* current_vm = activity->vm; jobject current_ctx = activity->clazz; setCurrentContext(current_vm, (*env)->NewGlobalRef(env, current_ctx)); // Set TMPDIR. jmethodID gettmpdir = find_method(env, current_ctx_clazz, "getTmpdir", "()Ljava/lang/String;"); jstring jpath = (jstring)(*env)->CallObjectMethod(env, current_ctx, gettmpdir, NULL); const char* tmpdir = (*env)->GetStringUTFChars(env, jpath, NULL); if (setenv("TMPDIR", tmpdir, 1) != 0) { LOG_INFO("setenv(\"TMPDIR\", \"%s\", 1) failed: %d", tmpdir, errno); } (*env)->ReleaseStringUTFChars(env, jpath, tmpdir); // Call the Go main.main. uintptr_t mainPC = (uintptr_t)dlsym(RTLD_DEFAULT, "main.main"); if (!mainPC) { LOG_FATAL("missing main.main"); } callMain(mainPC); main_running = 1; } // These functions match the methods on Activity, described at // http://developer.android.com/reference/android/app/Activity.html // // Note that onNativeWindowResized is not called on resize. Avoid it. // https://code.google.com/p/android/issues/detail?id=180645 activity->callbacks->onStart = onStart; activity->callbacks->onResume = onResume; activity->callbacks->onSaveInstanceState = onSaveInstanceState; activity->callbacks->onPause = onPause; activity->callbacks->onStop = onStop; activity->callbacks->onDestroy = onDestroy; activity->callbacks->onWindowFocusChanged = onWindowFocusChanged; activity->callbacks->onNativeWindowCreated = onNativeWindowCreated; activity->callbacks->onNativeWindowRedrawNeeded = onNativeWindowRedrawNeeded; activity->callbacks->onNativeWindowDestroyed = onNativeWindowDestroyed; activity->callbacks->onInputQueueCreated = onInputQueueCreated; activity->callbacks->onInputQueueDestroyed = onInputQueueDestroyed; activity->callbacks->onConfigurationChanged = onConfigurationChanged; activity->callbacks->onLowMemory = onLowMemory; onCreate(activity); }
void CreateGroupBox::keyPressEvent(QKeyEvent *e) { if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) { if (_name.hasFocus()) { if (_name.text().trimmed().isEmpty()) { _name.setFocus(); _name.notaBene(); } else { onCreate(); } } } else if (e->key() == Qt::Key_Escape) { onCancel(); } }
/// This will initialize the game effectively and then call onCreate() void GameCore::PrimaryCreate() { // Prepare our screen contents uxScreen->window = getWindow(); uxScreen->GDI = getRenderer(); uxScreen->width = getWindow()->width(); uxScreen->height = getWindow()->height(); // Plugins are ready when the game starts to construct loadPlugins(); onCreate(); }
void UIControl::onRecursion(UINT message) { switch (message) { case WM_CREATE: onCreate(); break; case WM_DESTROY: onDestroy(); break; default: break; } }