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