wine/misc/user.c
Alexandre Julliard ef702d8999 Release 960528
Tue May 28 19:36:36 1996  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [controls/combo.c]
	Destroy the listbox and edit control when destroying the
	combo. This should prevent crashes on application exit.

	* [misc/system.c] [if1632/system.spec]
	Implemented InquireSystem().

	* [loader/task.c] [windows/message.c] [windows/queue.c]
	First attempt at inter-task SendMessage(). Still has a lot of
	problems.

Tue May 28 14:26:04 1996  Peter Bajusz  <hyp-x@inf.bme.hu>

	* [windows/mdi.c]
	Fixed MDITile with iconic children.

Mon May 27 20:28:18 1996  Albrecht Kleine  <kleine@ak.sax.de>

	* [misc/commdlg.c]
	ChooseFont dialog:
	- complete rewrite of FontFamilyEnumProc() and FontStyleEnumProc()
	  not real available font types (e.g. "Bold") can not selected
	- supporting more CF_LIMITSIZE- and CF_...ONLY- flags

	* [objects/font.c]
	In FONT_MatchFont perform check if "lfFaceName" is family from X11
	only if "lfFaceName" is a windows font family then do a call of
	FONT_TranslateName() : this results in better font selections in 
	ChooseFont() or applications like charmap.exe or write.exe.
	Added a ParseFontParms() call if necessary in function 
	FONT_MatchFont(): we need a font name as basis for GetTextFace() 
	even if there isn't one...

	* [resources/TODO]
	Inventory of resource translations in sysres_??.rc

Fri May 24 16:33:28 1996  Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>

	* [misc/registry.c]
	_w95_loadreg: use offset to determine next RGDB position too.

Thu May 23 19:35:38 1996  Greg Kreider <kreider@natlab.research.philips.com>

	* [controls/combo.c]
	Fixed size of combo, lbox, and button (lb sometimes off by 2 pixels).

	* [misc/main.c]
	Result of option "-fixedmap" is to turn flag on.

Thu May 23 19:15:41 1996  Ronan Waide  <root@waider.ie>

	* [misc/shell.c]
	ShellExecute and FindExecutable now both use common code to
	determine the required executable file.
1996-05-28 18:54:58 +00:00

146 lines
3.7 KiB
C

/*
* Misc. USER functions
*
* Copyright 1993 Robert J. Amstadt
* 1996 Alex Korobka
*/
#include <stdio.h>
#include <stdlib.h>
#include "windows.h"
#include "gdi.h"
#include "user.h"
#include "task.h"
#include "queue.h"
#include "win.h"
#include "hook.h"
#include "debug.h"
#include "toolhelp.h"
WORD USER_HeapSel = 0;
#ifndef WINELIB
extern HTASK TASK_GetNextTask(HTASK);
extern void QUEUE_SetDoomedQueue(HQUEUE);
/***********************************************************************
* GetFreeSystemResources (USER.284)
*/
WORD GetFreeSystemResources( WORD resType )
{
int userPercent, gdiPercent;
switch(resType)
{
case GFSR_USERRESOURCES:
userPercent = (int)LOCAL_CountFree( USER_HeapSel ) * 100 /
LOCAL_HeapSize( USER_HeapSel );
gdiPercent = 100;
break;
case GFSR_GDIRESOURCES:
gdiPercent = (int)LOCAL_CountFree( GDI_HeapSel ) * 100 /
LOCAL_HeapSize( GDI_HeapSel );
userPercent = 100;
break;
case GFSR_SYSTEMRESOURCES:
userPercent = (int)LOCAL_CountFree( USER_HeapSel ) * 100 /
LOCAL_HeapSize( USER_HeapSel );
gdiPercent = (int)LOCAL_CountFree( GDI_HeapSel ) * 100 /
LOCAL_HeapSize( GDI_HeapSel );
break;
default:
return 0;
}
return (WORD)MIN( userPercent, gdiPercent );
}
/***********************************************************************
* SystemHeapInfo (TOOLHELP.71)
*/
BOOL SystemHeapInfo( SYSHEAPINFO *pHeapInfo )
{
pHeapInfo->wUserFreePercent = GetFreeSystemResources( GFSR_USERRESOURCES );
pHeapInfo->wGDIFreePercent = GetFreeSystemResources( GFSR_GDIRESOURCES );
pHeapInfo->hUserSegment = USER_HeapSel;
pHeapInfo->hGDISegment = GDI_HeapSel;
return TRUE;
}
#endif /* WINELIB */
/***********************************************************************
* TimerCount (TOOLHELP.80)
*/
BOOL TimerCount( TIMERINFO *pTimerInfo )
{
/* FIXME
* In standard mode, dwmsSinceStart = dwmsThisVM
*
* I tested this, under Windows in enhanced mode, and
* if you never switch VM (ie start/stop DOS) these
* values should be the same as well.
*
* Also, Wine should adjust for the hardware timer
* to reduce the amount of error to ~1ms.
* I can't be bothered, can you?
*/
pTimerInfo->dwmsSinceStart = pTimerInfo->dwmsThisVM = GetTickCount();
return TRUE;
}
/**********************************************************************
* USER_InitApp
*/
int USER_InitApp(HINSTANCE hInstance)
{
int queueSize;
/* Create task message queue */
queueSize = GetProfileInt( "windows", "DefaultQueueSize", 8 );
if (!SetMessageQueue( queueSize )) return 0;
return 1;
}
/**********************************************************************
* USER_AppExit
*/
void USER_AppExit(HTASK hTask, HINSTANCE hInstance, HQUEUE hQueue)
{
/* FIXME: flush send messages (which are not implemented yet),
* empty clipboard if needed, maybe destroy menus (Windows
* only complains about them but does nothing);
*/
WND* desktop = WIN_GetDesktop();
/* Patch desktop window queue */
if( desktop->hmemTaskQ == hQueue )
desktop->hmemTaskQ = GetTaskQueue(TASK_GetNextTask(hTask));
/* Nuke timers */
TIMER_RemoveQueueTimers( hQueue );
HOOK_FreeQueueHooks( hQueue );
QUEUE_SetDoomedQueue( hQueue );
/* Nuke orphaned windows */
WIN_DestroyQueueWindows( desktop->child, hQueue );
QUEUE_SetDoomedQueue( 0 );
/* Free the message queue */
QUEUE_DeleteMsgQueue( hQueue );
}