src/video/photon/SDL_ph_wm.c
author Sam Lantinga <slouken@libsdl.org>
Mon, 04 Aug 2003 00:52:42 +0000
changeset 663 8bedd6d61642
parent 571 8e3ce997621c
child 753 b14fdadd8311
permissions -rw-r--r--
Date: Sat, 2 Aug 2003 16:22:51 +0300
From: "Mike Gorchak"
Subject: New patches for QNX6

Here my patches for the SDL/QNX:

QNXSDL.diff - diff to non-QNX related sources:

- updated BUGS file, I think QNX6 is now will be officially supported
- configure.in - added shared library support for QNX, and removed dependency between the ALSA and QNX6.
- SDL_audio.c - added QNX NTO sound bootstrap insted of ALSA's.
- SDL_sysaudio.h - the same.
- SDL_nto_audio.c - the same.
- SDL_video.c - right now, QNX doesn't offer any method to obtain pointers to the OpenGL functions by function name, so they must be hardcoded in library, otherwise OpenGL will not be supported.
- testsprite.c - fixed: do not draw vertical red line if we are in non-double-buffered mode.

sdlqnxph.tar.gz - archive of the ./src/video/photon/* . Too many changes in code to make diffs :) :

+ Added stub for support hide/unhide window event
+ Added full YUV overlays support.
+ Added window maximize support.
+ Added mouse wheel events.
+ Added support for some specific key codes in Unicode mode (like ESC).
+ Added more checks to the all memory allocation code.
+ Added SDL_DOUBLEBUF support in all fullscreen modes.
+ Added fallback to window mode, if desired fullscreen mode is not supported.
+ Added stub support for the GL_LoadLibrary and GL_GetProcAddress functions.
+ Added resizable window support without caption.
! Fixed bug in the Ph_EV_EXPOSE event handler, when rectangles to update is 0 and when width or height of the rectangle is 0.
! Fixed bug in the event handler code. Events has not been passed to the window widget handler.
! Fixed codes for Win keys (Super/Hyper/Menu).
! Fixed memory leak, when deallocation palette.
! Fixed palette emulation code bugs.
! Fixed fullscreen and hwsurface handling.
! Fixed CLOSE button bug. First event was passed to the handler, but second terminated the application. Now all events passed to the application correctly.
- Removed all printfs in code, now SDL_SetError used instead of them.
- Disabled ToggleFullScreen function.

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