Mercurial > sdl-ios-xcode
diff src/video/photon/SDL_ph_wm.c @ 19:8cc4dbfab9ab
Date: Thu, 19 Apr 2001 08:36:54 +0300
From: "Mike Gorchak" <mike@malva.com.ua>
Subject: Patches for QNX RtP
Here my patch for QNX RtP/Photon for SDL-1.2.
Detailed description of my changes:
SDL/configure.in:
If Photon detected declare define ENABLE_PHOTON.
SDL/src/video/SDL_sysvideo.h:
Added extern to ph_bootstrap.
SDL/src/video/SDL_video.c:
Added ph_bootstrap to bootstrap array.
SDL/src/video/photon/SDL_ph_events.c:
Declare DISABLE_X11 if compiled for Photon.
SDL/src/video/photon/SDL_ph_image.c:
Fixed segment violation on exit. Please update BUGS file.
SDL/src/video/photon/SDL_ph_video.c:
1. Enabling window manager.
2. Added to device capabilities Photon Window Manager functions:
SetCaption and IconifyWindow.
3. Renamed X11_bootstrap to ph_bootstrap.
4. Removed SEGFAULT termination of programs if Photon not available.
SDL/src/video/photon/SDL_ph_wm.c:
1. Declare DISABLE_X11 if compiled for Photon.
2. Added ph_SetCaption and ph_IconifyWindow code. (Thanks to
'phearbear' for iconify window source).
3. Some stubers for other wm functions.
Thanks !
----------------------------
Mike Gorchak
CJSC Malva
System Programmer
author | Sam Lantinga <slouken@lokigames.com> |
---|---|
date | Thu, 10 May 2001 18:42:17 +0000 |
parents | 74212992fb08 |
children | e4af2c852c09 |
line wrap: on
line diff
--- a/src/video/photon/SDL_ph_wm.c Thu May 10 18:31:21 2001 +0000 +++ b/src/video/photon/SDL_ph_wm.c Thu May 10 18:42:17 2001 +0000 @@ -25,9 +25,14 @@ "@(#) $Id$"; #endif +#define DISABLE_X11 + #include <stdlib.h> #include <string.h> #include <Ph.h> +#include <photon/PpProto.h> +#include <photon/PhWm.h> +#include <photon/wmapi.h> #include "SDL_version.h" #include "SDL_error.h" #include "SDL_timer.h" @@ -215,42 +220,53 @@ return; } +/* Set window caption */ void ph_SetCaption(_THIS, const char *title, const char *icon) { + SDL_Lock_EventThread(); + if ( title != NULL ) { + PtSetResource(window, Pt_ARG_WINDOW_TITLE, title, 0); + } + SDL_Unlock_EventThread(); +} -#if 0 - XTextProperty titleprop, iconprop; - - /* Lock the event thread, in multi-threading environments */ +/* Iconify the window (stolen from PhHotKey sources by phearbear ;-) */ +int ph_IconifyWindow(_THIS) +{ + int result=0; + int myerr; + int num; + PtConnectionClient_t *Client=0; + WmMsg_t* Message=malloc(sizeof(WmMsg_t)); + WmReply_t *Reply=malloc(sizeof(WmReply_t)); + WmApiContext_t MsgStruct=malloc(sizeof(WmApiContext_t)); + WmWindowDefinition_t **WNDDEF=malloc(sizeof(WmWindowDefinition_t)*2); + SDL_Lock_EventThread(); - if ( title != NULL ) { - XStringListToTextProperty((char **)&title, 1, &titleprop); - XSetWMName(SDL_Display, WMwindow, &titleprop); - XFree(titleprop.value); - } - if ( icon != NULL ) { - XStringListToTextProperty((char **)&icon, 1, &iconprop); - XSetWMIconName(SDL_Display, WMwindow, &iconprop); - XFree(iconprop.value); - } - XSync(SDL_Display, False); + PtInit("/dev/photon"); + + Client=PtConnectionFindName("pwm",0,0); + + if(!Client) + { + return result; + } + + MsgStruct->input_group=PhInputGroup(0); + MsgStruct->connection=PtConnectionFindName("pwm",0,0); + myerr=WmGetFocusList(MsgStruct,2,&num,WNDDEF); + + Message->hdr.type=WM_REQUEST_WIN_ACTION; + Message->hdr.subtype=Pt_ACTION_MIN; + Message->hdr.rid=WNDDEF[0]->rid; + myerr=WmSendMessage(Client,Message,Reply,0); + + free(Message); + free(Reply); SDL_Unlock_EventThread(); -#endif -} -/* Iconify the window */ -int ph_IconifyWindow(_THIS) -{ - int result; - -#if 0 - SDL_Lock_EventThread(); - result = XIconifyWindow(SDL_Display, WMwindow, SDL_Screen); - XSync(SDL_Display, False); - SDL_Unlock_EventThread(); -#endif return(result); } @@ -335,8 +351,8 @@ /* Make sure any X11 transactions are completed */ SDL_VideoDevice *this = current_video; XSync(SDL_Display, False); +#endif SDL_Unlock_EventThread(); -#endif } int ph_GetWMInfo(_THIS, SDL_SysWMinfo *info) { @@ -360,4 +376,7 @@ return(-1); } #endif + return -1; // for now ... } + +