mirror of
https://github.com/gnustep/libs-back.git
synced 2025-05-29 16:31:29 +00:00
Add headless backend
This commit is contained in:
parent
909bd06688
commit
4c8524a209
28 changed files with 3712 additions and 0 deletions
38
Headers/headlesslib/HeadlessContext.h
Normal file
38
Headers/headlesslib/HeadlessContext.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
HeadlessContext.h
|
||||
|
||||
Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
|
||||
August 31, 2003
|
||||
Written by Banlu Kemiyatorn <id at project-ile dot net>
|
||||
|
||||
This file is part of GNUstep.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef HeadlessContext_h
|
||||
#define HeadlessContext_h
|
||||
|
||||
#include "gsc/GSContext.h"
|
||||
|
||||
@interface HeadlessContext : GSContext
|
||||
{
|
||||
}
|
||||
@end
|
||||
|
||||
#endif
|
44
Headers/headlesslib/HeadlessFaceInfo.h
Normal file
44
Headers/headlesslib/HeadlessFaceInfo.h
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
CairoFaceInfo.h
|
||||
|
||||
Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
|
||||
August 31, 2003
|
||||
Written by Banlu Kemiyatorn <object at gmail dot com>
|
||||
Base on code by Alexander Malmberg <alexander@malmberg.org>
|
||||
Rewrite: Fred Kiefer <fredkiefer@gmx.de>
|
||||
Date: Jan 2006
|
||||
|
||||
This file is part of GNUstep.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef HEADLESSFACEINFO_H
|
||||
#define HEADLESSFACEINFO_H
|
||||
|
||||
#include <Foundation/NSObject.h>
|
||||
|
||||
@interface HeadlessFaceInfo : NSObject
|
||||
{
|
||||
void *_fontFace;
|
||||
}
|
||||
|
||||
- (void *)fontFace;
|
||||
|
||||
@end
|
||||
#endif
|
42
Headers/headlesslib/HeadlessFontEnumerator.h
Normal file
42
Headers/headlesslib/HeadlessFontEnumerator.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
CairoFontEnumerator.h
|
||||
|
||||
Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
August 31, 2003
|
||||
Written by Banlu Kemiyatorn <object at gmail dot com>
|
||||
|
||||
This file is part of GNUstep.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CairoFontEnumerator_h
|
||||
#define CairoFontEnumerator_h
|
||||
|
||||
#include <GNUstepGUI/GSFontInfo.h>
|
||||
|
||||
@class HeadlessFaceInfo;
|
||||
|
||||
@interface HeadlessFontEnumerator : GSFontEnumerator
|
||||
{
|
||||
}
|
||||
+ (Class) faceInfoClass;
|
||||
+ (HeadlessFaceInfo *) fontWithName: (NSString *)name;
|
||||
@end
|
||||
|
||||
#endif
|
47
Headers/headlesslib/HeadlessFontInfo.h
Normal file
47
Headers/headlesslib/HeadlessFontInfo.h
Normal file
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
CairoFontInfo.h
|
||||
|
||||
Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
|
||||
August 31, 2003
|
||||
Written by Banlu Kemiyatorn <object at gmail dot com>
|
||||
|
||||
This file is part of GNUstep.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef HeadlessFontInfo_h
|
||||
#define HeadlessFontInfo_h
|
||||
|
||||
#include <GNUstepGUI/GSFontInfo.h>
|
||||
#include "headlesslib/HeadlessFaceInfo.h"
|
||||
|
||||
typedef void *cairo_t;
|
||||
|
||||
@interface HeadlessFontInfo : GSFontInfo
|
||||
{
|
||||
@public
|
||||
void *_scaled;
|
||||
}
|
||||
|
||||
- (void) drawGlyphs: (const NSGlyph*)glyphs
|
||||
length: (int)length
|
||||
on: (cairo_t*)ct;
|
||||
@end
|
||||
|
||||
#endif
|
46
Headers/headlesslib/HeadlessGState.h
Normal file
46
Headers/headlesslib/HeadlessGState.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
|
||||
Author: Banlu Kemiyatorn <object at gmail dot com>
|
||||
|
||||
This file is part of GNUstep.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef HeadlessGState_h
|
||||
#define HeadlessGState_h
|
||||
|
||||
#include "gsc/GSGState.h"
|
||||
|
||||
|
||||
@class HeadlessSurface;
|
||||
|
||||
@interface HeadlessGState : GSGState
|
||||
{
|
||||
@public
|
||||
void *_ct;
|
||||
HeadlessSurface *_surface;
|
||||
}
|
||||
|
||||
- (void) GSCurrentSurface: (HeadlessSurface **)surface : (int *)x : (int *)y;
|
||||
- (void) GSSetSurface: (HeadlessSurface *)surface : (int)x : (int)y;
|
||||
|
||||
- (void) showPage;
|
||||
@end
|
||||
|
||||
#endif
|
38
Headers/headlesslib/HeadlessModernSurface.h
Normal file
38
Headers/headlesslib/HeadlessModernSurface.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
|
||||
Author: Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
This file is part of GNUstep.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef HeadlessModernSurface_h
|
||||
#define HeadlessModernSurface_h
|
||||
|
||||
#include "headlesslib/HeadlessSurface.h"
|
||||
|
||||
@interface HeadlessModernSurface : HeadlessSurface
|
||||
{
|
||||
@private
|
||||
void *_windowSurface;
|
||||
}
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
53
Headers/headlesslib/HeadlessSurface.h
Normal file
53
Headers/headlesslib/HeadlessSurface.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
|
||||
Author: Banlu Kemiyatorn <object at gmail dot com>
|
||||
|
||||
This file is part of GNUstep.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef HeadlessSurface_h
|
||||
#define HeadlessSurface_h
|
||||
|
||||
#include <Foundation/Foundation.h>
|
||||
|
||||
typedef void *cairo_surface_t;
|
||||
|
||||
@interface HeadlessSurface : NSObject
|
||||
{
|
||||
@public
|
||||
void *gsDevice;
|
||||
void *_surface;
|
||||
}
|
||||
|
||||
- (id) initWithDevice: (void *)device;
|
||||
|
||||
- (NSSize) size;
|
||||
- (void) setSize: (NSSize)newSize;
|
||||
|
||||
- (void *) surface;
|
||||
|
||||
- (void) handleExposeRect: (NSRect)rect;
|
||||
|
||||
- (BOOL) isDrawingToScreen;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
158
Headers/xheadless/XGGeneric.h
Normal file
158
Headers/xheadless/XGGeneric.h
Normal file
|
@ -0,0 +1,158 @@
|
|||
/* Generic header info common to X backends for GNUstep
|
||||
|
||||
Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||
Date: Mar 2000
|
||||
|
||||
This file is part of the GNUstep project
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_XGGENERIC_H
|
||||
#define INCLUDED_XGGENERIC_H
|
||||
|
||||
#include "XHeadless.h"
|
||||
/*
|
||||
* Flags to indicate which protocols the WindowManager follows
|
||||
*/
|
||||
typedef enum {
|
||||
XGWM_UNKNOWN = 0,
|
||||
XGWM_WINDOWMAKER = 1,
|
||||
XGWM_GNOME = 2,
|
||||
XGWM_KDE = 4,
|
||||
XGWM_EWMH = 8
|
||||
} XGWMProtocols;
|
||||
|
||||
typedef struct {
|
||||
Atom win_type_atom;
|
||||
Atom win_desktop_atom;
|
||||
Atom win_normal_atom;
|
||||
Atom win_floating_atom;
|
||||
Atom win_menu_atom;
|
||||
Atom win_dock_atom;
|
||||
Atom win_modal_atom;
|
||||
Atom win_utility_atom;
|
||||
Atom win_splash_atom;
|
||||
Atom win_override_atom;
|
||||
Atom win_topmenu_atom;
|
||||
Atom win_popup_menu_atom;
|
||||
Atom win_dropdown_menu_atom;
|
||||
Atom win_tooltip_atom;
|
||||
Atom win_notification_atom;
|
||||
Atom win_combo_atom;
|
||||
Atom win_dnd_atom;
|
||||
} XGWMWinTypes;
|
||||
|
||||
typedef struct {
|
||||
Atom net_wm_state_atom;
|
||||
Atom net_wm_state_modal_atom;
|
||||
Atom net_wm_state_sticky_atom;
|
||||
Atom net_wm_state_maximized_vert_atom;
|
||||
Atom net_wm_state_maximized_horz_atom;
|
||||
Atom net_wm_state_shaded_atom;
|
||||
Atom net_wm_state_skip_taskbar_atom;
|
||||
Atom net_wm_state_skip_pager_atom;
|
||||
Atom net_wm_state_hidden_atom;
|
||||
Atom net_wm_state_fullscreen_atom;
|
||||
Atom net_wm_state_above_atom;
|
||||
Atom net_wm_state_below_atom;
|
||||
Atom net_wm_state_demands_attention_atom;
|
||||
} XGWMNetStates;
|
||||
|
||||
/*
|
||||
* Frame offsets for window inside parent decoration window.
|
||||
*/
|
||||
typedef struct {
|
||||
short l; // offset from left
|
||||
short r; // offset from right
|
||||
short t; // offset from top
|
||||
short b; // offset from bottom
|
||||
BOOL known; // obtained from Reparent event or just guessed?
|
||||
} Offsets;
|
||||
|
||||
/*
|
||||
* Structure containing ivars that are common to all X backend contexts.
|
||||
*/
|
||||
struct XGGeneric {
|
||||
int wm;
|
||||
struct {
|
||||
unsigned useWindowMakerIcons:1;
|
||||
unsigned appOwnsMiniwindow:1;
|
||||
unsigned doubleParentWindow:1;
|
||||
} flags;
|
||||
// Time of last X event
|
||||
Time lastTime;
|
||||
// Approximate local time for last X event, used to decide
|
||||
// if the last X event time is still valid.
|
||||
NSTimeInterval lastTimeStamp;
|
||||
// last reference time on X server, used to prevent time drift between
|
||||
// local machine and X server.
|
||||
Time baseXServerTime;
|
||||
Time lastClick;
|
||||
Window lastClickWindow;
|
||||
int lastClickX;
|
||||
int lastClickY;
|
||||
Time lastMotion;
|
||||
Atom protocols_atom;
|
||||
Atom delete_win_atom;
|
||||
Atom take_focus_atom;
|
||||
Atom wm_state_atom;
|
||||
Atom net_wm_ping_atom;
|
||||
Atom net_wm_sync_request_atom;
|
||||
Atom net_wm_sync_request_counter_atom;
|
||||
Atom miniaturize_atom;
|
||||
Atom win_decor_atom;
|
||||
Atom titlebar_state_atom;
|
||||
char *rootName;
|
||||
long currentFocusWindow;
|
||||
long desiredFocusWindow;
|
||||
unsigned long focusRequestNumber;
|
||||
unsigned char lMouse;
|
||||
unsigned char mMouse;
|
||||
unsigned char rMouse;
|
||||
unsigned char upMouse;
|
||||
unsigned char downMouse;
|
||||
unsigned char scrollLeftMouse;
|
||||
unsigned char scrollRightMouse;
|
||||
int lMouseMask;
|
||||
int mMouseMask;
|
||||
int rMouseMask;
|
||||
Window appRootWindow;
|
||||
void *cachedWindow; // last gswindow_device_t used.
|
||||
Offsets offsets[16];
|
||||
XGWMWinTypes wintypes;
|
||||
XGWMNetStates netstates;
|
||||
};
|
||||
|
||||
/* GNOME Window layers */
|
||||
#define WIN_LAYER_DESKTOP 0
|
||||
#define WIN_LAYER_BELOW 2
|
||||
#define WIN_LAYER_NORMAL 4
|
||||
#define WIN_LAYER_ONTOP 6
|
||||
#define WIN_LAYER_DOCK 8
|
||||
#define WIN_LAYER_ABOVE_DOCK 10
|
||||
#define WIN_LAYER_MENU 12
|
||||
|
||||
/* NET WM State */
|
||||
#define _NET_WM_STATE_REMOVE 0 /* remove/unset property */
|
||||
#define _NET_WM_STATE_ADD 1 /* add/set property */
|
||||
#define _NET_WM_STATE_TOGGLE 2 /* toggle property */
|
||||
|
||||
#endif
|
||||
|
79
Headers/xheadless/XGInputServer.h
Normal file
79
Headers/xheadless/XGInputServer.h
Normal file
|
@ -0,0 +1,79 @@
|
|||
/* XGInputServer - Keyboard input handling
|
||||
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
|
||||
Author: Adam Fedor <fedor@gnu.org>
|
||||
Date: January 2002
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef _GNUstep_H_XGInputServer
|
||||
#define _GNUstep_H_XGInputServer
|
||||
|
||||
#include <AppKit/NSInputServer.h>
|
||||
#include <xheadless/XGServerWindow.h>
|
||||
|
||||
@protocol XInputFiltering
|
||||
- (BOOL) filterEvent: (XEvent *)event;
|
||||
- (NSString *) lookupStringForEvent: (XKeyEvent *)event
|
||||
window: (gswindow_device_t *)window
|
||||
keysym: (KeySym *)keysymptr;
|
||||
@end
|
||||
|
||||
|
||||
@interface XIMInputServer: NSInputServer <XInputFiltering>
|
||||
{
|
||||
id delegate;
|
||||
NSString *server_name;
|
||||
XIM xim;
|
||||
XIMStyle xim_style;
|
||||
|
||||
/* Track the XIC:s and destroy them explicitly to work around an XFree86
|
||||
bug:
|
||||
http://www.xfree86.org/pipermail/xpert/2002-June/018370.html
|
||||
*/
|
||||
XIC *xics;
|
||||
int num_xics;
|
||||
}
|
||||
|
||||
- (id) initWithDelegate: (id)aDelegate
|
||||
display: (Display *)dpy
|
||||
name: (NSString *)name;
|
||||
- (void) ximFocusICWindow: (gswindow_device_t *)windev;
|
||||
- (void) ximCloseIC: (XIC)xic;
|
||||
|
||||
@end
|
||||
|
||||
// Public interface for the input methods
|
||||
@interface XIMInputServer (InputMethod)
|
||||
- (NSString *) inputMethodStyle;
|
||||
- (NSString *) fontSize: (int *)size;
|
||||
- (BOOL) clientWindowRect: (NSRect *)rect;
|
||||
|
||||
- (BOOL) statusArea: (NSRect *)rect;
|
||||
- (BOOL) preeditArea: (NSRect *)rect;
|
||||
- (BOOL) preeditSpot: (NSPoint *)p;
|
||||
|
||||
- (BOOL) setStatusArea: (NSRect *)rect;
|
||||
- (BOOL) setPreeditArea: (NSRect *)rect;
|
||||
- (BOOL) setPreeditSpot: (NSPoint *)p;
|
||||
@end // XIMInputServer (InputMethod)
|
||||
|
||||
#endif
|
79
Headers/xheadless/XGOpenGL.h
Normal file
79
Headers/xheadless/XGOpenGL.h
Normal file
|
@ -0,0 +1,79 @@
|
|||
/* -*-ObjC-*- */
|
||||
/* XGOpenGL - openGL management using glX
|
||||
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
|
||||
Author: Frederic De Jaeger
|
||||
Date: Nov 2002
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef _GNUstep_H_XGOpenGL_
|
||||
#define _GNUstep_H_XGOpenGL_
|
||||
|
||||
#include <AppKit/NSOpenGL.h>
|
||||
|
||||
#define id _gs_avoid_id_collision
|
||||
#define BOOL XWINDOWSBOOL
|
||||
#include <GL/glx.h>
|
||||
#undef id
|
||||
#undef BOOL
|
||||
|
||||
@class NSView;
|
||||
@class XGXSubWindow;
|
||||
@class XGGLPixelFormat;
|
||||
|
||||
@interface XGGLContext : NSOpenGLContext
|
||||
{
|
||||
int glxminorversion;
|
||||
GLXContext glx_context;
|
||||
GLXWindow glx_drawable;
|
||||
XGXSubWindow *xSubWindow;
|
||||
XGGLPixelFormat *pixelFormat;
|
||||
BOOL saved_ignores_backing;
|
||||
}
|
||||
|
||||
- (GLXContext)glxcontext;
|
||||
|
||||
@end
|
||||
|
||||
@interface XGGLPixelFormat : NSOpenGLPixelFormat
|
||||
{
|
||||
Display * display;
|
||||
int glxminorversion;
|
||||
|
||||
GLXFBConfig *fbconfig;
|
||||
int pickedFBConfig;
|
||||
int configurationCount;
|
||||
BOOL shouldRequestARGBVisual;
|
||||
|
||||
XVisualInfo *visualinfo;
|
||||
|
||||
}
|
||||
|
||||
+ (int) glxMinorVersion;
|
||||
- (Display *) display;
|
||||
- (XVisualInfo *) visualinfo;
|
||||
- (GLXContext) createGLXContext: (XGGLContext *)share;
|
||||
- (GLXWindow) drawableForWindow: (Window)xwindowid;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
113
Headers/xheadless/XGServer.h
Normal file
113
Headers/xheadless/XGServer.h
Normal file
|
@ -0,0 +1,113 @@
|
|||
/* <title>XGServer</title>
|
||||
|
||||
<abstract>Backend server using the X11.</abstract>
|
||||
|
||||
Copyright (C) 2002-2015 Free Software Foundation, Inc.
|
||||
|
||||
Author: Adam Fedor <fedor@gnu.org>
|
||||
Date: Mar 2002
|
||||
|
||||
This file is part of the GNUstep Backend.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef _XGServer_h_INCLUDE
|
||||
#define _XGServer_h_INCLUDE
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <GNUstepGUI/GSDisplayServer.h>
|
||||
#include "XHeadless.h"
|
||||
#include "XGGeneric.h"
|
||||
|
||||
/*
|
||||
* Enumerated type to say how we should draw pixels to the X display - used
|
||||
* to select different drawing mechanisms to try to optimise.
|
||||
*/
|
||||
typedef enum {
|
||||
XGDM_FAST15,
|
||||
XGDM_FAST16,
|
||||
XGDM_FAST32,
|
||||
XGDM_FAST32_BGR,
|
||||
XGDM_FAST8,
|
||||
XGDM_PORTABLE
|
||||
} XGDrawMechanism;
|
||||
|
||||
@interface XGServer : GSDisplayServer
|
||||
{
|
||||
Display *dpy;
|
||||
int defScreen;
|
||||
NSMapTable *screenList;
|
||||
Window grabWindow;
|
||||
struct XGGeneric generic;
|
||||
id inputServer;
|
||||
}
|
||||
|
||||
+ (Display*) currentXDisplay;
|
||||
- (Display*) xDisplay;
|
||||
- (Window) xAppRootWindow;
|
||||
|
||||
- (void *) xrContextForScreen: (int)screen_number;
|
||||
- (Visual *) visualForScreen: (int)screen_number;
|
||||
- (int) depthForScreen: (int)screen_number;
|
||||
|
||||
- (XGDrawMechanism) drawMechanismForScreen: (int)screen_number;
|
||||
- (void) getForScreen: (int)screen_number pixelFormat: (int *)bpp_number
|
||||
masks: (int *)red_mask : (int *)green_mask : (int *)blue_mask;
|
||||
- (Window) xDisplayRootWindowForScreen: (int)screen_number;
|
||||
- (XColor) xColorFromColor: (XColor)color forScreen: (int)screen_number;
|
||||
|
||||
+ (void) waitAllContexts;
|
||||
@end
|
||||
|
||||
/*
|
||||
* Synchronize with X event queue - soak up events.
|
||||
* Waits for up to 1 second for event.
|
||||
*/
|
||||
@interface XGServer (XSync)
|
||||
- (BOOL) xSyncMap: (void*)window;
|
||||
@end
|
||||
|
||||
@interface XGServer (XGGeneric)
|
||||
- (NSRect) _OSFrameToXFrame: (NSRect)o for: (void*)window;
|
||||
- (NSRect) _OSFrameToXHints: (NSRect)o for: (void*)window;
|
||||
- (NSRect) _XFrameToOSFrame: (NSRect)x for: (void*)window;
|
||||
- (NSRect) _XFrameToXHints: (NSRect)o for: (void*)window;
|
||||
@end
|
||||
|
||||
// Public interface for the input methods.
|
||||
@interface XGServer (InputMethod)
|
||||
- (NSString *) inputMethodStyle;
|
||||
- (NSString *) fontSize: (int *)size;
|
||||
- (BOOL) clientWindowRect: (NSRect *)rect;
|
||||
|
||||
- (BOOL) statusArea: (NSRect *)rect;
|
||||
- (BOOL) preeditArea: (NSRect *)rect;
|
||||
- (BOOL) preeditSpot: (NSPoint *)p;
|
||||
|
||||
- (BOOL) setStatusArea: (NSRect *)rect;
|
||||
- (BOOL) setPreeditArea: (NSRect *)rect;
|
||||
- (BOOL) setPreeditSpot: (NSPoint *)p;
|
||||
@end
|
||||
|
||||
@interface XGServer (TimeKeeping)
|
||||
- (void) setLastTime: (Time)last;
|
||||
- (Time) lastTime;
|
||||
@end
|
||||
|
||||
#endif /* _XGServer_h_INCLUDE */
|
145
Headers/xheadless/XGServerWindow.h
Normal file
145
Headers/xheadless/XGServerWindow.h
Normal file
|
@ -0,0 +1,145 @@
|
|||
/* Window ops for X11 server
|
||||
|
||||
Copyright (C) 1999-2015 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Adam Fedor <fedor@gnu.org>
|
||||
Date: Nov 1999
|
||||
|
||||
This file is part of the GNU Objective C User Interface library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef _XGServerWindow_h_INCLUDE
|
||||
#define _XGServerWindow_h_INCLUDE
|
||||
|
||||
#include <xheadless/XGServer.h>
|
||||
|
||||
/*
|
||||
* WindowMaker window manager interaction
|
||||
*
|
||||
* NB. Despite the fact that all the fields in this table are notionally
|
||||
* 32bit values (WindowMaker defines them as CARD32 and Pixmap types and
|
||||
* the X protocol spec says Pixmap is 32bits) they actually all have to be
|
||||
* long values (64bits on a 64bit processor). This is because of a bug in
|
||||
* X-windows property functions, such that they assume that where property
|
||||
* data is specified as 32bit it is actually a long.
|
||||
* The X headers automatically adjust the size of a Pixmap to be that of
|
||||
* a long, so we can declare Pixmap fields to be that size, but we must
|
||||
* explicitly use 'unsigned long' rather than CARD32 foir the others.
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned long flags;
|
||||
unsigned long window_style;
|
||||
unsigned long window_level;
|
||||
unsigned long reserved;
|
||||
Pixmap miniaturize_pixmap; // pixmap for miniaturize button
|
||||
Pixmap close_pixmap; // pixmap for close button
|
||||
Pixmap miniaturize_mask; // miniaturize pixmap mask
|
||||
Pixmap close_mask; // close pixmap mask
|
||||
unsigned long extra_flags;
|
||||
} GNUstepWMAttributes;
|
||||
|
||||
#define GSWindowStyleAttr (1<<0)
|
||||
#define GSWindowLevelAttr (1<<1)
|
||||
#define GSMiniaturizePixmapAttr (1<<3)
|
||||
#define GSClosePixmapAttr (1<<4)
|
||||
#define GSMiniaturizeMaskAttr (1<<5)
|
||||
#define GSCloseMaskAttr (1<<6)
|
||||
#define GSExtraFlagsAttr (1<<7)
|
||||
|
||||
#define GSDocumentEditedFlag (1<<0)
|
||||
#define GSWindowWillResizeNotificationsFlag (1<<1)
|
||||
#define GSWindowWillMoveNotificationsFlag (1<<2)
|
||||
#define GSNoApplicationIconFlag (1<<5)
|
||||
#define WMFHideOtherApplications 10
|
||||
#define WMFHideApplication 12
|
||||
|
||||
#define GSMaxWMProtocols 5
|
||||
|
||||
/* Graphics Driver protocol. Setup in [NSGraphicsContext-contextDevice:] */
|
||||
enum {
|
||||
GDriverHandlesBacking = 1,
|
||||
GDriverHandlesExpose = 2
|
||||
};
|
||||
|
||||
typedef struct _gswindow_device_t {
|
||||
Display *display; /* Display this window is on */
|
||||
Window ident; /* Window handle */
|
||||
Window root; /* Handle of root window */
|
||||
Window parent; /* Handle of parent window */
|
||||
int screen; /* Screeen this window is on */
|
||||
GC gc; /* GC for drawing */
|
||||
long number; /* Globally unique identifier */
|
||||
unsigned int depth; /* Window depth */
|
||||
unsigned int border; /* Border size */
|
||||
int map_state; /* X map state */
|
||||
int visibility; /* X visibility */
|
||||
int wm_state; /* X WM state */
|
||||
NSBackingStoreType type; /* Backing type */
|
||||
NSRect xframe; /* Window frame */
|
||||
|
||||
unsigned int buffer_width; /* Size in pixels of the current buffers. */
|
||||
unsigned int buffer_height;
|
||||
Drawable buffer; /* Backing store pixmap */
|
||||
Drawable alpha_buffer; /* Alpha buffer. Managed by gdriver
|
||||
will be freed if HandlesBacking=0 */
|
||||
BOOL is_exposed;
|
||||
NSMutableArray *exposedRects; /* List of exposure event rects */
|
||||
Region region; /* Used between several expose events */
|
||||
XWMHints gen_hints;
|
||||
XSizeHints siz_hints;
|
||||
GNUstepWMAttributes win_attrs;
|
||||
XSetWindowAttributes xwn_attrs;
|
||||
int xoff;
|
||||
int yoff;
|
||||
int boff;
|
||||
Atom protocols[GSMaxWMProtocols];
|
||||
int numProtocols;
|
||||
XIC ic;
|
||||
void *gdriver; /* gdriver ident. Managed by gdriver */
|
||||
int gdriverProtocol; /* Managed by gdriver */
|
||||
BOOL ignore_take_focus;
|
||||
#ifdef HAVE_X11_EXTENSIONS_SYNC_H
|
||||
uint32_t net_wm_sync_request_counter_value_low;
|
||||
uint32_t net_wm_sync_request_counter_value_high;
|
||||
XSyncCounter net_wm_sync_request_counter;
|
||||
#endif
|
||||
} gswindow_device_t;
|
||||
|
||||
#define GET_XDRAWABLE(win) ((win)->buffer ? (win)->buffer: (win)->ident)
|
||||
|
||||
@interface XGServer (DPSWindow)
|
||||
+ (gswindow_device_t *) _windowForXWindow: (Window)xWindow;
|
||||
+ (gswindow_device_t *) _windowForXParent: (Window)xWindow;
|
||||
+ (gswindow_device_t *) _windowWithTag: (NSInteger)windowNumber;
|
||||
- (void) _addExposedRectangle: (XRectangle)rectangle : (NSInteger)win : (BOOL) ignoreBacking;
|
||||
- (void) _processExposedRectangles: (NSInteger)win;
|
||||
- (void) _initializeCursorForXWindow: (Window) win;
|
||||
- (void) _destroyServerWindows;
|
||||
|
||||
/* This needs to go in GSDisplayServer */
|
||||
- (void) _DPSsetcursor: (Cursor)c : (BOOL)set;
|
||||
|
||||
- (int) _wm_state: (Window) win;
|
||||
- (BOOL) _ewmh_isHidden: (Window) win;
|
||||
@end
|
||||
|
||||
extern Pixmap
|
||||
xgps_cursor_mask(Display *xdpy, Drawable draw, const unsigned char *data,
|
||||
int w, int h, int colors);
|
||||
#endif
|
38
Headers/xheadless/XHeadless.h
Normal file
38
Headers/xheadless/XHeadless.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
#ifndef XHeadless_H
|
||||
#define XHeadless_H
|
||||
|
||||
|
||||
typedef unsigned long long Display;
|
||||
typedef unsigned long long Pixmap;
|
||||
typedef unsigned long long Window;
|
||||
typedef unsigned long long Visual;
|
||||
typedef unsigned long long XColor;
|
||||
typedef unsigned long long Time;
|
||||
typedef unsigned long long GC;
|
||||
typedef unsigned long long Drawable;
|
||||
typedef unsigned long long XWMHints;
|
||||
typedef unsigned long long XSizeHints;
|
||||
typedef unsigned long long XSetWindowAttributes;
|
||||
typedef unsigned long long Atom;
|
||||
typedef void *XIC;
|
||||
typedef unsigned long long XIM;
|
||||
typedef unsigned long long XKeySim;
|
||||
typedef unsigned long long RContext;
|
||||
typedef unsigned long long RContextAttributes;
|
||||
typedef unsigned long long Region;
|
||||
typedef unsigned long long XRectangle;
|
||||
typedef unsigned long long Cursor;
|
||||
typedef unsigned long long XEvent;
|
||||
typedef unsigned long long XKeyEvent;
|
||||
typedef unsigned long long XErrorEvent;
|
||||
typedef unsigned long long KeySym;
|
||||
typedef unsigned long long XIMStyle;
|
||||
|
||||
#define None 0
|
||||
#define NormalState 0
|
||||
#define WithdrawnState 0
|
||||
#define IsViewable 0
|
||||
#define False 0
|
||||
|
||||
#endif
|
||||
|
150
Headers/xheadless/XWindowBuffer.h
Normal file
150
Headers/xheadless/XWindowBuffer.h
Normal file
|
@ -0,0 +1,150 @@
|
|||
/*
|
||||
Copyright (C) 2002, 2005 Free Software Foundation, Inc.
|
||||
|
||||
Author: Alexander Malmberg <alexander@malmberg.org>
|
||||
|
||||
This file is part of GNUstep.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef XWindowBuffer_h
|
||||
#define XWindowBuffer_h
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#define XShmSegmentInfo int
|
||||
|
||||
typedef unsigned long long XImage;
|
||||
typedef unsigned char Bool;
|
||||
|
||||
struct XWindowBuffer_depth_info_s
|
||||
{
|
||||
/* The drawing depth according to X. Usually the number of bits of color
|
||||
data in each pixel. */
|
||||
int drawing_depth;
|
||||
|
||||
/* The number of bytes used by a pixel. There is generally no
|
||||
relationship between this and drawing_depth, except that
|
||||
bytes_per_pixel*8>=drawing_depth. (Eg. 32-bit modes usually have a
|
||||
drawing depth of 24.) */
|
||||
int bytes_per_pixel;
|
||||
|
||||
/* If alpha is to be stored inside the normal data, this should be YES.
|
||||
Otherwise, a separate buffer will be allocated for the alpha data (which
|
||||
never does any harm, but it wastes memory if there's enough space in a
|
||||
pixel, as in 32-bit modes. There needs to be 8 bits available for alpha
|
||||
data at a byte boundary for this to work, though. (This could be fixed,
|
||||
but in the mean time, just setting inline_alpha to NO is easier.)
|
||||
inline_alpha_ofs should be the offset to the byte in each pixel that
|
||||
holds the alpha value. */
|
||||
BOOL inline_alpha;
|
||||
int inline_alpha_ofs;
|
||||
|
||||
/* The byte order used for the buffer. This must be either MSBFirst or
|
||||
LSBFirst. */
|
||||
int byte_order;
|
||||
};
|
||||
|
||||
/*
|
||||
XWindowBuffer maintains an XImage for a window. Each ARTGState that
|
||||
renders to that window uses the same XWindowBuffer (and thus the same
|
||||
buffer, etc.).
|
||||
|
||||
Many states might render to the same window, so we need to make sure
|
||||
that there's only one XWindowBuffer for each window. */
|
||||
@interface XWindowBuffer : NSObject
|
||||
{
|
||||
@public
|
||||
gswindow_device_t *window;
|
||||
|
||||
@private
|
||||
GC gc;
|
||||
Drawable drawable;
|
||||
XImage *ximage;
|
||||
Display *display;
|
||||
Pixmap pixmap;
|
||||
|
||||
int use_shm;
|
||||
XShmSegmentInfo shminfo;
|
||||
|
||||
|
||||
struct XWindowBuffer_depth_info_s DI;
|
||||
|
||||
|
||||
/* While a XShmPutImage is in progress we don't try to call it
|
||||
again. The pending updates are stored here, and when we get the
|
||||
ShmCompletion event, we handle them. */
|
||||
int pending_put; /* There are pending updates */
|
||||
struct
|
||||
{
|
||||
int x, y, w, h;
|
||||
} pending_rect; /* in this rectangle. */
|
||||
|
||||
int pending_event; /* We're waiting for the ShmCompletion event. */
|
||||
|
||||
|
||||
/* This is for the ugly shape-hack */
|
||||
unsigned char *old_shape;
|
||||
int old_shape_size;
|
||||
|
||||
@public
|
||||
unsigned char *data;
|
||||
int sx, sy;
|
||||
int bytes_per_line, bits_per_pixel, bytes_per_pixel;
|
||||
|
||||
/* If has_alpha is 1 and alpha is NULL, the alpha is stored in data
|
||||
somehow. The drawing mechanism code should know how to deal with
|
||||
it. A separate alpha buffer will always be exactly the right size,
|
||||
so each row is sx bytes long.
|
||||
|
||||
If has_alpha is 0, the window is assumed to be completely opaque.
|
||||
*/
|
||||
unsigned char *alpha;
|
||||
int has_alpha;
|
||||
}
|
||||
|
||||
/*
|
||||
Returns a _retained_ XWindowBuffer for the specified gswindow_device_t.
|
||||
|
||||
The depth info is only used if a new XWindowBuffer needs to be allocated.
|
||||
*/
|
||||
+ windowBufferForWindow: (gswindow_device_t *)awindow
|
||||
depthInfo: (struct XWindowBuffer_depth_info_s *)aDI;
|
||||
|
||||
/*
|
||||
Note that alpha is _not_ guaranteed to exist after this has been called;
|
||||
you still need to check has_alpha. If the call fails, a message will be
|
||||
logged.
|
||||
|
||||
(In ARTGState, I handle failures by simply ignoring the operation that
|
||||
required alpha.)
|
||||
|
||||
The alpha channel is initialized to being completely opaque when first
|
||||
created.
|
||||
*/
|
||||
-(void) needsAlpha;
|
||||
|
||||
-(void) _gotShmCompletion;
|
||||
-(void) _exposeRect: (NSRect)r;
|
||||
+(void) _gotShmCompletion: (Drawable)d;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
#endif
|
||||
|
53
Source/headlesslib/GNUmakefile
Normal file
53
Source/headlesslib/GNUmakefile
Normal file
|
@ -0,0 +1,53 @@
|
|||
# Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
#
|
||||
# Author: Banlu Kemiyatorn <object at gmail dot com>
|
||||
#
|
||||
# This file is part of the GNUstep Backend.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser 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
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; see the file COPYING.LIB.
|
||||
# If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
# Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
|
||||
PACKAGE_NAME = gnustep-back
|
||||
GNUSTEP_LOCAL_ADDITIONAL_MAKEFILES=../../back.make
|
||||
include $(GNUSTEP_MAKEFILES)/common.make
|
||||
|
||||
include ../../config.make
|
||||
|
||||
SUBPROJECT_NAME=headlesslib
|
||||
|
||||
# The Objective-C source files to be compiled
|
||||
headlesslib_OBJC_FILES = \
|
||||
HeadlessSurface.m \
|
||||
HeadlessFontInfo.m \
|
||||
HeadlessGState.m \
|
||||
HeadlessContext.m \
|
||||
HeadlessFontEnumerator.m \
|
||||
HeadlessFaceInfo.m \
|
||||
|
||||
|
||||
|
||||
ifeq ($(BUILD_SERVER),xheadless)
|
||||
headlesslib_OBJC_FILES += HeadlessModernSurface.m
|
||||
endif
|
||||
|
||||
headlesslib_OBJC_FILES +=
|
||||
|
||||
-include GNUmakefile.preamble
|
||||
|
||||
include $(GNUSTEP_MAKEFILES)/subproject.make
|
||||
|
||||
-include GNUmakefile.postamble
|
||||
|
52
Source/headlesslib/GNUmakefile.preamble
Normal file
52
Source/headlesslib/GNUmakefile.preamble
Normal file
|
@ -0,0 +1,52 @@
|
|||
#
|
||||
# GNUmakefile.preamble
|
||||
#
|
||||
# Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
#
|
||||
# Author: Adam Fedor <fedor@gnu.org>
|
||||
#
|
||||
# This file is part of the GNUstep Backend.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser 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
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; see the file COPYING.LIB.
|
||||
# If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
# Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
|
||||
#
|
||||
# Flags dealing with compiling and linking
|
||||
#
|
||||
|
||||
# Additional flags to pass to the preprocessor
|
||||
ADDITIONAL_CPPFLAGS += -Wall $(CONFIG_SYSTEM_DEFS)
|
||||
|
||||
# Additional flags to pass to the Objective-C compiler
|
||||
#ADDITIONAL_OBJCFLAGS =
|
||||
|
||||
# Additional flags to pass to the C compiler
|
||||
#ADDITIONAL_CFLAGS =
|
||||
|
||||
# Additional include directories the compiler should search
|
||||
ADDITIONAL_INCLUDE_DIRS = -I../../Headers \
|
||||
-I../$(GNUSTEP_TARGET_DIR) $(GRAPHIC_CFLAGS) \
|
||||
|
||||
# Additional LDFLAGS to pass to the linker
|
||||
#ADDITIONAL_LDFLAGS =
|
||||
|
||||
# Additional library directories the linker should search
|
||||
#ADDITIONAL_LIB_DIRS =
|
||||
|
||||
#
|
||||
# Flags dealing with installing and uninstalling
|
||||
#
|
||||
|
190
Source/headlesslib/HeadlessContext.m
Normal file
190
Source/headlesslib/HeadlessContext.m
Normal file
|
@ -0,0 +1,190 @@
|
|||
/*
|
||||
HeadlessContext.m
|
||||
|
||||
Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
|
||||
August 31, 2003
|
||||
Written by Banlu Kemiyatorn <object at gmail dot com>
|
||||
|
||||
This file is part of GNUstep.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <AppKit/NSBitmapImageRep.h>
|
||||
#include <AppKit/NSGraphics.h>
|
||||
#include <AppKit/NSPrintInfo.h>
|
||||
#include <AppKit/NSPrintOperation.h>
|
||||
|
||||
#include "headlesslib/HeadlessGState.h"
|
||||
#include "headlesslib/HeadlessContext.h"
|
||||
#include "headlesslib/HeadlessSurface.h"
|
||||
#include "headlesslib/HeadlessFontInfo.h"
|
||||
#include "headlesslib/HeadlessFontEnumerator.h"
|
||||
#include "config.h"
|
||||
|
||||
#define CGSTATE ((HeadlessGState *)gstate)
|
||||
|
||||
|
||||
#define _CAIRO_GSTATE_CLASSNAME HeadlessGState
|
||||
#define _CAIRO_SURFACE_CLASSNAME HeadlessModernSurface
|
||||
#include "headlesslib/HeadlessModernSurface.h"
|
||||
|
||||
@implementation HeadlessContext
|
||||
|
||||
+ (void) initializeBackend
|
||||
{
|
||||
[NSGraphicsContext setDefaultContextClass: self];
|
||||
|
||||
[GSFontEnumerator setDefaultClass: [HeadlessFontEnumerator class]];
|
||||
[GSFontInfo setDefaultClass: [HeadlessFontInfo class]];
|
||||
}
|
||||
|
||||
+ (Class) GStateClass
|
||||
{
|
||||
return [_CAIRO_GSTATE_CLASSNAME class];
|
||||
}
|
||||
|
||||
+ (BOOL) handlesPS
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL) supportsDrawGState
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (id) initWithContextInfo: (NSDictionary *)info
|
||||
{
|
||||
self = [super initWithContextInfo:info];
|
||||
if (self)
|
||||
{
|
||||
[self setImageInterpolation:NSImageInterpolationDefault];
|
||||
}
|
||||
return(self);
|
||||
}
|
||||
|
||||
- (BOOL) isDrawingToScreen
|
||||
{
|
||||
HeadlessSurface *surface = nil;
|
||||
[CGSTATE GSCurrentSurface: &surface : NULL : NULL];
|
||||
return [surface isDrawingToScreen];
|
||||
}
|
||||
|
||||
- (void) flushGraphics
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/* Private backend methods */
|
||||
+ (void) handleExposeRect: (NSRect)rect forDriver: (void *)driver
|
||||
{
|
||||
}
|
||||
|
||||
#if BUILD_SERVER == SERVER_x11
|
||||
|
||||
#ifdef XSHM
|
||||
|
||||
+ (void) _gotShmCompletion: (Drawable)d
|
||||
{
|
||||
}
|
||||
|
||||
- (void) gotShmCompletion: (Drawable)d
|
||||
{
|
||||
}
|
||||
|
||||
#endif // XSHM
|
||||
|
||||
#endif // BUILD_SERVER = SERVER_x11
|
||||
|
||||
@end
|
||||
|
||||
@implementation HeadlessContext (Ops)
|
||||
|
||||
- (BOOL) isCompatibleBitmap: (NSBitmapImageRep*)bitmap
|
||||
{
|
||||
NSString *colorSpaceName;
|
||||
|
||||
if ([bitmap bitmapFormat] != 0)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
if ([bitmap isPlanar])
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
if ([bitmap bitsPerSample] != 8)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
colorSpaceName = [bitmap colorSpaceName];
|
||||
if (![colorSpaceName isEqualToString: NSDeviceRGBColorSpace] &&
|
||||
![colorSpaceName isEqualToString: NSCalibratedRGBColorSpace])
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
else
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
||||
- (void) GSCurrentDevice: (void **)device : (int *)x : (int *)y
|
||||
{
|
||||
HeadlessSurface *surface;
|
||||
|
||||
[CGSTATE GSCurrentSurface: &surface : x : y];
|
||||
if (device)
|
||||
{
|
||||
*device = surface->gsDevice;
|
||||
}
|
||||
}
|
||||
|
||||
- (void) GSSetDevice: (void *)device : (int)x : (int)y
|
||||
{
|
||||
HeadlessSurface *surface;
|
||||
|
||||
surface = [[_CAIRO_SURFACE_CLASSNAME alloc] initWithDevice: device];
|
||||
|
||||
[CGSTATE GSSetSurface: surface : x : y];
|
||||
[surface release];
|
||||
}
|
||||
|
||||
- (void) beginPrologueBBox: (NSRect)boundingBox
|
||||
creationDate: (NSString*)dateCreated
|
||||
createdBy: (NSString*)anApplication
|
||||
fonts: (NSString*)fontNames
|
||||
forWhom: (NSString*)user
|
||||
pages: (int)numPages
|
||||
title: (NSString*)aTitle
|
||||
{
|
||||
}
|
||||
|
||||
- (void) showPage
|
||||
{
|
||||
[CGSTATE showPage];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#undef _CAIRO_SURFACE_CLASSNAME
|
||||
#undef _CAIRO_GSTATE_CLASSNAME
|
||||
|
45
Source/headlesslib/HeadlessFaceInfo.m
Normal file
45
Source/headlesslib/HeadlessFaceInfo.m
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
CairoFaceInfo.m
|
||||
|
||||
Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
|
||||
August 31, 2003
|
||||
Written by Banlu Kemiyatorn <object at gmail dot com>
|
||||
Base on original code of Alex Malmberg
|
||||
Rewrite: Fred Kiefer <fredkiefer@gmx.de>
|
||||
Date: Jan 2006
|
||||
|
||||
This file is part of GNUstep.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "headlesslib/HeadlessFaceInfo.h"
|
||||
|
||||
@implementation HeadlessFaceInfo
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void *)fontFace
|
||||
{
|
||||
return _fontFace;
|
||||
}
|
||||
|
||||
@end
|
51
Source/headlesslib/HeadlessFontEnumerator.m
Normal file
51
Source/headlesslib/HeadlessFontEnumerator.m
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
HeadlessFontEnumerator.m
|
||||
|
||||
Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
|
||||
August 31, 2003
|
||||
Written by Banlu Kemiyatorn <object at gmail dot com>
|
||||
Base on original code of Alex Malmberg
|
||||
Rewrite: Fred Kiefer <fredkiefer@gmx.de>
|
||||
Date: Jan 2006
|
||||
|
||||
This file is part of GNUstep.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "headlesslib/HeadlessFontEnumerator.h"
|
||||
#include "headlesslib/HeadlessFontInfo.h"
|
||||
|
||||
@implementation HeadlessFontEnumerator
|
||||
|
||||
+ (Class) faceInfoClass
|
||||
{
|
||||
return [HeadlessFaceInfo class];
|
||||
}
|
||||
|
||||
+ (HeadlessFaceInfo *) fontWithName: (NSString *) name
|
||||
{
|
||||
return (HeadlessFaceInfo *) [super fontWithName: name];
|
||||
}
|
||||
|
||||
- (void)enumerateFontsAndFamilies
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
|
111
Source/headlesslib/HeadlessFontInfo.m
Normal file
111
Source/headlesslib/HeadlessFontInfo.m
Normal file
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
HeadlessFontInfo.m
|
||||
|
||||
Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
|
||||
August 31, 2003
|
||||
Written by Banlu Kemiyatorn <object at gmail dot com>
|
||||
Base on original code of Alex Malmberg
|
||||
|
||||
This file is part of GNUstep.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "GNUstepBase/Unicode.h"
|
||||
#include <AppKit/NSAffineTransform.h>
|
||||
#include <AppKit/NSBezierPath.h>
|
||||
#include "headlesslib/HeadlessFontInfo.h"
|
||||
#include "headlesslib/HeadlessFontEnumerator.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
typedef void *cairo_t;
|
||||
|
||||
@implementation HeadlessFontInfo
|
||||
|
||||
- (BOOL) setupAttributes
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (id) initWithFontName: (NSString *)name
|
||||
matrix: (const CGFloat *)fmatrix
|
||||
screenFont: (BOOL)p_screenFont
|
||||
{
|
||||
self = [super init];
|
||||
if (!self)
|
||||
return nil;
|
||||
|
||||
fontName = [name copy];
|
||||
memcpy(matrix, fmatrix, sizeof(matrix));
|
||||
|
||||
if (![self setupAttributes])
|
||||
{
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (BOOL) glyphIsEncoded: (NSGlyph)glyph
|
||||
{
|
||||
/* FIXME: There is no proper way to determine with the toy font API,
|
||||
whether a glyph is supported or not. We will just ignore ligatures
|
||||
and report all other glyph as existing.
|
||||
return !NSEqualSizes([self advancementForGlyph: glyph], NSZeroSize);
|
||||
*/
|
||||
if ((glyph >= 0xFB00) && (glyph <= 0xFB05))
|
||||
return NO;
|
||||
else
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (NSSize) advancementForGlyph: (NSGlyph)glyph
|
||||
{
|
||||
return NSZeroSize;
|
||||
}
|
||||
|
||||
- (NSRect) boundingRectForGlyph: (NSGlyph)glyph
|
||||
{
|
||||
return NSZeroRect;
|
||||
}
|
||||
|
||||
- (CGFloat) widthOfString: (NSString *)string
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
- (void) appendBezierPathWithGlyphs: (NSGlyph *)glyphs
|
||||
count: (int)length
|
||||
toBezierPath: (NSBezierPath *)path
|
||||
{
|
||||
}
|
||||
|
||||
- (void) drawGlyphs: (const NSGlyph*)glyphs
|
||||
length: (int)length
|
||||
on: (cairo_t*)ct
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
340
Source/headlesslib/HeadlessGState.m
Normal file
340
Source/headlesslib/HeadlessGState.m
Normal file
|
@ -0,0 +1,340 @@
|
|||
|
||||
/*
|
||||
HeadlessGState.m
|
||||
|
||||
Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
|
||||
August 31, 2003
|
||||
Written by Banlu Kemiyatorn <object at gmail dot com>
|
||||
Rewrite: Fred Kiefer <fredkiefer@gmx.de>
|
||||
Date: Jan 2006
|
||||
|
||||
This file is part of GNUstep.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <AppKit/NSAffineTransform.h>
|
||||
#include <AppKit/NSBezierPath.h>
|
||||
#include <AppKit/NSColor.h>
|
||||
#include <AppKit/NSGradient.h>
|
||||
#include <AppKit/NSGraphics.h>
|
||||
#include "headlesslib/HeadlessGState.h"
|
||||
#include "headlesslib/HeadlessFontInfo.h"
|
||||
#include "headlesslib/HeadlessSurface.h"
|
||||
#include "headlesslib/HeadlessContext.h"
|
||||
#include <math.h>
|
||||
|
||||
|
||||
// Macro stolen from base/Header/Additions/GNUstepBase/GSObjRuntime.h
|
||||
#ifndef GS_MAX_OBJECTS_FROM_STACK
|
||||
/**
|
||||
* The number of objects to try to get from varargs into an array on
|
||||
* the stack ... if there are more than this, use the heap.
|
||||
* NB. This MUST be a multiple of 2
|
||||
*/
|
||||
#define GS_MAX_OBJECTS_FROM_STACK 128
|
||||
#endif
|
||||
|
||||
// Macros stolen from base/Source/GSPrivate.h
|
||||
/**
|
||||
* Macro to manage memory for chunks of code that need to work with
|
||||
* arrays of items. Use this to start the block of code using
|
||||
* the array and GS_ENDITEMBUF() to end it. The idea is to ensure that small
|
||||
* arrays are allocated on the stack (for speed), but large arrays are
|
||||
* allocated from the heap (to avoid stack overflow).
|
||||
*/
|
||||
#define GS_BEGINITEMBUF(P, S, T) { \
|
||||
T _ibuf[(S) <= GS_MAX_OBJECTS_FROM_STACK ? (S) : 0]; \
|
||||
T *_base = ((S) <= GS_MAX_OBJECTS_FROM_STACK) ? _ibuf \
|
||||
: (T*)NSZoneMalloc(NSDefaultMallocZone(), (S) * sizeof(T)); \
|
||||
T *(P) = _base;
|
||||
|
||||
/**
|
||||
* Macro to manage memory for chunks of code that need to work with
|
||||
* arrays of items. Use GS_BEGINITEMBUF() to start the block of code using
|
||||
* the array and this macro to end it.
|
||||
*/
|
||||
#define GS_ENDITEMBUF() \
|
||||
if (_base != _ibuf) \
|
||||
NSZoneFree(NSDefaultMallocZone(), _base); \
|
||||
}
|
||||
|
||||
@implementation HeadlessGState
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
if (self == [HeadlessGState class])
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE(_surface);
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSString*) description
|
||||
{
|
||||
NSMutableString *description = [[[super description] mutableCopy] autorelease];
|
||||
[description appendFormat: @" surface: %@",_surface];
|
||||
[description appendFormat: @" context: %p",_ct];
|
||||
return [[description copy] autorelease];
|
||||
}
|
||||
|
||||
- (id) copyWithZone: (NSZone *)zone
|
||||
{
|
||||
HeadlessGState *copy = (HeadlessGState *)[super copyWithZone: zone];
|
||||
return copy;
|
||||
}
|
||||
|
||||
- (void) GSCurrentSurface: (HeadlessSurface **)surface : (int *)x : (int *)y
|
||||
{
|
||||
if (x)
|
||||
*x = offset.x;
|
||||
if (y)
|
||||
*y = offset.y;
|
||||
if (surface)
|
||||
{
|
||||
*surface = _surface;
|
||||
}
|
||||
}
|
||||
|
||||
- (void) GSSetSurface: (HeadlessSurface *)surface : (int)x : (int)y
|
||||
{
|
||||
ASSIGN(_surface, surface);
|
||||
[self setOffset: NSMakePoint(x, y)];
|
||||
[self DPSinitgraphics];
|
||||
}
|
||||
|
||||
- (void) setOffset: (NSPoint)theOffset
|
||||
{
|
||||
[super setOffset: theOffset];
|
||||
}
|
||||
|
||||
- (void) showPage
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Color operations
|
||||
*/
|
||||
- (void) GSSetPatterColor: (NSImage*)image
|
||||
{
|
||||
// FIXME: Create a cairo surface from the image and set it as source.
|
||||
[super GSSetPatterColor: image];
|
||||
}
|
||||
|
||||
/*
|
||||
* Text operations
|
||||
*/
|
||||
|
||||
- (void) _setPoint
|
||||
{
|
||||
}
|
||||
|
||||
- (void) DPScharpath: (const char *)s : (int)b
|
||||
{
|
||||
}
|
||||
|
||||
- (void) DPSshow: (const char *)s
|
||||
{
|
||||
}
|
||||
|
||||
- (void) GSSetFont: (GSFontInfo *)fontref
|
||||
{
|
||||
[super GSSetFont: fontref];
|
||||
}
|
||||
|
||||
- (void) GSSetFontSize: (CGFloat)size
|
||||
{
|
||||
}
|
||||
|
||||
- (void) GSShowText: (const char *)string : (size_t)length
|
||||
{
|
||||
}
|
||||
|
||||
- (void) GSShowGlyphsWithAdvances: (const NSGlyph *)glyphs : (const NSSize *)advances : (size_t) length
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* GState operations
|
||||
*/
|
||||
|
||||
- (void) DPSinitgraphics
|
||||
{
|
||||
[super DPSinitgraphics];
|
||||
}
|
||||
|
||||
- (void) DPScurrentflat: (CGFloat *)flatness
|
||||
{
|
||||
}
|
||||
|
||||
- (void) DPScurrentlinecap: (int *)linecap
|
||||
{
|
||||
}
|
||||
|
||||
- (void) DPScurrentlinejoin: (int *)linejoin
|
||||
{
|
||||
}
|
||||
|
||||
- (void) DPScurrentlinewidth: (CGFloat *)width
|
||||
{
|
||||
}
|
||||
|
||||
- (void) DPScurrentmiterlimit: (CGFloat *)limit
|
||||
{
|
||||
}
|
||||
|
||||
- (void) DPScurrentstrokeadjust: (int *)b
|
||||
{
|
||||
}
|
||||
|
||||
- (void) DPSsetdash: (const CGFloat *)pat : (NSInteger)size : (CGFloat)foffset
|
||||
{
|
||||
}
|
||||
|
||||
- (void) DPSsetflat: (CGFloat)flatness
|
||||
{
|
||||
[super DPSsetflat: flatness];
|
||||
}
|
||||
|
||||
- (void) DPSsetlinecap: (int)linecap
|
||||
{
|
||||
}
|
||||
|
||||
- (void) DPSsetlinejoin: (int)linejoin
|
||||
{
|
||||
}
|
||||
|
||||
- (void) DPSsetlinewidth: (CGFloat)width
|
||||
{
|
||||
}
|
||||
|
||||
- (void) DPSsetmiterlimit: (CGFloat)limit
|
||||
{
|
||||
}
|
||||
|
||||
- (void) DPSsetstrokeadjust: (int)b
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Path operations
|
||||
*/
|
||||
|
||||
- (void) _setPath
|
||||
{
|
||||
}
|
||||
|
||||
- (void) DPSclip
|
||||
{
|
||||
}
|
||||
|
||||
- (void) DPSeoclip
|
||||
{
|
||||
}
|
||||
|
||||
- (void) DPSeofill
|
||||
{
|
||||
}
|
||||
|
||||
- (void) DPSfill
|
||||
{
|
||||
}
|
||||
|
||||
- (void) DPSinitclip
|
||||
{
|
||||
}
|
||||
|
||||
- (void) DPSstroke
|
||||
{
|
||||
}
|
||||
|
||||
- (NSDictionary *) GSReadRect: (NSRect)r
|
||||
{
|
||||
return [NSDictionary dictionary];
|
||||
}
|
||||
|
||||
- (void) DPSimage: (NSAffineTransform *)matrix : (NSInteger)pixelsWide
|
||||
: (NSInteger)pixelsHigh : (NSInteger)bitsPerSample
|
||||
: (NSInteger)samplesPerPixel : (NSInteger)bitsPerPixel
|
||||
: (NSInteger)bytesPerRow : (BOOL)isPlanar
|
||||
: (BOOL)hasAlpha : (NSString *)colorSpaceName
|
||||
: (const unsigned char *const[5])data
|
||||
{
|
||||
}
|
||||
|
||||
- (void) compositerect: (NSRect)aRect op: (NSCompositingOperation)op
|
||||
{
|
||||
}
|
||||
|
||||
- (void) compositeGState: (HeadlessGState *)source
|
||||
fromRect: (NSRect)srcRect
|
||||
toPoint: (NSPoint)destPoint
|
||||
op: (NSCompositingOperation)op
|
||||
fraction: (CGFloat)delta
|
||||
{
|
||||
}
|
||||
|
||||
/** Unlike -compositeGState, -drawGSstate fully respects the AppKit CTM but
|
||||
doesn't support to use the receiver cairo target as the source. */
|
||||
- (void) drawGState: (HeadlessGState *)source
|
||||
fromRect: (NSRect)aRect
|
||||
toPoint: (NSPoint)aPoint
|
||||
op: (NSCompositingOperation)op
|
||||
fraction: (CGFloat)delta
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation HeadlessGState (PatternColor)
|
||||
|
||||
- (void *) saveClip
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- (void) restoreClip: (void *)savedClip
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation HeadlessGState (NSGradient)
|
||||
|
||||
- (void) drawGradient: (NSGradient*)gradient
|
||||
fromCenter: (NSPoint)startCenter
|
||||
radius: (CGFloat)startRadius
|
||||
toCenter: (NSPoint)endCenter
|
||||
radius: (CGFloat)endRadius
|
||||
options: (NSUInteger)options
|
||||
{
|
||||
}
|
||||
|
||||
- (void) drawGradient: (NSGradient*)gradient
|
||||
fromPoint: (NSPoint)startPoint
|
||||
toPoint: (NSPoint)endPoint
|
||||
options: (NSUInteger)options
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
54
Source/headlesslib/HeadlessModernSurface.m
Normal file
54
Source/headlesslib/HeadlessModernSurface.m
Normal file
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
|
||||
Author: Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
This file is part of GNUstep.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "xheadless/XGServer.h"
|
||||
#include "xheadless/XGServerWindow.h"
|
||||
#include "headlesslib/HeadlessModernSurface.h"
|
||||
|
||||
#define GSWINDEVICE ((gswindow_device_t *)gsDevice)
|
||||
|
||||
@implementation HeadlessModernSurface
|
||||
|
||||
- (id) initWithDevice: (void *)device
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSSize) size
|
||||
{
|
||||
return GSWINDEVICE->xframe.size;
|
||||
}
|
||||
|
||||
- (void) handleExposeRect: (NSRect)rect
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
|
72
Source/headlesslib/HeadlessSurface.m
Normal file
72
Source/headlesslib/HeadlessSurface.m
Normal file
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
|
||||
Author: Banlu Kemiyatorn <object at gmail dot com>
|
||||
|
||||
This file is part of GNUstep.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "headlesslib/HeadlessSurface.h"
|
||||
|
||||
@implementation HeadlessSurface
|
||||
|
||||
- (id) initWithDevice: (void *) device
|
||||
{
|
||||
/* TODO FIXME make a more abstract struct for the device */
|
||||
[self subclassResponsibility:_cmd];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSString *) description
|
||||
{
|
||||
return [NSString stringWithFormat:@"<%@ %p xr:%p>", [self class], self, _surface];
|
||||
}
|
||||
|
||||
-(NSSize) size
|
||||
{
|
||||
[self subclassResponsibility:_cmd];
|
||||
return NSMakeSize(0, 0);
|
||||
}
|
||||
|
||||
- (void) setSize: (NSSize)newSize
|
||||
{
|
||||
[self subclassResponsibility:_cmd];
|
||||
}
|
||||
|
||||
- (cairo_surface_t *) surface
|
||||
{
|
||||
return _surface;
|
||||
}
|
||||
|
||||
- (void) handleExposeRect: (NSRect)rect
|
||||
{
|
||||
}
|
||||
|
||||
- (BOOL) isDrawingToScreen
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
46
Source/xheadless/GNUmakefile
Normal file
46
Source/xheadless/GNUmakefile
Normal file
|
@ -0,0 +1,46 @@
|
|||
#
|
||||
# Main makefile for GNUstep Backend x11
|
||||
#
|
||||
# Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
#
|
||||
# Author: Adam Fedor <fedor@gnu.org>
|
||||
#
|
||||
# This file is part of the GNUstep Backend.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser 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
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; see the file COPYING.LIB.
|
||||
# If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
# Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
|
||||
PACKAGE_NAME = gnustep-back
|
||||
GNUSTEP_LOCAL_ADDITIONAL_MAKEFILES=../../back.make
|
||||
|
||||
include $(GNUSTEP_MAKEFILES)/common.make
|
||||
|
||||
include ../../config.make
|
||||
|
||||
# The library to be compiled, as a library or as a bundle
|
||||
SUBPROJECT_NAME=xheadless
|
||||
|
||||
# The Objective-C source files to be compiled
|
||||
xheadless_OBJC_FILES = \
|
||||
XGServer.m \
|
||||
XGServerEvent.m \
|
||||
XGServerWindow.m \
|
||||
|
||||
-include GNUmakefile.preamble
|
||||
|
||||
include $(GNUSTEP_MAKEFILES)/subproject.make
|
||||
|
||||
-include GNUmakefile.postamble
|
||||
|
53
Source/xheadless/GNUmakefile.preamble
Normal file
53
Source/xheadless/GNUmakefile.preamble
Normal file
|
@ -0,0 +1,53 @@
|
|||
#
|
||||
# GNUmakefile.preamble
|
||||
#
|
||||
# Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
#
|
||||
# Author: Adam Fedor <fedor@gnu.org>
|
||||
#
|
||||
# This file is part of the GNUstep Backend.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser 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
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; see the file COPYING.LIB.
|
||||
# If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
# Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
|
||||
#
|
||||
# Flags dealing with compiling and linking
|
||||
#
|
||||
|
||||
# Additional flags to pass to the preprocessor
|
||||
ADDITIONAL_CPPFLAGS += -Wall $(CONFIG_SYSTEM_DEFS)
|
||||
|
||||
# Additional flags to pass to the Objective-C compiler
|
||||
ADDITIONAL_OBJCFLAGS =
|
||||
|
||||
# Additional flags to pass to the C compiler
|
||||
ADDITIONAL_CFLAGS =
|
||||
|
||||
# Additional include directories the compiler should search
|
||||
ADDITIONAL_INCLUDE_DIRS += -I../../Headers \
|
||||
-I../$(GNUSTEP_TARGET_DIR) $(GRAPHIC_CFLAGS)
|
||||
|
||||
# Additional LDFLAGS to pass to the linker
|
||||
ADDITIONAL_LDFLAGS =
|
||||
|
||||
# Additional library directories the linker should search
|
||||
ADDITIONAL_LIB_DIRS =
|
||||
|
||||
#
|
||||
# Flags dealing with installing and uninstalling
|
||||
#
|
||||
|
||||
|
384
Source/xheadless/XGServer.m
Normal file
384
Source/xheadless/XGServer.m
Normal file
|
@ -0,0 +1,384 @@
|
|||
/* -*- mode:ObjC -*-
|
||||
XGServer - X11 Server Class
|
||||
|
||||
Copyright (C) 1998,2002 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Adam Fedor <fedor@gnu.org>
|
||||
Date: Mar 2002
|
||||
|
||||
This file is part of the GNU Objective C User Interface Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <AppKit/AppKitExceptions.h>
|
||||
#include <AppKit/NSApplication.h>
|
||||
#include <AppKit/NSView.h>
|
||||
#include <AppKit/NSWindow.h>
|
||||
#include <Foundation/NSException.h>
|
||||
#include <Foundation/NSArray.h>
|
||||
#include <Foundation/NSConnection.h>
|
||||
#include <Foundation/NSDictionary.h>
|
||||
#include <Foundation/NSData.h>
|
||||
#include <Foundation/NSRunLoop.h>
|
||||
#include <Foundation/NSValue.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#include <Foundation/NSUserDefaults.h>
|
||||
#include <Foundation/NSDebug.h>
|
||||
|
||||
#include <signal.h>
|
||||
/* Terminate cleanly if we get a signal to do so */
|
||||
static void
|
||||
terminate(int sig)
|
||||
{
|
||||
if (nil != NSApp)
|
||||
{
|
||||
[NSApp terminate: NSApp];
|
||||
}
|
||||
else
|
||||
{
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
#include "xheadless/XGServer.h"
|
||||
#include "xheadless/XGInputServer.h"
|
||||
|
||||
extern int XGErrorHandler(Display *display, XErrorEvent *err);
|
||||
|
||||
@interface XGServer (Window)
|
||||
- (void) _setupRootWindow;
|
||||
@end
|
||||
|
||||
@interface XGServer (Private)
|
||||
- (void) setupRunLoopInputSourcesForMode: (NSString*)mode;
|
||||
@end
|
||||
|
||||
@interface XGScreenContext : NSObject
|
||||
{
|
||||
RContext *rcontext;
|
||||
XGDrawMechanism drawMechanism;
|
||||
}
|
||||
|
||||
- initForDisplay: (Display *)dpy screen: (int)screen_number;
|
||||
- (XGDrawMechanism) drawMechanism;
|
||||
- (RContext *) context;
|
||||
@end
|
||||
|
||||
@implementation XGScreenContext
|
||||
|
||||
- (RContextAttributes *) _getXDefaults
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- initForDisplay: (Display *)dpy screen: (int)screen_number
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (XGDrawMechanism) drawMechanism
|
||||
{
|
||||
return drawMechanism;
|
||||
}
|
||||
|
||||
- (RContext *) context
|
||||
{
|
||||
return rcontext;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
/**
|
||||
<unit>
|
||||
<heading>XGServer</heading>
|
||||
|
||||
<p> XGServer is a concrete subclass of GSDisplayServer that handles
|
||||
X-Window client communications. The class is broken into four sections.
|
||||
The main class handles setting up and closing down the display, as well
|
||||
as providing wrapper methods to access display and screen pointers. The
|
||||
WindowOps category handles window creating, display, movement, and
|
||||
other functions detailed in the GSDisplayServer(WindowOps) category.
|
||||
The EventOps category handles events received from X-Windows and the
|
||||
window manager. It implements the methods defined in the
|
||||
GSDisplayServer(EventOps) category. The last section
|
||||
</unit>
|
||||
*/
|
||||
@implementation XGServer
|
||||
|
||||
/* Initialize AppKit backend */
|
||||
+ (void) initializeBackend
|
||||
{
|
||||
NSDebugLog(@"Initializing GNUstep x11 backend.\n");
|
||||
[GSDisplayServer setDefaultServerClass: [XGServer class]];
|
||||
signal(SIGTERM, terminate);
|
||||
signal(SIGINT, terminate);
|
||||
}
|
||||
|
||||
/**
|
||||
Returns a pointer to the current X-Windows display variable for
|
||||
the current context.
|
||||
*/
|
||||
+ (Display*) currentXDisplay
|
||||
{
|
||||
return [(XGServer*)GSCurrentServer() xDisplay];
|
||||
}
|
||||
|
||||
- (id) _initXContext
|
||||
{
|
||||
int screen_number = 0, display_number = 0;
|
||||
NSString *display_name;
|
||||
|
||||
display_name = [server_info objectForKey: GSDisplayName];
|
||||
if (display_name == nil)
|
||||
{
|
||||
NSString *host = [[NSUserDefaults standardUserDefaults]
|
||||
stringForKey: @"NSHost"];
|
||||
NSString *dn = [server_info objectForKey: GSDisplayNumber];
|
||||
NSString *sn = [server_info objectForKey: GSScreenNumber];
|
||||
|
||||
if (dn || sn)
|
||||
{
|
||||
if (dn == NULL)
|
||||
dn = @"0";
|
||||
if (sn == NULL)
|
||||
sn = @"0";
|
||||
if (host == nil)
|
||||
host = @"";
|
||||
display_name = [NSString stringWithFormat: @"%@:%@.%@", host, dn,sn];
|
||||
}
|
||||
else if ((host != nil) && ([host isEqual: @""] == NO))
|
||||
{
|
||||
/**
|
||||
* If the NSHost default told us to display somewhere, we need
|
||||
* to generate a display name for X from the host name and the
|
||||
* default display and screen numbers (zero).
|
||||
*/
|
||||
display_name = [NSString stringWithFormat: @"%@:0.0", host];
|
||||
}
|
||||
}
|
||||
|
||||
dpy = malloc(sizeof(Display)); //XOpenDisplay(NULL);
|
||||
|
||||
[server_info setObject: display_name forKey: GSDisplayName];
|
||||
[server_info setObject: [NSNumber numberWithInt: display_number]
|
||||
forKey: GSDisplayNumber];
|
||||
[server_info setObject: [NSNumber numberWithInt: screen_number]
|
||||
forKey: GSScreenNumber];
|
||||
|
||||
/* Setup screen*/
|
||||
if (screenList == NULL)
|
||||
screenList = NSCreateMapTable(NSIntMapKeyCallBacks,
|
||||
NSObjectMapValueCallBacks, 20);
|
||||
|
||||
defScreen = screen_number;
|
||||
|
||||
[self _setupRootWindow];
|
||||
inputServer = nil;
|
||||
return self;
|
||||
}
|
||||
|
||||
/**
|
||||
Opens the X display (using a helper method) and sets up basic
|
||||
display mechanisms, such as visuals and colormaps.
|
||||
*/
|
||||
- (id) initWithAttributes: (NSDictionary *)info
|
||||
{
|
||||
[super initWithAttributes: info];
|
||||
[self _initXContext];
|
||||
|
||||
[self setupRunLoopInputSourcesForMode: NSDefaultRunLoopMode];
|
||||
[self setupRunLoopInputSourcesForMode: NSConnectionReplyMode];
|
||||
[self setupRunLoopInputSourcesForMode: NSModalPanelRunLoopMode];
|
||||
[self setupRunLoopInputSourcesForMode: NSEventTrackingRunLoopMode];
|
||||
return self;
|
||||
}
|
||||
|
||||
/**
|
||||
Closes all X resources, the X display and dealloc other ivars.
|
||||
*/
|
||||
- (void) dealloc
|
||||
{
|
||||
NSDebugLog(@"Destroying X11 Server");
|
||||
DESTROY(inputServer);
|
||||
[self _destroyServerWindows];
|
||||
NSFreeMapTable(screenList);
|
||||
//XCloseDisplay(dpy);
|
||||
free(dpy);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
/**
|
||||
Returns a pointer to the X windows display variable
|
||||
*/
|
||||
- (Display *) xDisplay
|
||||
{
|
||||
return dpy;
|
||||
}
|
||||
|
||||
- (XGScreenContext *) _screenContextForScreen: (int)screen_number
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
/**
|
||||
Returns a pointer to a structure which describes aspects of the
|
||||
X windows display
|
||||
*/
|
||||
- (void *) xrContextForScreen: (int)screen_number
|
||||
{
|
||||
return [[self _screenContextForScreen: screen_number] context];
|
||||
}
|
||||
|
||||
- (Visual *) visualForScreen: (int)screen_number
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- (int) depthForScreen: (int)screen_number
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
Returns the XGDrawMechanism, which roughly describes the depth of
|
||||
the screen and how pixels should be drawn to the screen for maximum
|
||||
speed.
|
||||
*/
|
||||
- (XGDrawMechanism) drawMechanismForScreen: (int)screen_number
|
||||
{
|
||||
return [[self _screenContextForScreen: screen_number] drawMechanism];
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by the art backend to determine the drawing mechanism.
|
||||
*/
|
||||
- (void) getForScreen: (int)screen_number pixelFormat: (int *)bpp_number
|
||||
masks: (int *)red_mask : (int *)green_mask : (int *)blue_mask
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
Returns the root window of the display
|
||||
*/
|
||||
- (Window) xDisplayRootWindowForScreen: (int)screen_number;
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
Returns the closest color in the current colormap to the indicated
|
||||
X color
|
||||
*/
|
||||
- (XColor) xColorFromColor: (XColor)color forScreen: (int)screen_number
|
||||
{
|
||||
return color;
|
||||
}
|
||||
|
||||
/**
|
||||
Returns the application root window, which is used for many things
|
||||
such as window hints
|
||||
*/
|
||||
- (Window) xAppRootWindow
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Wait for all contexts to finish processing. Only used with XDPS graphics.
|
||||
*/
|
||||
+ (void) waitAllContexts
|
||||
{
|
||||
if ([[GSCurrentContext() class]
|
||||
respondsToSelector: @selector(waitAllContexts)])
|
||||
[[GSCurrentContext() class] waitAllContexts];
|
||||
}
|
||||
|
||||
- (void) beep
|
||||
{
|
||||
}
|
||||
|
||||
- glContextClass
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- glPixelFormatClass
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@implementation XGServer (InputMethod)
|
||||
- (NSString *) inputMethodStyle
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSString *) fontSize: (int *)size
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (BOOL) clientWindowRect: (NSRect *)rect
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL) statusArea: (NSRect *)rect
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL) preeditArea: (NSRect *)rect
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL) preeditSpot: (NSPoint *)p
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL) setStatusArea: (NSRect *)rect
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL) setPreeditArea: (NSRect *)rect
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL) setPreeditSpot: (NSPoint *)p
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
@end // XGServer (InputMethod)
|
||||
|
||||
//==== End: Additional Code for NSTextView ====================================
|
369
Source/xheadless/XGServerEvent.m
Normal file
369
Source/xheadless/XGServerEvent.m
Normal file
|
@ -0,0 +1,369 @@
|
|||
/*
|
||||
XGServerEvent - Window/Event code for X11 backends.
|
||||
|
||||
Copyright (C) 1998,1999 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Adam Fedor <fedor@boulder.colorado.edu>
|
||||
Date: Nov 1998
|
||||
|
||||
This file is part of the GNU Objective C User Interface Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <AppKit/AppKitExceptions.h>
|
||||
#include <AppKit/NSApplication.h>
|
||||
#include <AppKit/NSGraphics.h>
|
||||
#include <AppKit/NSMenu.h>
|
||||
#include <AppKit/NSPasteboard.h>
|
||||
#include <AppKit/NSWindow.h>
|
||||
#include <Foundation/NSException.h>
|
||||
#include <Foundation/NSArray.h>
|
||||
#include <Foundation/NSDictionary.h>
|
||||
#include <Foundation/NSData.h>
|
||||
#include <Foundation/NSNotification.h>
|
||||
#include <Foundation/NSValue.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#include <Foundation/NSUserDefaults.h>
|
||||
#include <Foundation/NSRunLoop.h>
|
||||
#include <Foundation/NSDebug.h>
|
||||
|
||||
#include "xheadless/XHeadless.h"
|
||||
#include "xheadless/XGServerWindow.h"
|
||||
#include "xheadless/XGInputServer.h"
|
||||
#include "xheadless/XGGeneric.h"
|
||||
|
||||
#include "math.h"
|
||||
|
||||
#if LIB_FOUNDATION_LIBRARY
|
||||
# include <Foundation/NSPosixFileDescriptor.h>
|
||||
#elif defined(NeXT_PDO)
|
||||
# include <Foundation/NSFileHandle.h>
|
||||
# include <Foundation/NSNotification.h>
|
||||
#endif
|
||||
|
||||
#define cWin ((gswindow_device_t*)generic.cachedWindow)
|
||||
|
||||
#if 0
|
||||
// NumLock's mask (it depends on the keyboard mapping)
|
||||
static unsigned int _num_lock_mask;
|
||||
|
||||
// Modifier state
|
||||
static char _shift_pressed = 0;
|
||||
static char _control_pressed = 0;
|
||||
static char _command_pressed = 0;
|
||||
static char _alt_pressed = 0;
|
||||
static char _help_pressed = 0;
|
||||
|
||||
/*
|
||||
Keys used for the modifiers (you may set them with user preferences).
|
||||
Note that the first and second key sym for a modifier must be different.
|
||||
Otherwise, the _*_pressed tracking will be confused.
|
||||
*/
|
||||
static KeySym _control_keysyms[2];
|
||||
static KeySym _command_keysyms[2];
|
||||
static KeySym _alt_keysyms[2];
|
||||
static KeySym _help_keysyms[2];
|
||||
|
||||
static BOOL _is_keyboard_initialized = NO;
|
||||
static BOOL _mod_ignore_shift = NO;
|
||||
|
||||
static BOOL next_event_is_a_keyrepeat;
|
||||
#endif
|
||||
|
||||
void __objc_xgcontextevent_linking (void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#ifdef XSHM
|
||||
@interface NSGraphicsContext (SharedMemory)
|
||||
-(void) gotShmCompletion: (Drawable)d;
|
||||
@end
|
||||
#endif
|
||||
|
||||
@interface XGServer (Private)
|
||||
- (void) receivedEvent: (void*)data
|
||||
type: (RunLoopEventType)type
|
||||
extra: (void*)extra
|
||||
forMode: (NSString*)mode;
|
||||
- (void) setupRunLoopInputSourcesForMode: (NSString*)mode;
|
||||
- (NSDate*) timedOutEvent: (void*)data
|
||||
type: (RunLoopEventType)type
|
||||
forMode: (NSString*)mode;
|
||||
- (int) XGErrorHandler: (Display*)display : (XErrorEvent*)err;
|
||||
- (void) processEvent: (XEvent *) event;
|
||||
- (NSEvent *)_handleTakeFocusAtom: (XEvent)xEvent
|
||||
forContext: (NSGraphicsContext *)gcontext;
|
||||
@end
|
||||
|
||||
|
||||
int
|
||||
XGErrorHandler(Display *display, XErrorEvent *err)
|
||||
{
|
||||
XGServer *ctxt = (XGServer*)GSCurrentServer();
|
||||
|
||||
return [ctxt XGErrorHandler: display : err];
|
||||
}
|
||||
|
||||
#if 0
|
||||
static NSEvent*process_key_event (XEvent* xEvent, XGServer* ctxt,
|
||||
NSEventType eventType, NSMutableArray *event_queue);
|
||||
|
||||
static unichar process_char (KeySym keysym, unsigned *eventModifierFlags);
|
||||
|
||||
static unsigned process_modifier_flags(unsigned int state);
|
||||
|
||||
static void initialize_keyboard (void);
|
||||
|
||||
static void set_up_num_lock (void);
|
||||
|
||||
// checks whether a GNUstep modifier (key_sym) is pressed when we're only able
|
||||
// to check whether X keycodes are pressed in xEvent->xkeymap;
|
||||
static int check_modifier (XEvent *xEvent, KeySym key_sym)
|
||||
{
|
||||
char *key_vector;
|
||||
int by,bi;
|
||||
int key_code = XKeysymToKeycode(xEvent->xkeymap.display, key_sym);
|
||||
|
||||
if (key_code != NoSymbol)
|
||||
{
|
||||
by = key_code / 8;
|
||||
bi = key_code % 8;
|
||||
key_vector = xEvent->xkeymap.key_vector;
|
||||
return (key_vector[by] & (1 << bi));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@interface XGServer (WindowOps)
|
||||
- (void) styleoffsets: (float *) l : (float *) r : (float *) t : (float *) b
|
||||
: (unsigned int) style : (Window) win;
|
||||
- (NSRect) _XWinRectToOSWinRect: (NSRect)r for: (void*)windowNumber;
|
||||
@end
|
||||
|
||||
@implementation XGServer (EventOps)
|
||||
|
||||
- (int) XGErrorHandler: (Display*)display : (XErrorEvent*)err
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (void) setupRunLoopInputSourcesForMode: (NSString*)mode
|
||||
{
|
||||
}
|
||||
|
||||
#if LIB_FOUNDATION_LIBRARY
|
||||
- (void) activity: (NSPosixFileActivities)activity
|
||||
posixFileDescriptor: (NSPosixFileDescriptor*)fileDescriptor
|
||||
{
|
||||
[self receivedEvent: 0 type: 0 extra: 0 forMode: nil];
|
||||
}
|
||||
#elif defined(NeXT_PDO)
|
||||
- (void) activityOnFileHandle: (NSNotification*)notification
|
||||
{
|
||||
id fileDescriptor = [notification object];
|
||||
id runLoopMode = [[NSRunLoop currentRunLoop] currentMode];
|
||||
|
||||
[fileDescriptor waitForDataInBackgroundAndNotifyForModes:
|
||||
[NSArray arrayWithObject: runLoopMode]];
|
||||
[self receivedEvent: 0 type: 0 extra: 0 forMode: nil];
|
||||
}
|
||||
#endif
|
||||
|
||||
- (BOOL) runLoopShouldBlock: (BOOL*)trigger
|
||||
{
|
||||
*trigger = YES; // Should trigger this event
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void) receivedEvent: (void*)data
|
||||
type: (RunLoopEventType)type
|
||||
extra: (void*)extra
|
||||
forMode: (NSString*)mode
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
*/
|
||||
- (NSPoint) _XPointToOSPoint: (NSPoint)x for: (void*)window
|
||||
{
|
||||
return NSMakePoint(0, 0);
|
||||
}
|
||||
|
||||
|
||||
- (void) processEvent: (XEvent *) event
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* WM is asking us to take the keyboard focus
|
||||
*/
|
||||
- (NSEvent *)_handleTakeFocusAtom: (XEvent)xEvent
|
||||
forContext: (NSGraphicsContext *)gcontext
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
#if 0
|
||||
// Return the key_sym corresponding to the user defaults string given,
|
||||
// or fallback if no default is registered.
|
||||
static KeySym key_sym_from_defaults (Display *display, NSUserDefaults *defaults,
|
||||
NSString *keyDefaultKey, KeySym fallback)
|
||||
{
|
||||
return fallback;
|
||||
}
|
||||
|
||||
// This function should be called before any keyboard event is dealed with.
|
||||
static void initialize_keyboard (void)
|
||||
{
|
||||
_is_keyboard_initialized = YES;
|
||||
}
|
||||
|
||||
|
||||
static void set_up_num_lock (void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static BOOL keysym_is_X_modifier (KeySym keysym)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
static NSEvent* process_key_event (XEvent* xEvent, XGServer* context, NSEventType eventType, NSMutableArray *event_queue)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
static unichar process_char (KeySym keysym, unsigned *eventModifierFlags)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// process_modifier_flags() determines which modifier keys (Command, Control,
|
||||
// Shift, and so forth) were held down while the event occured.
|
||||
static unsigned int process_modifier_flags(unsigned int state)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
- (NSDate*) timedOutEvent: (void*)data
|
||||
type: (RunLoopEventType)type
|
||||
forMode: (NSString*)mode
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
/* Drag and Drop */
|
||||
- (id <NSDraggingInfo>)dragInfo
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation XGServer (XSync)
|
||||
- (BOOL) xSyncMap: (void*)windowHandle
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation XGServer (X11Ops)
|
||||
|
||||
/*
|
||||
* Return mouse location in base coords ignoring the event loop
|
||||
*/
|
||||
- (NSPoint) mouselocation
|
||||
{
|
||||
return [self mouseLocationOnScreen: defScreen window: NULL];
|
||||
}
|
||||
|
||||
- (NSPoint) mouseLocationOnScreen: (int)screen window: (NSInteger *)win
|
||||
{
|
||||
return NSMakePoint(0, 0);
|
||||
}
|
||||
|
||||
- (NSEvent*) getEventMatchingMask: (unsigned)mask
|
||||
beforeDate: (NSDate*)limit
|
||||
inMode: (NSString*)mode
|
||||
dequeue: (BOOL)flag
|
||||
{
|
||||
[self receivedEvent: 0 type: 0 extra: 0 forMode: nil];
|
||||
return [super getEventMatchingMask: mask
|
||||
beforeDate: limit
|
||||
inMode: mode
|
||||
dequeue: flag];
|
||||
}
|
||||
|
||||
- (void) discardEventsMatchingMask: (unsigned)mask
|
||||
beforeEvent: (NSEvent*)limit
|
||||
{
|
||||
[self receivedEvent: 0 type: 0 extra: 0 forMode: nil];
|
||||
[super discardEventsMatchingMask: mask
|
||||
beforeEvent: limit];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation XGServer (TimeKeeping)
|
||||
// Sync time with X server every 10 seconds
|
||||
#define MAX_TIME_DIFF 10
|
||||
// Regard an X time stamp as valid for half a second
|
||||
#define OUT_DATE_TIME_DIFF 0.5
|
||||
|
||||
- (void) setLastTime: (Time)last
|
||||
{
|
||||
if (generic.lastTimeStamp == 0
|
||||
|| generic.baseXServerTime + MAX_TIME_DIFF * 1000 < last)
|
||||
{
|
||||
// We have not sync'ed with the clock for at least
|
||||
// MAX_TIME_DIFF seconds ... so we do it now.
|
||||
generic.lastTimeStamp = [NSDate timeIntervalSinceReferenceDate];
|
||||
generic.baseXServerTime = last;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Optimisation to compute the new time stamp instead.
|
||||
generic.lastTimeStamp += (last - generic.lastTime) / 1000.0;
|
||||
}
|
||||
|
||||
generic.lastTime = last;
|
||||
}
|
||||
|
||||
- (Time) lastTime
|
||||
{
|
||||
// In the case of activation via DO the lastTime is outdated and cannot be used.
|
||||
if (generic.lastTimeStamp == 0
|
||||
|| ((generic.lastTimeStamp + OUT_DATE_TIME_DIFF)
|
||||
< [NSDate timeIntervalSinceReferenceDate]))
|
||||
{
|
||||
return [[NSDate date] timeIntervalSince1970];
|
||||
}
|
||||
else
|
||||
{
|
||||
return generic.lastTime;
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
822
Source/xheadless/XGServerWindow.m
Normal file
822
Source/xheadless/XGServerWindow.m
Normal file
|
@ -0,0 +1,822 @@
|
|||
/* XGServerWindows - methods for window/screen handling
|
||||
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Adam Fedor <fedor@gnu.org>
|
||||
Date: Nov 1999
|
||||
|
||||
This file is part of GNUstep
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <math.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#include <Foundation/NSArray.h>
|
||||
#include <Foundation/NSDebug.h>
|
||||
#include <Foundation/NSValue.h>
|
||||
#include <Foundation/NSProcessInfo.h>
|
||||
#include <Foundation/NSUserDefaults.h>
|
||||
#include <Foundation/NSAutoreleasePool.h>
|
||||
#include <Foundation/NSDebug.h>
|
||||
#include <AppKit/NSEvent.h>
|
||||
#include <Foundation/NSException.h>
|
||||
#include <Foundation/NSThread.h>
|
||||
#include <AppKit/DPSOperators.h>
|
||||
#include <AppKit/NSApplication.h>
|
||||
#include <AppKit/NSCursor.h>
|
||||
#include <AppKit/NSGraphics.h>
|
||||
#include <AppKit/NSWindow.h>
|
||||
#include <AppKit/NSImage.h>
|
||||
#include <AppKit/NSBitmapImageRep.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <xheadless/XGServerWindow.h>
|
||||
#include <xheadless/XGGeneric.h>
|
||||
#include <xheadless/XWindowBuffer.h>
|
||||
#include <xheadless/XGServer.h>
|
||||
|
||||
#define ROOT generic.appRootWindow
|
||||
|
||||
static BOOL handlesWindowDecorations = YES;
|
||||
|
||||
#define WINDOW_WITH_TAG(windowNumber) (gswindow_device_t *)NSMapGet(windowtags, (void *)(uintptr_t)windowNumber)
|
||||
|
||||
/* Keep track of windows */
|
||||
static NSMapTable *windowmaps = NULL;
|
||||
static NSMapTable *windowtags = NULL;
|
||||
|
||||
/* Track used window numbers */
|
||||
static int last_win_num = 0;
|
||||
|
||||
|
||||
@interface NSCursor (BackendPrivate)
|
||||
- (void *)_cid;
|
||||
@end
|
||||
|
||||
@interface NSBitmapImageRep (GSPrivate)
|
||||
- (NSBitmapImageRep *) _convertToFormatBitsPerSample: (NSInteger)bps
|
||||
samplesPerPixel: (NSInteger)spp
|
||||
hasAlpha: (BOOL)alpha
|
||||
isPlanar: (BOOL)isPlanar
|
||||
colorSpaceName: (NSString*)colorSpaceName
|
||||
bitmapFormat: (NSBitmapFormat)bitmapFormat
|
||||
bytesPerRow: (NSInteger)rowBytes
|
||||
bitsPerPixel: (NSInteger)pixelBits;
|
||||
@end
|
||||
|
||||
void __objc_xgcontextwindow_linking (void)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* The next two functions derived from WindowMaker by Alfredo K. Kojima
|
||||
*/
|
||||
static unsigned char*PropGetCheckProperty(Display *dpy, Window window, Atom hint, Atom type,
|
||||
int format, int count, int *retCount)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Setting Motif Hints for Window Managers (Nicola Pero, July 2000)
|
||||
*/
|
||||
|
||||
/*
|
||||
* Motif window hints to communicate to a window manager
|
||||
* that we want a window to have a titlebar/resize button/etc.
|
||||
*/
|
||||
|
||||
/* Motif window hints struct */
|
||||
typedef struct {
|
||||
unsigned long flags;
|
||||
unsigned long functions;
|
||||
unsigned long decorations;
|
||||
unsigned long input_mode;
|
||||
unsigned long status;
|
||||
} MwmHints;
|
||||
|
||||
/* Number of entries in the struct */
|
||||
#define PROP_MWM_HINTS_ELEMENTS 5
|
||||
|
||||
/* Now for each field in the struct, meaningful stuff to put in: */
|
||||
|
||||
/* flags */
|
||||
#define MWM_HINTS_FUNCTIONS (1L << 0)
|
||||
#define MWM_HINTS_DECORATIONS (1L << 1)
|
||||
#define MWM_HINTS_INPUT_MODE (1L << 2)
|
||||
#define MWM_HINTS_STATUS (1L << 3)
|
||||
|
||||
/* functions */
|
||||
#define MWM_FUNC_ALL (1L << 0)
|
||||
#define MWM_FUNC_RESIZE (1L << 1)
|
||||
#define MWM_FUNC_MOVE (1L << 2)
|
||||
#define MWM_FUNC_MINIMIZE (1L << 3)
|
||||
#define MWM_FUNC_MAXIMIZE (1L << 4)
|
||||
#define MWM_FUNC_CLOSE (1L << 5)
|
||||
|
||||
/* decorations */
|
||||
#define MWM_DECOR_ALL (1L << 0)
|
||||
#define MWM_DECOR_BORDER (1L << 1)
|
||||
#define MWM_DECOR_RESIZEH (1L << 2)
|
||||
#define MWM_DECOR_TITLE (1L << 3)
|
||||
#define MWM_DECOR_MENU (1L << 4)
|
||||
#define MWM_DECOR_MINIMIZE (1L << 5)
|
||||
#define MWM_DECOR_MAXIMIZE (1L << 6)
|
||||
|
||||
/* We don't use the input_mode and status fields */
|
||||
|
||||
/* The atom */
|
||||
#define _XA_MOTIF_WM_HINTS "_MOTIF_WM_HINTS"
|
||||
|
||||
|
||||
/* Now the code */
|
||||
|
||||
/*
|
||||
* End of motif hints for window manager code
|
||||
*/
|
||||
|
||||
|
||||
@interface NSEvent (WindowHack)
|
||||
- (void) _patchLocation: (NSPoint)loc;
|
||||
@end
|
||||
|
||||
@implementation NSEvent (WindowHack)
|
||||
- (void) _patchLocation: (NSPoint)loc
|
||||
{
|
||||
location_point = loc;
|
||||
}
|
||||
@end
|
||||
|
||||
@interface XGServer (WindowOps)
|
||||
- (gswindow_device_t *) _rootWindowForScreen: (int)screen;
|
||||
- (void) styleoffsets: (float *) l : (float *) r : (float *) t : (float *) b
|
||||
: (unsigned int) style : (Window) win;
|
||||
- (void) _setSupportedWMProtocols: (gswindow_device_t *) window;
|
||||
@end
|
||||
|
||||
@implementation XGServer (WindowOps)
|
||||
|
||||
- (BOOL) handlesWindowDecorations
|
||||
{
|
||||
return handlesWindowDecorations;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Where a window has been reparented by the wm, we use this method to
|
||||
* locate the window given knowledge of its border window.
|
||||
*/
|
||||
+ (gswindow_device_t *) _windowForXParent: (Window)xWindow
|
||||
{
|
||||
NSMapEnumerator enumerator;
|
||||
void *key;
|
||||
gswindow_device_t *d;
|
||||
|
||||
enumerator = NSEnumerateMapTable(windowmaps);
|
||||
while (NSNextMapEnumeratorPair(&enumerator, &key, (void**)&d) == YES)
|
||||
{
|
||||
if (d->root != d->parent && d->parent == xWindow)
|
||||
{
|
||||
return d;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
+ (gswindow_device_t *) _windowForXWindow: (Window)xWindow
|
||||
{
|
||||
return NSMapGet(windowmaps, (void *)xWindow);
|
||||
}
|
||||
|
||||
+ (gswindow_device_t *) _windowWithTag: (NSInteger)windowNumber
|
||||
{
|
||||
return WINDOW_WITH_TAG(windowNumber);
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert a window frame in OpenStep absolute screen coordinates to
|
||||
* a frame in X absolute screen coordinates by flipping an applying
|
||||
* offsets to allow for the X window decorations.
|
||||
* The result is the rectangle of the window we can actually draw
|
||||
* to (in the X coordinate system).
|
||||
*/
|
||||
- (NSRect) _OSFrameToXFrame: (NSRect)o for: (void*)window
|
||||
{
|
||||
return NSMakeRect(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert a window frame in OpenStep absolute screen coordinates to
|
||||
* a frame suitable for setting X hints for a window manager.
|
||||
* NB. Hints use the coordinates of the parent decoration window,
|
||||
* but the size of the actual window.
|
||||
*/
|
||||
- (NSRect) _OSFrameToXHints: (NSRect)o for: (void*)window
|
||||
{
|
||||
return NSMakeRect(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert a rectangle in X coordinates relative to the X-window
|
||||
* to a rectangle in OpenStep coordinates (base coordinates of the NSWindow).
|
||||
*/
|
||||
- (NSRect) _XWinRectToOSWinRect: (NSRect)x for: (void*)window
|
||||
{
|
||||
return NSMakeRect(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert a window frame in X absolute screen coordinates to a frame
|
||||
* in OpenStep absolute screen coordinates by flipping an applying
|
||||
* offsets to allow for the X window decorations.
|
||||
*/
|
||||
- (NSRect) _XFrameToOSFrame: (NSRect)x for: (void*)window
|
||||
{
|
||||
return NSMakeRect(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert a window frame in X absolute screen coordinates to
|
||||
* a frame suitable for setting X hints for a window manager.
|
||||
*/
|
||||
- (NSRect) _XFrameToXHints: (NSRect)o for: (void*)window
|
||||
{
|
||||
return NSMakeRect(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
- (void)_sendRoot: (Window)root
|
||||
type: (Atom)type
|
||||
window: (Window)window
|
||||
data0: (long)data0
|
||||
data1: (long)data1
|
||||
data2: (long)data2
|
||||
data3: (long)data3
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if the window manager supports a feature.
|
||||
*/
|
||||
- (BOOL) _checkWMSupports: (Atom)feature
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
Bool _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
|
||||
{
|
||||
return False;
|
||||
}
|
||||
|
||||
- (BOOL) _tryRequestFrameExtents: (gswindow_device_t *)window
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL) _checkStyle: (unsigned)style
|
||||
{
|
||||
NSDebugLLog(@"Offset", @"Checking offsets for style %d\n", style);
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (XGWMProtocols) _checkWindowManager
|
||||
{
|
||||
return XGWM_UNKNOWN;
|
||||
}
|
||||
|
||||
- (gswindow_device_t *) _rootWindowForScreen: (int)screen
|
||||
{
|
||||
gswindow_device_t *window;
|
||||
|
||||
/* Screen number is negative to avoid conflict with windows */
|
||||
window = WINDOW_WITH_TAG(-screen);
|
||||
if (window)
|
||||
return window;
|
||||
|
||||
window = NSAllocateCollectable(sizeof(gswindow_device_t), NSScannedOption);
|
||||
memset(window, '\0', sizeof(gswindow_device_t));
|
||||
|
||||
window->display = dpy;
|
||||
window->screen = screen;
|
||||
window->ident = 0; //RootWindow(dpy, screen);
|
||||
window->root = window->ident;
|
||||
window->type = NSBackingStoreNonretained;
|
||||
window->number = -screen;
|
||||
window->map_state = IsViewable;
|
||||
window->visibility = -1;
|
||||
window->wm_state = NormalState;
|
||||
window->xframe = NSMakeRect(0, 0, 0, 0);
|
||||
NSMapInsert (windowtags, (void*)(uintptr_t)window->number, window);
|
||||
NSMapInsert (windowmaps, (void*)(uintptr_t)window->ident, window);
|
||||
return window;
|
||||
}
|
||||
|
||||
/* Create the window and screen list if necessary, add the root window to
|
||||
the window list as window 0 */
|
||||
- (void) _checkWindowlist
|
||||
{
|
||||
if (windowmaps)
|
||||
return;
|
||||
|
||||
windowmaps = NSCreateMapTable(NSNonOwnedPointerMapKeyCallBacks,
|
||||
NSNonOwnedPointerMapValueCallBacks, 20);
|
||||
windowtags = NSCreateMapTable(NSIntMapKeyCallBacks,
|
||||
NSNonOwnedPointerMapValueCallBacks, 20);
|
||||
}
|
||||
|
||||
- (void) _setupMouse
|
||||
{
|
||||
}
|
||||
|
||||
- (void) _setSupportedWMProtocols: (gswindow_device_t *) window
|
||||
{
|
||||
}
|
||||
|
||||
- (void) _setupRootWindow
|
||||
{
|
||||
/*
|
||||
* Initialize time of last events to be the start of time - not
|
||||
* the current time!
|
||||
*/
|
||||
generic.lastClick = 1;
|
||||
generic.lastMotion = 1;
|
||||
generic.lastTime = 1;
|
||||
|
||||
/*
|
||||
* Set up standard atoms.
|
||||
*/
|
||||
|
||||
[self _checkWindowlist];
|
||||
handlesWindowDecorations = NO;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Destroys all the windows and other window resources that belong to
|
||||
this context */
|
||||
- (void) _destroyServerWindows
|
||||
{
|
||||
void *key;
|
||||
gswindow_device_t *d;
|
||||
NSMapEnumerator enumerator;
|
||||
NSMapTable *mapcopy;
|
||||
|
||||
/* Have to get a copy, since termwindow will remove them from
|
||||
the map table */
|
||||
mapcopy = NSCopyMapTableWithZone(windowtags, [self zone]);
|
||||
enumerator = NSEnumerateMapTable(mapcopy);
|
||||
while (NSNextMapEnumeratorPair(&enumerator, &key, (void**)&d) == YES)
|
||||
{
|
||||
if (d->display == dpy && d->ident != d->root)
|
||||
[self termwindow: (NSInteger)(intptr_t)key];
|
||||
}
|
||||
NSFreeMapTable(mapcopy);
|
||||
}
|
||||
|
||||
/* Sets up a backing pixmap when a window is created or resized. This is
|
||||
only done if the Window is buffered or retained. */
|
||||
- (void) _createBuffer: (gswindow_device_t *)window
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Code to build up a NET WM icon from our application icon
|
||||
*/
|
||||
|
||||
-(BOOL) _createNetIcon: (NSImage*)image
|
||||
result: (long**)pixeldata
|
||||
size: (int*)size
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void) _setNetWMIconFor: (Window) window
|
||||
{
|
||||
}
|
||||
|
||||
- (NSInteger) window: (NSRect)frame : (NSBackingStoreType)type : (unsigned int)style : (int)screen
|
||||
{
|
||||
gswindow_device_t *window;
|
||||
|
||||
NSDebugLLog(@"XGTrace", @"DPSwindow: %@ %d", NSStringFromRect(frame), (int)type);
|
||||
|
||||
/* Create the window structure and set the style early so we can use it to
|
||||
convert frames. */
|
||||
window = NSAllocateCollectable(sizeof(gswindow_device_t), NSScannedOption);
|
||||
memset(window, '\0', sizeof(gswindow_device_t));
|
||||
|
||||
/*
|
||||
* FIXME - should this be protected by a lock for thread safety?
|
||||
* generate a unique tag for this new window.
|
||||
*/
|
||||
do
|
||||
{
|
||||
last_win_num++;
|
||||
}
|
||||
while (last_win_num == 0 || WINDOW_WITH_TAG(last_win_num) != 0);
|
||||
window->number = last_win_num;
|
||||
|
||||
// Insert window into the mapping
|
||||
NSMapInsert(windowmaps, (void*)(uintptr_t)window->ident, window);
|
||||
NSMapInsert(windowtags, (void*)(uintptr_t)window->number, window);
|
||||
[self _setWindowOwnedByServer: window->number];
|
||||
|
||||
return window->number;
|
||||
}
|
||||
|
||||
- (NSInteger) nativeWindow: (void *)winref : (NSRect*)frame : (NSBackingStoreType*)type
|
||||
: (unsigned int*)style : (int*)screen
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (void) termwindow: (NSInteger)win
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the offsets between the window content-view and it's frame
|
||||
* depending on the window style.
|
||||
*/
|
||||
- (void) styleoffsets: (float *) l : (float *) r : (float *) t : (float *) b
|
||||
: (unsigned int) style
|
||||
{
|
||||
[self styleoffsets: l : r : t : b : style : (Window) 0];
|
||||
}
|
||||
|
||||
- (void) styleoffsets: (float *) l : (float *) r : (float *) t : (float *) b
|
||||
: (unsigned int) style : (Window) win
|
||||
{
|
||||
}
|
||||
|
||||
- (void) stylewindow: (unsigned int)style : (NSInteger) win
|
||||
{
|
||||
}
|
||||
|
||||
- (void) setbackgroundcolor: (NSColor *)color : (NSInteger)win
|
||||
{
|
||||
}
|
||||
|
||||
- (void) windowbacking: (NSBackingStoreType)type : (NSInteger) win
|
||||
{
|
||||
}
|
||||
|
||||
- (void) titlewindow: (NSString *)window_title : (NSInteger) win
|
||||
{
|
||||
}
|
||||
|
||||
- (void) docedited: (int)edited : (NSInteger) win
|
||||
{
|
||||
}
|
||||
|
||||
- (BOOL) appOwnsMiniwindow
|
||||
{
|
||||
return generic.flags.appOwnsMiniwindow;
|
||||
}
|
||||
|
||||
- (void) miniwindow: (NSInteger) win
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
Make sure we have the most up-to-date window information and then
|
||||
make sure the context has our new information
|
||||
*/
|
||||
- (void) setWindowdevice: (NSInteger)win forContext: (NSGraphicsContext *)ctxt
|
||||
{
|
||||
}
|
||||
|
||||
-(int) _createAppIconPixmaps
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
- (void) orderwindow: (int)op : (NSInteger)otherWin : (NSInteger)winNum
|
||||
{
|
||||
}
|
||||
|
||||
#define ALPHA_THRESHOLD 158
|
||||
|
||||
/* Restrict the displayed part of the window to the given image.
|
||||
This only yields usefull results if the window is borderless and
|
||||
displays the image itself */
|
||||
- (void) restrictWindow: (NSInteger)win toImage: (NSImage*)image
|
||||
{
|
||||
}
|
||||
|
||||
/* This method is a fast implementation of move that only works
|
||||
correctly for borderless windows. Use with caution. */
|
||||
- (void) movewindow: (NSPoint)loc : (NSInteger)win
|
||||
{
|
||||
}
|
||||
|
||||
- (void) placewindow: (NSRect)rect : (NSInteger)win
|
||||
{
|
||||
}
|
||||
|
||||
- (BOOL) findwindow: (NSPoint)loc : (int) op : (NSInteger) otherWin : (NSPoint *)floc
|
||||
: (int*) winFound
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (NSRect) windowbounds: (NSInteger)win
|
||||
{
|
||||
|
||||
return NSMakeRect(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
- (void) setwindowlevel: (int)level : (NSInteger)win
|
||||
{
|
||||
}
|
||||
|
||||
- (int) windowlevel: (NSInteger)win
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (NSArray *) windowlist
|
||||
{
|
||||
return [NSMutableArray array];
|
||||
}
|
||||
|
||||
- (int) windowdepth: (NSInteger)win
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (void) setmaxsize: (NSSize)size : (NSInteger)win
|
||||
{
|
||||
}
|
||||
|
||||
- (void) setminsize: (NSSize)size : (NSInteger)win
|
||||
{
|
||||
}
|
||||
|
||||
- (void) setresizeincrements: (NSSize)size : (NSInteger)win
|
||||
{
|
||||
}
|
||||
|
||||
// process expose event
|
||||
- (void) _addExposedRectangle: (XRectangle)rectangle : (NSInteger)win : (BOOL) ignoreBacking
|
||||
{
|
||||
}
|
||||
|
||||
- (void) flushwindowrect: (NSRect)rect : (NSInteger)win
|
||||
{
|
||||
}
|
||||
|
||||
// handle X expose events
|
||||
- (void) _processExposedRectangles: (NSInteger)win
|
||||
{
|
||||
}
|
||||
|
||||
- (BOOL) capturemouse: (NSInteger)win
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void) setMouseLocation: (NSPoint)mouseLocation onScreen: (int)aScreen
|
||||
{
|
||||
}
|
||||
|
||||
- (void) setinputfocus: (NSInteger)win
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Instruct window manager that the specified window is 'key', 'main', or
|
||||
* just a normal window.
|
||||
*/
|
||||
- (void) setinputstate: (int)st : (NSInteger)win
|
||||
{
|
||||
}
|
||||
|
||||
/** Sets the transparancy value for the whole window */
|
||||
- (void) setalpha: (float)alpha : (NSInteger) win
|
||||
{
|
||||
}
|
||||
|
||||
- (float) getAlpha: (NSInteger)win
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
- (void *) serverDevice
|
||||
{
|
||||
return dpy;
|
||||
}
|
||||
|
||||
- (void *) windowDevice: (NSInteger)win
|
||||
{
|
||||
return (void *)NULL;
|
||||
}
|
||||
|
||||
/* Cursor Ops */
|
||||
static BOOL cursor_hidden = NO;
|
||||
|
||||
- (Cursor) _blankCursor
|
||||
{
|
||||
return None;
|
||||
}
|
||||
|
||||
/*
|
||||
set the cursor for a newly created window.
|
||||
*/
|
||||
|
||||
- (void) _initializeCursorForXWindow: (Window) win
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
set cursor on all XWindows we own. if `set' is NO
|
||||
the cursor is unset on all windows.
|
||||
Normally the cursor `c' correspond to the [NSCursor currentCursor]
|
||||
The only exception should be when the cursor is hidden.
|
||||
In that case `c' will be a blank cursor.
|
||||
*/
|
||||
|
||||
- (void) _DPSsetcursor: (Cursor)c : (BOOL)set
|
||||
{
|
||||
}
|
||||
|
||||
#define ALPHA_THRESHOLD 158
|
||||
|
||||
Pixmap
|
||||
xgps_cursor_mask(Display *xdpy, Drawable draw, const unsigned char *data,
|
||||
int w, int h, int colors)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
Pixmap
|
||||
xgps_cursor_image(Display *xdpy, Drawable draw, const unsigned char *data,
|
||||
int w, int h, int colors, XColor *fg, XColor *bg)
|
||||
{
|
||||
return None;
|
||||
}
|
||||
|
||||
- (void) hidecursor
|
||||
{
|
||||
cursor_hidden = YES;
|
||||
}
|
||||
|
||||
- (void) showcursor
|
||||
{
|
||||
cursor_hidden = NO;
|
||||
}
|
||||
|
||||
- (void) standardcursor: (int)style : (void **)cid
|
||||
{
|
||||
}
|
||||
|
||||
- (void) imagecursor: (NSPoint)hotp : (NSImage *)image : (void **)cid
|
||||
{
|
||||
}
|
||||
|
||||
- (void) recolorcursor: (NSColor *)fg : (NSColor *)bg : (void*) cid
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
- (void) setcursor: (void*) cid
|
||||
{
|
||||
}
|
||||
|
||||
- (void) freecursor: (void*) cid
|
||||
{
|
||||
}
|
||||
|
||||
- (NSArray *)screenList
|
||||
{
|
||||
NSMutableArray *screens = [NSMutableArray arrayWithCapacity: 1];
|
||||
[screens addObject: [NSNumber numberWithInt: defScreen]];
|
||||
|
||||
return screens;
|
||||
}
|
||||
|
||||
- (NSWindowDepth) windowDepthForScreen: (int) screen_num
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (const NSWindowDepth *) availableDepthsForScreen: (int) screen_num
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- (NSSize) resolutionForScreen: (int)screen_num
|
||||
{
|
||||
// NOTE:
|
||||
// -gui now trusts the return value of resolutionForScreen:,
|
||||
// so if it is not {72, 72} then the entire UI will be scaled.
|
||||
//
|
||||
// I commented out the implementation below because it may not
|
||||
// be safe to use the DPI value we get from the X server.
|
||||
// (i.e. I don't know if it will be a "fake" DPI like 72 or 96,
|
||||
// or a real measurement reported from the monitor's firmware
|
||||
// (possibly incorrect?))
|
||||
// More research needs to be done.
|
||||
|
||||
return NSMakeSize(72, 72);
|
||||
}
|
||||
|
||||
- (NSRect) boundsForScreen: (int)screen
|
||||
{
|
||||
return NSMakeRect(0, 0, 400, 400);
|
||||
}
|
||||
|
||||
- (NSImage *) iconTileImage
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSSize) iconSize
|
||||
{
|
||||
return [super iconSize];
|
||||
}
|
||||
|
||||
- (unsigned int) numberOfDesktops: (int)screen
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
- (NSArray *) namesOfDesktops: (int)screen
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (unsigned int) desktopNumberForScreen: (int)screen
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (void) setDesktopNumber: (unsigned int)workspace forScreen: (int)screen
|
||||
{
|
||||
}
|
||||
|
||||
- (unsigned int) desktopNumberForWindow: (int)win
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (void) setDesktopNumber: (unsigned int)workspace forWindow: (int)win
|
||||
{
|
||||
}
|
||||
|
||||
- (void) setShadow: (BOOL)hasShadow : (int)win
|
||||
{
|
||||
}
|
||||
|
||||
- (BOOL) hasShadow: (int)win
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check whether the window is miniaturized according to the ICCCM window
|
||||
* state property.
|
||||
*/
|
||||
- (int) _wm_state: (Window)win
|
||||
{
|
||||
return WithdrawnState;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check whether the EWMH window state includes the _NET_WM_STATE_HIDDEN
|
||||
* state. On EWMH, a window is iconified if it is iconic state and the
|
||||
* _NET_WM_STATE_HIDDEN is present.
|
||||
*/
|
||||
- (BOOL) _ewmh_isHidden: (Window)win
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void) setParentWindow: (NSInteger)parentWin
|
||||
forChildWindow: (NSInteger)childWin
|
||||
{
|
||||
}
|
||||
|
||||
- (void) setIgnoreMouse: (BOOL)ignoreMouse : (int)win
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
Loading…
Add table
Add a link
Reference in a new issue