Skip to content

Latest commit

 

History

History
126 lines (101 loc) · 3 KB

SDL_ph_wm.c

File metadata and controls

126 lines (101 loc) · 3 KB
 
Apr 26, 2001
Apr 26, 2001
1
2
/*
SDL - Simple DirectMedia Layer
Jan 4, 2004
Jan 4, 2004
3
Copyright (C) 1997-2004 Sam Lantinga
Apr 26, 2001
Apr 26, 2001
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
Dec 14, 2001
Dec 14, 2001
20
slouken@libsdl.org
Apr 26, 2001
Apr 26, 2001
21
22
23
24
25
26
27
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id$";
#endif
May 10, 2001
May 10, 2001
28
29
#define DISABLE_X11
Apr 26, 2001
Apr 26, 2001
30
31
32
#include <stdlib.h>
#include <string.h>
#include <Ph.h>
May 10, 2001
May 10, 2001
33
34
35
#include <photon/PpProto.h>
#include <photon/PhWm.h>
#include <photon/wmapi.h>
Apr 26, 2001
Apr 26, 2001
36
37
38
39
40
41
42
43
44
45
46
47
#include "SDL_version.h"
#include "SDL_error.h"
#include "SDL_timer.h"
#include "SDL_video.h"
#include "SDL_syswm.h"
#include "SDL_events_c.h"
#include "SDL_pixels_c.h"
#include "SDL_ph_modes_c.h"
#include "SDL_ph_wm_c.h"
void ph_SetIcon(_THIS, SDL_Surface *icon, Uint8 *mask)
{
Mar 23, 2002
Mar 23, 2002
48
return;
Apr 26, 2001
Apr 26, 2001
49
50
}
May 10, 2001
May 10, 2001
51
/* Set window caption */
Apr 26, 2001
Apr 26, 2001
52
53
void ph_SetCaption(_THIS, const char *title, const char *icon)
{
Mar 23, 2002
Mar 23, 2002
54
55
SDL_Lock_EventThread();
Jan 20, 2003
Jan 20, 2003
56
/* sanity check for set caption call before window init */
Mar 23, 2002
Mar 23, 2002
57
58
59
60
61
62
if (window!=NULL)
{
PtSetResource(window, Pt_ARG_WINDOW_TITLE, title, 0);
}
SDL_Unlock_EventThread();
Apr 26, 2001
Apr 26, 2001
63
64
}
Jan 18, 2002
Jan 18, 2002
65
/* Iconify current window */
Apr 26, 2001
Apr 26, 2001
66
67
int ph_IconifyWindow(_THIS)
{
Mar 23, 2002
Mar 23, 2002
68
PhWindowEvent_t windowevent;
May 10, 2001
May 10, 2001
69
Mar 23, 2002
Mar 23, 2002
70
71
72
73
74
SDL_Lock_EventThread();
memset( &windowevent, 0, sizeof (event) );
windowevent.event_f = Ph_WM_HIDE;
windowevent.event_state = Ph_WM_EVSTATE_HIDE;
Aug 4, 2003
Aug 4, 2003
75
76
77
windowevent.rid = PtWidgetRid(window);
PtForwardWindowEvent(&windowevent);
Mar 23, 2002
Mar 23, 2002
78
79
80
SDL_Unlock_EventThread();
return 0;
Apr 26, 2001
Apr 26, 2001
81
82
83
84
}
SDL_GrabMode ph_GrabInputNoLock(_THIS, SDL_GrabMode mode)
{
Jan 20, 2003
Jan 20, 2003
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
short abs_x, abs_y;
if( mode == SDL_GRAB_OFF )
{
PtSetResource(window, Pt_ARG_WINDOW_STATE, Pt_FALSE, Ph_WM_STATE_ISALTKEY);
}
else
{
PtSetResource(window, Pt_ARG_WINDOW_STATE, Pt_TRUE, Ph_WM_STATE_ISALTKEY);
PtGetAbsPosition(window, &abs_x, &abs_y);
PhMoveCursorAbs(PhInputGroup(NULL), abs_x + SDL_VideoSurface->w/2, abs_y + SDL_VideoSurface->h/2);
}
SDL_Unlock_EventThread();
Mar 23, 2002
Mar 23, 2002
101
return(mode);
Apr 26, 2001
Apr 26, 2001
102
103
104
105
}
SDL_GrabMode ph_GrabInput(_THIS, SDL_GrabMode mode)
{
Jan 20, 2003
Jan 20, 2003
106
107
108
109
110
SDL_Lock_EventThread();
mode = ph_GrabInputNoLock(this, mode);
SDL_Unlock_EventThread();
return(mode);
Apr 26, 2001
Apr 26, 2001
111
112
}
Jan 20, 2003
Jan 20, 2003
113
Apr 26, 2001
Apr 26, 2001
114
115
int ph_GetWMInfo(_THIS, SDL_SysWMinfo *info)
{
Mar 23, 2002
Mar 23, 2002
116
117
118
119
120
121
122
123
124
125
if (info->version.major <= SDL_MAJOR_VERSION)
{
return 1;
}
else
{
SDL_SetError("Application not compiled with SDL %d.%d\n",
SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
return -1;
}
Apr 26, 2001
Apr 26, 2001
126
}