Esempio n. 1
0
static MWHOTKEY *MwFindHotkey (int id)
{
	PMWLIST		p;
	MWHOTKEY	*pHotkey;

	for (p=mwHotkeyHead.head; p; p=p->next) {
		pHotkey = GdItemAddr (p, MWHOTKEY, link);
		if (pHotkey->id == id)
			return pHotkey;
	}
	return NULL;
}
Esempio n. 2
0
/* find the registered window class struct by name*/
PWNDCLASS
MwFindClassByName(LPCSTR lpClassName)
{
	PMWLIST		p;
	PWNDCLASS	pClass;

	for(p=mwClassHead.head; p; p=p->next) {
		pClass = GdItemAddr(p, WNDCLASS, link);
		if(strcasecmp(pClass->szClassName, lpClassName) == 0)
			return pClass;
	}
	return NULL;
}
Esempio n. 3
0
BOOL MwDeliverHotkey (WPARAM VK_Code, BOOL pressed)
{
	PMWLIST		p;
	MWHOTKEY	*pHotkey;

	if (!pressed) return FALSE;
	for (p=mwHotkeyHead.head; p; p=p->next) {
		pHotkey = GdItemAddr (p, MWHOTKEY, link);
		if (pHotkey->vk == VK_Code && IsWindow(pHotkey->hWnd)) {
			PostMessage (pHotkey->hWnd, WM_HOTKEY, 0, MAKELPARAM(0, VK_Code));
			return TRUE;
		}
	}
	return FALSE;
}
Esempio n. 4
0
static BOOL MwRemoveWndFromHotkeys (HWND hWnd)
{
	PMWLIST		p, pNext;
	MWHOTKEY	*pHotkey;
	BOOL        bRet = FALSE;

	for (p=mwHotkeyHead.head; p; p=pNext) {
		pNext = p->next;
		pHotkey = GdItemAddr (p, MWHOTKEY, link);
		if (pHotkey->hWnd == hWnd) {
			GdListRemove(&mwHotkeyHead, &pHotkey->link);
			GdItemFree(pHotkey);
			bRet = TRUE;
		}
	}
	return bRet;
}
Esempio n. 5
0
static PIMAGEITEM
findimage(int id)
{
	PMWLIST		p;
	PIMAGEITEM	pimagelist;

	if(!imagehead_initialized) {
		imagehead_initialized=1;
		memset(&imagehead,0,sizeof(imagehead));
	}
	for (p=imagehead.head; p; p=p->next) {
		pimagelist = GdItemAddr(p, IMAGEITEM, link);
		if (pimagelist->id == id)
			return pimagelist;
	}
	return NULL;
}
Esempio n. 6
0
HANDLE WINAPI
GetProp(HWND hWnd, LPCSTR lpString)
{
	ATOM Atom;
	PMWLIST p;
	MWPROP *pProp;

	if (HIWORD(lpString))
		Atom = GlobalFindAtom(lpString);
	else
		Atom = LOWORD((DWORD)lpString);

	for(p=hWnd->props.head; p; p=p->next) {
		pProp = GdItemAddr(p, MWPROP, link);
		if (pProp->Atom == Atom)
			return pProp->hData;
	}
	return NULL;
}
Esempio n. 7
0
BOOL WINAPI
PostMessage(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
	MSG *	pMsg;

#if PAINTONCE
	/* don't queue paint msgs, set window paint status instead*/
	if(Msg == WM_PAINT) {
		hwnd->gotPaintMsg = PAINT_NEEDSPAINT;
		return TRUE;
	}
#endif
#if MOUSETEST
	/* replace multiple mouse messages with one for better mouse handling*/
	if(Msg == WM_MOUSEMOVE) {
		PMWLIST	p;
		for(p=mwMsgHead.head; p; p=p->next) {
			pMsg = GdItemAddr(p, MSG, link);
			if(pMsg->hwnd == hwnd && pMsg->message == Msg) {
				pMsg->wParam = wParam;
				pMsg->lParam = lParam;
				pMsg->time = GetTickCount();
				pMsg->pt.x = cursorx;
				pMsg->pt.y = cursory;
				return TRUE;
			}
		}
	}
#endif
	pMsg = GdItemNew(MSG);
	if(!pMsg)
		return FALSE;
	pMsg->hwnd = hwnd;
	pMsg->message = Msg;
	pMsg->wParam = wParam;
	pMsg->lParam = lParam;
	pMsg->time = GetTickCount();
	pMsg->pt.x = cursorx;
	pMsg->pt.y = cursory;
	GdListAdd(&mwMsgHead, &pMsg->link);
	return TRUE;
}
Esempio n. 8
0
HANDLE WINAPI
RemoveProp(HWND hWnd, LPCSTR lpString)
{
	ATOM Atom;
	PMWLIST p;
	MWPROP *pProp;
	HANDLE hRet;

	if (HIWORD(lpString))
		Atom = GlobalFindAtom(lpString);
	else
		Atom = LOWORD((DWORD)lpString);

	for(p=hWnd->props.head; p; p=p->next) {
		pProp = GdItemAddr(p, MWPROP, link);
		if (pProp->Atom == Atom) {
			hRet = pProp->hData;
			GdListRemove(&hWnd->props, &pProp->link);
			GdItemFree(pProp);
			return hRet;
		}
	}
	return NULL;
}
Esempio n. 9
0
/*
 * Destroy the specified window, and all of its children.
 * This is a recursive routine.
 */
void
MwDestroyWindow(HWND hwnd,BOOL bSendMsg)
{
	HWND	wp = hwnd;
	HWND	prevwp;
	PMWLIST	p;
	PMSG	pmsg;

	if (wp == rootwp || !IsWindow (hwnd))
		return;

	/*
	 * Unmap the window.
	 */
	if (wp->unmapcount == 0)
		MwHideWindow(wp, FALSE, FALSE);

	if(bSendMsg)
		SendMessage(hwnd, WM_DESTROY, 0, 0L);

	/*
	 * Remove from timers
	 */
	MwRemoveWndFromTimers(hwnd);

	/*
	 * Remove hotkeys
	 */
	MwRemoveWndFromHotkeys(hwnd);

	/*
	 * Disable all sendmessages to this window.
	 */
	wp->lpfnWndProc = NULL;

	/*
	 * Destroy all children, sending WM_DESTROY messages.
	 */
	while (wp->children)
		MwDestroyWindow(wp->children, bSendMsg);

	wp->pClass = NULL;

	/*
	 * Free any cursor associated with the window.
	 */
	if (wp->cursor->usecount-- == 1) {
		free(wp->cursor);
		wp->cursor = NULL;
	}

	/*
	 * Remove this window from the child list of its parent.
	 */
	prevwp = wp->parent->children;
	if (prevwp == wp)
		wp->parent->children = wp->siblings;
	else {
		while (prevwp && prevwp->siblings != wp)
			prevwp = prevwp->siblings;
		if (prevwp) prevwp->siblings = wp->siblings;
	}
	wp->siblings = NULL;

	/*
	 * Remove this window from the complete list of windows.
	 */
	prevwp = listwp;
	if (prevwp == wp)
		listwp = wp->next;
	else {
		while (prevwp->next && prevwp->next != wp)
			prevwp = prevwp->next;
		prevwp->next = wp->next;
	}
	wp->next = NULL;

	/*
	 * Forget various information related to this window.
	 * Then finally free the structure.
	 */

	/* Remove all messages from msg queue for this window*/
	for(p=mwMsgHead.head; p; ) {
		pmsg = GdItemAddr(p, MSG, link);
		if(pmsg->hwnd == wp) {
			p = p->next;
			GdListRemove(&mwMsgHead, &pmsg->link);
			GdItemFree(pmsg);
		} else
			p = p->next;
	}

	/*
	 * Remove all properties from this window.
	 */
	for(p=hwnd->props.head; p; ) {
		MWPROP  *pProp = GdItemAddr(p, MWPROP, link);
		p = p->next;
		GdListRemove (&hwnd->props, &pProp->link);
		GdItemFree (pProp);
	}

	/* FIXME: destroy hdc's relating to window?*/

	if (wp == capturewp) {
		capturewp = NULL;
		MwCheckMouseWindow();
	}

	if (wp == MwGetTopWindow(focuswp))
		SetFocus(rootwp->children? rootwp->children: rootwp);

	/* destroy private DC*/
	if(wp->owndc) {
		HDC hdc = wp->owndc;
		wp->owndc = NULL;	/* force destroy with ReleaseDC*/
		ReleaseDC(wp, hdc);
	}

	if (wp->szTitle) {
		free(wp->szTitle);
		wp->szTitle = NULL;
	}

#if UPDATEREGIONS
	if (wp->update) {
		GdDestroyRegion(wp->update);
		wp->update = NULL;
	}
#endif

	GdItemFree(wp);
}