Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

Server-only operations
[MiniGUI-Lite specific functions]

Defines

Typedefs

Functions

Variables


Detailed Description

MiniGUI provides some server-only functions for you to create a customized server for MiniGUI-Lite, i.e. mginit.

Example:

/*
 * This program which should be named "mginit" calls "ServerStartup" 
 * to start the server of MiniGUI-Lite.
 *
 * Then it calls "SetDesktopRect" to set the desktop
 * rectangle of the server.
 *
 * "SetDesktopRect" defined as a macro calling "JoinLayer":
 *
 * #define SetDesktopRect(lx, ty, rx, by) JoinLayer ("", "", lx, ty, rx, by)
 */
int MiniGUIMain (int args, const char* arg[])
{
    if (!ServerStartup ()) {
        fprintf (stderr, "Can not start mginit.\n");
        return 1;
    }

    if (SetDesktopRect (0, g_rcScr.bottom - 20 - 20,
                            g_rcScr.right, g_rcScr.bottom) == 0) {
        fprintf (stderr, "Can not get the required desktop rectangle.\n");
        return 1;
    }

    if (!InitMiniGUIExt ()) {
        fprintf (stderr, "Can not init mgext library.\n");
        return 1;
    }

    /* Enter message loop */
    while (GetMessage (&msg, hTaskBar)) {
        DispatchMessage (&msg);
    }

    MiniGUIExtCleanUp ();

    return 0;
}

Define Documentation

 
#define ClientCanDrawNow  )     ClientCanDrawNowEx (TRUE, NULL)
 

Tells clients that they can output to screen now, and notify clients to repaint the whole desktop.

Returns:
TRUE on success, otherwise FALSE.
Note:
Server-only function, and defined as a macro calling ClientCanDrawNowEx with bRepaint is TRUE and invrc is NULL.
See also:
ClientCanDrawNowEx

Definition at line 724 of file minigui.h.

#define LCO_ACTIVE_CHANGED   6
 

The active client has changed, the client will be the active one.

See also:
OnChangeLayer

Definition at line 581 of file minigui.h.

#define LCO_DEL_CLIENT   2
 

Disconnecting a new client from the server.

See also:
OnNewDelClient

Definition at line 536 of file minigui.h.

#define LCO_DEL_LAYER   2
 

Deleting a new layer.

See also:
OnChangeLayer

Definition at line 557 of file minigui.h.

#define LCO_JOIN_CLIENT   3
 

Joining a client to the layer.

See also:
OnChangeLayer

Definition at line 563 of file minigui.h.

#define LCO_NEW_CLIENT   1
 

Connecting a new client to the server.

See also:
OnNewDelClient

Definition at line 530 of file minigui.h.

#define LCO_NEW_LAYER   1
 

Creating a new layer.

See also:
OnChangeLayer

Definition at line 551 of file minigui.h.

#define LCO_REMOVE_CLIENT   4
 

Removing a client from the layer.

See also:
OnChangeLayer

Definition at line 569 of file minigui.h.

#define LCO_TOPMOST_CHANGED   5
 

The topmost layer has changed, the layer will be the topmost one.

See also:
OnChangeLayer

Definition at line 575 of file minigui.h.


Typedef Documentation

typedef void(* ON_CHANGE_LAYER)(int op, MG_Layer *layer, MG_Client *client)
 

Layer event callback.

See also:
OnNewDelClient, OnChangeLayer

Definition at line 590 of file minigui.h.

typedef void(* ON_NEW_DEL_CLIENT)(int op, int cli)
 

Client event callback.

See also:
OnNewDelClient, OnChangeLayer

Definition at line 544 of file minigui.h.


Function Documentation

BOOL GUIAPI ClientCanDrawNowEx BOOL  bRepaint,
const RECT invrc
 

Tells clients that they can output to screen now.

Parameters:
bRepaint Whether to repaint the clients in the topmost layer.
invrc The invalid screen rect. It can be NULL, indicates the whole desktop of clients should be repainted.
Returns:
TRUE on success, otherwise FALSE.
Note:
Server-only function.
See also:
OnlyMeCanDraw, ClientCanDrawNow

int GUIAPI GetClientByPID int  pid  ) 
 

Returns the client identifier from the process identifier (PID) of a client.

This function gets the identifier of the sepcified client from the PID of it.

Parameters:
pid The process identifier of the client.
Returns:
The client identifier on success, less than 0 on error.
Note:
Server-only function.

BOOL GUIAPI OnlyMeCanDraw void   ) 
 

Tells clients do not draw anything on screen.

If the server want to disable output of clients, it can call this function to disable the clients' any drawing output. When the server done, it can call ClientCanDrawNowEx function to tell clients in the topmost layer to repaint themselves.

Note that the clients is still running after the server calling this function.

Returns:
TRUE on success, otherwise FALSE.
Note:
Server-only function.
See also:
ClientCanDrawNowEx, ClientCanDrawNow

BOOL SetClientScreen int  lx,
int  ty,
int  rx,
int  by
[inline, static]
 

Sets the screen rectangle can be used by clients.

This function sets the screen rectangle can be used by clients. All clients' drawing will be clipped out of the rectangle.

The rectangle set by this function should be a subrectangle of the server's exclusive rectangle defined by SetDesktopRect.

Parameters:
lx lx,ty,rx,by: Specifies the screen rectangle.
ty lx,ty,rx,by: Specifies the screen rectangle.
rx lx,ty,rx,by: Specifies the screen rectangle.
by lx,ty,rx,by: Specifies the screen rectangle.
Returns:
TRUE on success, otherwise FALSE.
Note:
Server-only function, i.e. ONLY can be called by mginit.

This function do nothing in MiniGUI v1.5.x and later.

See also:
JoinLayer

Definition at line 671 of file minigui.h.

References TRUE.

BOOL GUIAPI SetTopMostClient int  cli  ) 
 

Sets topmost layer by a client identifier.

This function sets the topmost layer by the specified client identifier cli. It will bring the layer contains the client to be the topmost one.

Parameters:
cli The identifier of the client.
Returns:
TRUE on success, otherwise FALSE.
Note:
Server-only function.
See also:
SetTopMostLayer, BringLayer2Topmost

BOOL GUIAPI SetTopMostLayer MG_Layer layer  ) 
 

Sets topmost layer.

This functions sets the specified layer layer to be the topmost layer.

Parameters:
layer The pointer to the layer.
Returns:
TRUE on success, otherwise FALSE.
Note:
Server-only function.
See also:
SetTopMostClient, BringLayer2Topmost

void GUIAPI UpdateTopmostLayer const RECT dirty_rc  ) 
 

Tells the clients in the topmost layer to update their windows.

Parameters:
dirty_rc The dirty rectangle in screen coordinate system.
Note:
Server-only function.
See also:
OnlyMeCanDraw, ClientCanDrawNowEx


Variable Documentation

ON_CHANGE_LAYER OnChangeLayer
 

Sets to a function to handle events of layers.

When a layer is changing, MiniGUI will call this function to tell you the event and the layer or the client which leads to the event. The event could be one of the following:

  • LCO_NEW_LAYER
    A new layer is creating.
  • LCO_DEL_LAYER
    A new layer is deleting.
  • LCO_JOIN_CLIENT
    A client is joining to the layer.
  • LCO_REMOVE_CLIENT
    A client is removing from the layer.
  • LCO_TOPMOST_CHANGED
    The topmost layer changed, the layer will be the topmost one.
  • LCO_ACTIVE_CHANGED
    The active client changed, the client will be the active one.

The event will be passed through the argument of op, and the pointers to the relevant layer and client will be passed through the argument of layer and client respectively.

Note:
Only available for the server of MiniGUI-Lite.
See also:
ON_NEW_DEL_CLIENT, mgClients

ON_NEW_DEL_CLIENT OnNewDelClient
 

Sets to a function to handle a comming in/going away connection of client.

When a client is connecting to or disconnecting from the server, MiniGUI will call this function to tell you the event and the client identifier. The event could be one of the following:

  • LCO_NEW_CLIENT
    A new client is connecting to the server.
  • LCO_DEL_CLIENT
    A new client is disconnecting from the server.

The event will be passed through the argument of op, and the client identifier will be passed through the argument of cli. You can get the information of the client by accessing mgClients with cli.

Note:
Only available for the server of MiniGUI-Lite.
See also:
ON_NEW_DEL_CLIENT, mgClients


Generated on Mon Jun 26 13:54:32 2006 for MiniGUI V1.6.9 API Reference by  doxygen 1.4.2