/************************************************************************** * SendNotifyEx [COMCTL32.342] * * Sends a WM_NOTIFY message to the specified window. * * PARAMS * hwndFrom [I] Window to receive the message * hwndTo [I] Window that the message is from * uCode [I] Notification code * lpHdr [I] The NMHDR and any additional information to send or NULL * dwParam5 [I] Unknown * * RETURNS * Success: return value from notification * Failure: 0 * * NOTES * If hwndFrom is -1 then the identifier of the control sending the * message is taken from the NMHDR structure. * If hwndFrom is not -1 then lpHdr can be NULL. */ LRESULT WINAPI SendNotifyEx (HWND hwndTo, HWND hwndFrom, UINT uCode, LPNMHDR lpHdr, DWORD dwParam5) { NOTIFYDATA notify; HWND hwndNotify; TRACE("(%p %p %d %p 0x%08x)\n", hwndFrom, hwndTo, uCode, lpHdr, dwParam5); hwndNotify = hwndTo; if (!hwndTo) { if (IsWindow (hwndFrom)) { hwndNotify = GetParent (hwndFrom); if (!hwndNotify) return 0; } } notify.hwndFrom = hwndFrom; notify.hwndTo = hwndNotify; notify.dwParam5 = dwParam5; notify.dwParam6 = 0; return DoNotify (¬ify, uCode, lpHdr); }
BOOL vncServer::Authenticated(vncClientId clientid) { vncClientList::iterator i; BOOL authok = TRUE; omni_mutex_lock l1(m_desktopLock); omni_mutex_lock l2(m_clientsLock); // Search the unauthenticated client list for (i = m_unauthClients.begin(); i != m_unauthClients.end(); i++) { // Is this the right client? if ((*i) == clientid) { vncClient *client = GetClient(clientid); // Yes, so remove the client and add it to the auth list m_unauthClients.erase(i); // Create the screen handler if necessary if (m_desktop == NULL) { m_desktop = new vncDesktop(); if (m_desktop == NULL) { client->Kill(); authok = FALSE; break; } if (!m_desktop->Init(this)) { client->Kill(); authok = FALSE; delete m_desktop; m_desktop = NULL; break; } } // Tell the client about this new buffer client->SetBuffer(&(m_desktop->m_buffer)); // Add the client to the auth list m_authClients.push_back(clientid); break; } } // Notify anyone interested of this event DoNotify(WM_SRV_CLIENT_AUTHENTICATED, 0, 0); vnclog.Print(LL_INTINFO, VNCLOG("Authenticated() done\n")); return authok; }
vncClientId vncServer::AddClient(VSocket *socket, BOOL auth, BOOL shared, BOOL teleport, int capability, BOOL keysenabled, BOOL ptrenabled) { vncClient *client; omni_mutex_lock l(m_clientsLock); // Try to allocate a client id... vncClientId clientid = m_nextid; do { clientid = (clientid+1) % MAX_CLIENTS; if (clientid == m_nextid) { delete socket; return -1; } } while (m_clientmap[clientid] != NULL); // Create a new client and add it to the relevant client list client = new vncClient(); if (client == NULL) { delete socket; return -1; } // Set the client's settings client->SetTeleport(teleport); client->SetCapability(capability); client->EnableKeyboard(keysenabled && m_enable_remote_inputs); client->EnablePointer(ptrenabled && m_enable_remote_inputs); // Start the client if (!client->Init(this, socket, auth, shared, clientid)) { // The client will delete the socket for us... vnclog.Print(LL_CONNERR, VNCLOG("failed to initialise client object\n")); delete client; return -1; } m_clientmap[clientid] = client; // Add the client to unauth the client list m_unauthClients.push_back(clientid); // Notify anyone interested about this event DoNotify(WM_SRV_CLIENT_CONNECT, 0, 0); vnclog.Print(LL_INTINFO, VNCLOG("AddClient() done\n")); return clientid; }
/************************************************************************** * SendNotify [COMCTL32.341] * * Sends a WM_NOTIFY message to the specified window. * * PARAMS * hwndTo [I] Window to receive the message * hwndFrom [I] Window that the message is from (see notes) * uCode [I] Notification code * lpHdr [I] The NMHDR and any additional information to send or NULL * * RETURNS * Success: return value from notification * Failure: 0 * * NOTES * If hwndFrom is -1 then the identifier of the control sending the * message is taken from the NMHDR structure. * If hwndFrom is not -1 then lpHdr can be NULL. */ LRESULT WINAPI SendNotify (HWND hwndTo, HWND hwndFrom, UINT uCode, LPNMHDR lpHdr) { NOTIFYDATA notify; TRACE("(%p %p %d %p)\n", hwndTo, hwndFrom, uCode, lpHdr); notify.hwndFrom = hwndFrom; notify.hwndTo = hwndTo; notify.dwParam5 = 0; notify.dwParam6 = 0; return DoNotify (¬ify, uCode, lpHdr); }
void wxScrollTimer::StartAutoScroll() { // start scrolling immediately if ( !DoNotify() ) { // ... and end it too return; } // there is an initial delay before the scrollbar starts scrolling - // implement it by ignoring the first timer expiration and only start // scrolling from the second one m_skipNext = true; Start(200); // FIXME: hardcoded delay }
IPTR ICClass__OM_NOTIFY(Class *cl, Object *o, struct opUpdate *msg) { struct ICData *ic = INST_DATA(cl, o); IPTR retval; struct IntuitionBase *IntuitionBase = (struct IntuitionBase *)cl->cl_UserData; /* Send update notification to target */ DEBUG_IC(dprintf("dispatch_icclass: OM_NOTIFY\n")); DEBUG_IC(dprintf("dispatch_icclass: DoNotify\n")); retval = DoNotify(cl, o, ic, msg); DEBUG_IC(dprintf("dispatch_icclass: DoNotify done\n")); return retval; }
void wxScrollTimer::Notify() { if ( m_skipNext ) { // scroll normally now - reduce the delay Stop(); Start(50); // FIXME: hardcoded delay m_skipNext = false; } else { // if DoNotify() returns false, we're already deleted by the timer // event handler, so don't do anything else here (void)DoNotify(); } }
// RemoveClient should ONLY EVER be used by the client to remove itself. void vncServer::RemoveClient(vncClientId clientid) { vncClientList::iterator i; BOOL done = FALSE; omni_mutex_lock l1(m_desktopLock); { omni_mutex_lock l2(m_clientsLock); // Find the client in one of the two lists for (i = m_unauthClients.begin(); i != m_unauthClients.end(); i++) { // Is this the right client? if ((*i) == clientid) { vnclog.Print(LL_INTINFO, VNCLOG("removing unauthorised client\n")); // Yes, so remove the client and kill it m_unauthClients.erase(i); m_clientmap[clientid] = NULL; done = TRUE; break; } } if (!done) { for (i = m_authClients.begin(); i != m_authClients.end(); i++) { // Is this the right client? if ((*i) == clientid) { vnclog.Print(LL_INTINFO, VNCLOG("removing authorised client\n")); // Yes, so remove the client and kill it m_authClients.erase(i); m_clientmap[clientid] = NULL; done = TRUE; break; } } } // Signal that a client has quit m_clientquitsig->signal(); } // Unlock the clientLock // Are there any authorised clients connected? if (m_authClients.empty() && (m_desktop != NULL)) { vnclog.Print(LL_STATE, VNCLOG("deleting desktop server\n")); // Are there locksettings set? if (LockSettings() == 1) { // Yes - lock the machine on disconnect! vncService::LockWorkstation(); } else if (LockSettings() > 1) { char username[UNLEN+1]; vncService::CurrentUser((char *)&username, sizeof(username)); if (strcmp(username, "") != 0) { // Yes - force a user logoff on disconnect! if (!ExitWindowsEx(EWX_LOGOFF, 0)) vnclog.Print(LL_CONNERR, VNCLOG("client disconnect - failed to logoff user!\n")); } } // Delete the screen server delete m_desktop; m_desktop = NULL; } // Notify anyone interested of the change DoNotify(WM_SRV_CLIENT_DISCONNECT, 0, 0); vnclog.Print(LL_INTINFO, VNCLOG("RemoveClient() done\n")); }
BOOL vncServer::Authenticated(vncClientId clientid) { vncClientList::iterator i; BOOL authok = TRUE; omni_mutex_lock l1(m_desktopLock); omni_mutex_lock l2(m_clientsLock); // Search the unauthenticated client list for (i = m_unauthClients.begin(); i != m_unauthClients.end(); i++) { // Is this the right client? if ((*i) == clientid) { vncClient *client = GetClient(clientid); // Yes, so remove the client and add it to the auth list m_unauthClients.erase(i); // Create the screen handler if necessary if (m_desktop == NULL) { if (RemoveWallpaperEnabled()) { m_wallpaper_wait = TRUE; DoNotify(WM_SRV_CLIENT_HIDEWALLPAPER, 0, 0); } m_desktop = new vncDesktop(); if (m_desktop == NULL) { vnclog.Print(LL_CONNERR, VNCLOG("failed to allocate desktop object\n")); client->Kill(); authok = FALSE; break; } if (!m_desktop->Init(this)) { vnclog.Print(LL_CONNERR, VNCLOG("failed to initialize desktop object\n")); client->Kill(); authok = FALSE; delete m_desktop; m_desktop = NULL; break; } } // Create a buffer object for this client vncBuffer *buffer = new vncBuffer(m_desktop); if (buffer == NULL) { vnclog.Print(LL_CONNERR, VNCLOG("failed to allocate buffer object\n")); client->Kill(); authok = FALSE; break; } // Tell the client about this new buffer client->SetBuffer(buffer); // Add the client to the auth list m_authClients.push_back(clientid); break; } } // Notify anyone interested of this event DoNotify(WM_SRV_CLIENT_AUTHENTICATED, 0, 0); vnclog.Print(LL_INTINFO, VNCLOG("Authenticated() done\n")); // If so configured, beep to indicate the new connection is // present. if (authok && GetBeepConnect()) { MessageBeep(MB_OK); } return authok; }