comparison src/video/photon/SDL_ph_wm.c @ 1662:782fd950bd46 SDL-1.3

Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API. WARNING: None of the video drivers have been updated for the new API yet! The API is still under design and very fluid. The code is now run through a consistent indent format: indent -i4 -nut -nsc -br -ce The headers are being converted to automatically generate doxygen documentation.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 28 May 2006 13:04:16 +0000
parents 141528317f4f
children 4da1ee79c9af
comparison
equal deleted inserted replaced
1661:281d3f4870e5 1662:782fd950bd46
33 #include "../SDL_pixels_c.h" 33 #include "../SDL_pixels_c.h"
34 #include "../../events/SDL_events_c.h" 34 #include "../../events/SDL_events_c.h"
35 #include "SDL_ph_modes_c.h" 35 #include "SDL_ph_modes_c.h"
36 #include "SDL_ph_wm_c.h" 36 #include "SDL_ph_wm_c.h"
37 37
38 void ph_SetIcon(_THIS, SDL_Surface *icon, Uint8 *mask) 38 void
39 ph_SetIcon (_THIS, SDL_Surface * icon, Uint8 * mask)
39 { 40 {
40 return; 41 return;
41 } 42 }
42 43
43 /* Set window caption */ 44 /* Set window caption */
44 void ph_SetCaption(_THIS, const char *title, const char *icon) 45 void
46 ph_SetCaption (_THIS, const char *title, const char *icon)
45 { 47 {
46 SDL_Lock_EventThread(); 48 SDL_Lock_EventThread ();
47 49
48 /* sanity check for set caption call before window init */ 50 /* sanity check for set caption call before window init */
49 if (window!=NULL) 51 if (window != NULL) {
50 { 52 PtSetResource (window, Pt_ARG_WINDOW_TITLE, title, 0);
51 PtSetResource(window, Pt_ARG_WINDOW_TITLE, title, 0);
52 } 53 }
53 54
54 SDL_Unlock_EventThread(); 55 SDL_Unlock_EventThread ();
55 } 56 }
56 57
57 /* Iconify current window */ 58 /* Iconify current window */
58 int ph_IconifyWindow(_THIS) 59 int
60 ph_IconifyWindow (_THIS)
59 { 61 {
60 PhWindowEvent_t windowevent; 62 PhWindowEvent_t windowevent;
61 63
62 SDL_Lock_EventThread(); 64 SDL_Lock_EventThread ();
63 65
64 SDL_memset(&windowevent, 0, sizeof(windowevent)); 66 SDL_memset (&windowevent, 0, sizeof (windowevent));
65 windowevent.event_f = Ph_WM_HIDE; 67 windowevent.event_f = Ph_WM_HIDE;
66 windowevent.event_state = Ph_WM_EVSTATE_HIDE; 68 windowevent.event_state = Ph_WM_EVSTATE_HIDE;
67 windowevent.rid = PtWidgetRid(window); 69 windowevent.rid = PtWidgetRid (window);
68 PtForwardWindowEvent(&windowevent); 70 PtForwardWindowEvent (&windowevent);
69 71
70 SDL_Unlock_EventThread(); 72 SDL_Unlock_EventThread ();
71 73
72 return 0; 74 return 0;
73 } 75 }
74 76
75 SDL_GrabMode ph_GrabInputNoLock(_THIS, SDL_GrabMode mode) 77 SDL_GrabMode
78 ph_GrabInputNoLock (_THIS, SDL_GrabMode mode)
76 { 79 {
77 short abs_x, abs_y; 80 short abs_x, abs_y;
78 81
79 if( mode == SDL_GRAB_OFF ) 82 if (mode == SDL_GRAB_OFF) {
80 { 83 PtSetResource (window, Pt_ARG_WINDOW_STATE, Pt_FALSE,
81 PtSetResource(window, Pt_ARG_WINDOW_STATE, Pt_FALSE, Ph_WM_STATE_ISALTKEY); 84 Ph_WM_STATE_ISALTKEY);
82 } 85 } else {
83 else 86 PtSetResource (window, Pt_ARG_WINDOW_STATE, Pt_TRUE,
84 { 87 Ph_WM_STATE_ISALTKEY);
85 PtSetResource(window, Pt_ARG_WINDOW_STATE, Pt_TRUE, Ph_WM_STATE_ISALTKEY);
86 88
87 PtGetAbsPosition(window, &abs_x, &abs_y); 89 PtGetAbsPosition (window, &abs_x, &abs_y);
88 PhMoveCursorAbs(PhInputGroup(NULL), abs_x + SDL_VideoSurface->w/2, abs_y + SDL_VideoSurface->h/2); 90 PhMoveCursorAbs (PhInputGroup (NULL),
91 abs_x + SDL_VideoSurface->w / 2,
92 abs_y + SDL_VideoSurface->h / 2);
89 } 93 }
90 94
91 SDL_Unlock_EventThread(); 95 SDL_Unlock_EventThread ();
92 96
93 return(mode); 97 return (mode);
94 } 98 }
95 99
96 SDL_GrabMode ph_GrabInput(_THIS, SDL_GrabMode mode) 100 SDL_GrabMode
101 ph_GrabInput (_THIS, SDL_GrabMode mode)
97 { 102 {
98 SDL_Lock_EventThread(); 103 SDL_Lock_EventThread ();
99 mode = ph_GrabInputNoLock(this, mode); 104 mode = ph_GrabInputNoLock (this, mode);
100 SDL_Unlock_EventThread(); 105 SDL_Unlock_EventThread ();
101 106
102 return(mode); 107 return (mode);
103 } 108 }
104 109
105 110
106 int ph_GetWMInfo(_THIS, SDL_SysWMinfo *info) 111 int
112 ph_GetWMInfo (_THIS, SDL_SysWMinfo * info)
107 { 113 {
108 if (info->version.major <= SDL_MAJOR_VERSION) 114 if (info->version.major <= SDL_MAJOR_VERSION) {
109 {
110 return 1; 115 return 1;
111 } 116 } else {
112 else 117 SDL_SetError ("Application not compiled with SDL %d.%d\n",
113 {
114 SDL_SetError("Application not compiled with SDL %d.%d\n",
115 SDL_MAJOR_VERSION, SDL_MINOR_VERSION); 118 SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
116 return -1; 119 return -1;
117 } 120 }
118 } 121 }
122
123 /* vi: set ts=4 sw=4 expandtab: */