mirror of
https://github.com/gnustep/libs-back.git
synced 2025-04-22 07:21:02 +00:00
Compare commits
14 commits
master
...
keysight_h
Author | SHA1 | Date | |
---|---|---|---|
|
20d678fe9f | ||
|
9fb73782e0 | ||
|
4ed9301961 | ||
|
544cf2eb2a | ||
|
d23c85132b | ||
|
29e2fa95ae | ||
|
354f323344 | ||
|
8e6a546d05 | ||
|
5e030e7505 | ||
|
cbc6e7f66f | ||
|
78a80fe920 | ||
|
49cefc8df9 | ||
|
4030602b66 | ||
|
4c8524a209 |
33 changed files with 6316 additions and 2165 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
|
37
Headers/headlesslib/HeadlessModernSurface.h
Normal file
37
Headers/headlesslib/HeadlessModernSurface.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
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
|
52
Headers/headlesslib/HeadlessSurface.h
Normal file
52
Headers/headlesslib/HeadlessSurface.h
Normal file
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
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
|
157
Headers/xheadless/HeadlessGeneric.h
Normal file
157
Headers/xheadless/HeadlessGeneric.h
Normal file
|
@ -0,0 +1,157 @@
|
|||
/* 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_HeadlessGENERIC_H
|
||||
#define INCLUDED_HeadlessGENERIC_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 HeadlessGeneric {
|
||||
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/HeadlessInputServer.h
Normal file
79
Headers/xheadless/HeadlessInputServer.h
Normal file
|
@ -0,0 +1,79 @@
|
|||
/* HeadlessInputServer - 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_HeadlessInputServer
|
||||
#define _GNUstep_H_HeadlessInputServer
|
||||
|
||||
#include <AppKit/NSInputServer.h>
|
||||
#include <xheadless/HeadlessServerWindow.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/HeadlessOpenGL.h
Normal file
79
Headers/xheadless/HeadlessOpenGL.h
Normal file
|
@ -0,0 +1,79 @@
|
|||
/* -*-ObjC-*- */
|
||||
/* HeadlessOpenGL - 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_HeadlessOpenGL_
|
||||
#define _GNUstep_H_HeadlessOpenGL_
|
||||
|
||||
#include <AppKit/NSOpenGL.h>
|
||||
|
||||
#define id _gs_avoid_id_collision
|
||||
#define BOOL XWINDOWSBOOL
|
||||
#include <GL/glx.h>
|
||||
#undef id
|
||||
#undef BOOL
|
||||
|
||||
@class NSView;
|
||||
@class HeadlessXSubWindow;
|
||||
@class HeadlessGLPixelFormat;
|
||||
|
||||
@interface HeadlessGLContext : NSOpenGLContext
|
||||
{
|
||||
int glxminorversion;
|
||||
GLXContext glx_context;
|
||||
GLXWindow glx_drawable;
|
||||
HeadlessXSubWindow *xSubWindow;
|
||||
HeadlessGLPixelFormat *pixelFormat;
|
||||
BOOL saved_ignores_backing;
|
||||
}
|
||||
|
||||
- (GLXContext)glxcontext;
|
||||
|
||||
@end
|
||||
|
||||
@interface HeadlessGLPixelFormat : NSOpenGLPixelFormat
|
||||
{
|
||||
Display * display;
|
||||
int glxminorversion;
|
||||
|
||||
GLXFBConfig *fbconfig;
|
||||
int pickedFBConfig;
|
||||
int configurationCount;
|
||||
BOOL shouldRequestARGBVisual;
|
||||
|
||||
XVisualInfo *visualinfo;
|
||||
|
||||
}
|
||||
|
||||
+ (int) glxMinorVersion;
|
||||
- (Display *) display;
|
||||
- (XVisualInfo *) visualinfo;
|
||||
- (GLXContext) createGLXContext: (HeadlessGLContext *)share;
|
||||
- (GLXWindow) drawableForWindow: (Window)xwindowid;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
113
Headers/xheadless/HeadlessServer.h
Normal file
113
Headers/xheadless/HeadlessServer.h
Normal file
|
@ -0,0 +1,113 @@
|
|||
/* <title>HeadlessServer</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 _HeadlessServer_h_INCLUDE
|
||||
#define _HeadlessServer_h_INCLUDE
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <GNUstepGUI/GSDisplayServer.h>
|
||||
#include "XHeadless.h"
|
||||
#include "HeadlessGeneric.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 HeadlessServer : GSDisplayServer
|
||||
{
|
||||
Display *dpy;
|
||||
int defScreen;
|
||||
NSMapTable *screenList;
|
||||
Window grabWindow;
|
||||
struct HeadlessGeneric 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 HeadlessServer (XSync)
|
||||
- (BOOL) xSyncMap: (void*)window;
|
||||
@end
|
||||
|
||||
@interface HeadlessServer (HeadlessGeneric)
|
||||
- (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 HeadlessServer (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 HeadlessServer (TimeKeeping)
|
||||
- (void) setLastTime: (Time)last;
|
||||
- (Time) lastTime;
|
||||
@end
|
||||
|
||||
#endif /* _HeadlessServer_h_INCLUDE */
|
140
Headers/xheadless/HeadlessServerWindow.h
Normal file
140
Headers/xheadless/HeadlessServerWindow.h
Normal file
|
@ -0,0 +1,140 @@
|
|||
/* 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 _HeadlessServerWindow_h_INCLUDE
|
||||
#define _HeadlessServerWindow_h_INCLUDE
|
||||
|
||||
#include <xheadless/HeadlessServer.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;
|
||||
} gswindow_device_t;
|
||||
|
||||
#define GET_XDRAWABLE(win) ((win)->buffer ? (win)->buffer: (win)->ident)
|
||||
|
||||
@interface HeadlessServer (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
|
37
Headers/xheadless/XHeadless.h
Normal file
37
Headers/xheadless/XHeadless.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
#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
|
149
Headers/xheadless/XWindowBuffer.h
Normal file
149
Headers/xheadless/XWindowBuffer.h
Normal file
|
@ -0,0 +1,149 @@
|
|||
/*
|
||||
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
|
|
@ -50,6 +50,11 @@
|
|||
@interface WaylandServer (Initialize)
|
||||
+ (void) initializeBackend;
|
||||
@end
|
||||
#elif BUILD_SERVER == SERVER_xheadless
|
||||
#include <xheadless/HeadlessServer.h>
|
||||
@interface HeadlessServer (Initialize)
|
||||
+ (void) initializeBackend;
|
||||
@end
|
||||
#endif
|
||||
|
||||
/* Call the correct initalization routines for the choosen
|
||||
|
@ -70,6 +75,8 @@
|
|||
[WIN32Server initializeBackend];
|
||||
#elif BUILD_SERVER == SERVER_wayland
|
||||
[WaylandServer initializeBackend];
|
||||
#elif BUILD_SERVER == SERVER_xheadless
|
||||
[HeadlessServer initializeBackend];
|
||||
#else
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"No Window Server configured in backend"];
|
||||
|
@ -93,9 +100,11 @@
|
|||
#elif (BUILD_GRAPHICS==GRAPHICS_winlib)
|
||||
context = @"WIN32Context";
|
||||
#elif (BUILD_GRAPHICS==GRAPHICS_cairo)
|
||||
context = @"CairoContext";
|
||||
#elif (BUILD_GRAPHICS==GRAPHICS_opal)
|
||||
context = @"CairoContext";
|
||||
#elif (BUILD_GRAPHICS==GRAPHICS_opal)
|
||||
context = @"OpalContext";
|
||||
#elif (BUILD_GRAPHICS==GRAPHICS_headlesslib)
|
||||
context = @"HeadlessContext";
|
||||
#else
|
||||
#error INVALID build graphics type
|
||||
#endif
|
||||
|
|
|
@ -57,6 +57,19 @@
|
|||
# endif /* USE_GLITZ */
|
||||
# include "x11/XGServerWindow.h"
|
||||
# include "x11/XWindowBuffer.h"
|
||||
#elif BUILD_SERVER == SERVER_xheadless
|
||||
# include "cairo/CairoGState.h"
|
||||
# include "x11/XGServer.h"
|
||||
# define _CAIRO_GSTATE_CLASSNAME CairoGState
|
||||
# ifdef USE_GLITZ
|
||||
# define _CAIRO_SURFACE_CLASSNAME XGCairoGlitzSurface
|
||||
# include "cairo/XGCairoGlitzSurface.h"
|
||||
# else
|
||||
# define _CAIRO_SURFACE_CLASSNAME XGCairoModernSurface
|
||||
# include "cairo/XGCairoModernSurface.h"
|
||||
# endif /* USE_GLITZ */
|
||||
# include "x11/XGServerWindow.h"
|
||||
# include "x11/XWindowBuffer.h"
|
||||
#elif BUILD_SERVER == SERVER_win32
|
||||
# include "cairo/Win32CairoGState.h"
|
||||
# include <windows.h>
|
||||
|
|
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
|
||||
#
|
||||
|
192
Source/headlesslib/HeadlessContext.m
Normal file
192
Source/headlesslib/HeadlessContext.m
Normal file
|
@ -0,0 +1,192 @@
|
|||
/*
|
||||
HeadlessContext.m
|
||||
|
||||
Copyright (C) 2003, 2023 Free Software Foundation, Inc.
|
||||
|
||||
August 17, 2023
|
||||
Re-written by Gregory Casamento <greg.casamento@gmail.com>
|
||||
Based on work by Marcian Lytwyn <gnustep@advcsi.com>
|
||||
August 31, 2003
|
||||
Originally 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
|
48
Source/headlesslib/HeadlessFaceInfo.m
Normal file
48
Source/headlesslib/HeadlessFaceInfo.m
Normal file
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
HwadlessFaceInfo.m
|
||||
|
||||
Copyright (C) 2003, 2023 Free Software Foundation, Inc.
|
||||
|
||||
August 17, 2023
|
||||
Re-written by Gregory Casamento <greg.casamento@gmail.com>
|
||||
Based on work Marcian Lytwyn <gnustep@advcsi.com>
|
||||
August 31, 2003
|
||||
Originally 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
|
58
Source/headlesslib/HeadlessFontEnumerator.m
Normal file
58
Source/headlesslib/HeadlessFontEnumerator.m
Normal file
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
HeadlessFontEnumerator.m
|
||||
|
||||
Copyright (C) 2003, 2023 Free Software Foundation, Inc.
|
||||
|
||||
August 17, 2023
|
||||
Re-written by Gregory Casamento <greg.casamento@gmail.com>
|
||||
Based on work by Marcian Lytwyn <gnustep@advcsi.com>
|
||||
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"
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wobjc-method-access"
|
||||
|
||||
@implementation HeadlessFontEnumerator
|
||||
|
||||
+ (Class) faceInfoClass
|
||||
{
|
||||
return [HeadlessFaceInfo class];
|
||||
}
|
||||
|
||||
+ (HeadlessFaceInfo *) fontWithName: (NSString *) name
|
||||
{
|
||||
return (HeadlessFaceInfo *) [super fontWithName: name];
|
||||
}
|
||||
|
||||
- (void)enumerateFontsAndFamilies
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#pragma GCC diagnostic pop
|
114
Source/headlesslib/HeadlessFontInfo.m
Normal file
114
Source/headlesslib/HeadlessFontInfo.m
Normal file
|
@ -0,0 +1,114 @@
|
|||
/*
|
||||
HeadlessFontInfo.m
|
||||
|
||||
Copyright (C) 2003, 2023 Free Software Foundation, Inc.
|
||||
|
||||
August 17, 2023
|
||||
Re-wrtten by Gregory Casamento <greg.casamento@gmail.com>
|
||||
Based on work by Marcian Lytwyn <gnustep@advcsi.com>
|
||||
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
|
342
Source/headlesslib/HeadlessGState.m
Normal file
342
Source/headlesslib/HeadlessGState.m
Normal file
|
@ -0,0 +1,342 @@
|
|||
/*
|
||||
HeadlessGState.m
|
||||
|
||||
Copyright (C) 2003, 2023 Free Software Foundation, Inc.
|
||||
|
||||
August 17, 2023
|
||||
Re-wrtten by Gregory Casamento <greg.casamento@gmail.com>
|
||||
Based on work by Marcian Lytwyn <gnustep@advcsi.com>
|
||||
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
|
55
Source/headlesslib/HeadlessModernSurface.m
Normal file
55
Source/headlesslib/HeadlessModernSurface.m
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
Copyright (C) 2004, 2023 Free Software Foundation, Inc.
|
||||
|
||||
Re-writen by Gregory Casamento <greg.casamento@gmail.com>
|
||||
Based on work by Marcian Lytwyn <gnustep@advcsi.com>
|
||||
Based on 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/HeadlessServer.h"
|
||||
#include "xheadless/HeadlessServerWindow.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
|
79
Source/headlesslib/HeadlessSurface.m
Normal file
79
Source/headlesslib/HeadlessSurface.m
Normal file
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
Copyright (C) 2004, 2023 Free Software Foundation, Inc.
|
||||
|
||||
Re-writen by Gregory Casamento <greg.casamento@gmail.com>
|
||||
Based on work by Marcian Lytwyn <gnustep@advcsi.com>
|
||||
Based on work by 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];
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wmismatched-return-types"
|
||||
|
||||
- (cairo_surface_t *) surface
|
||||
{
|
||||
return _surface;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
- (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 = \
|
||||
HeadlessServer.m \
|
||||
HeadlessServerEvent.m \
|
||||
HeadlessServerWindow.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
|
||||
#
|
||||
|
||||
|
385
Source/xheadless/HeadlessServer.m
Normal file
385
Source/xheadless/HeadlessServer.m
Normal file
|
@ -0,0 +1,385 @@
|
|||
/* -*- mode:ObjC -*-
|
||||
HeadlessServer - X11 Server Class
|
||||
|
||||
Copyright (C) 1998,2002,2023 Free Software Foundation, Inc.
|
||||
|
||||
Re-written by: Gregory John Casamento <greg.casamento@gmail.com>
|
||||
Based on work by: Marcian Lytwyn <gnustep@advcsi.com> for Keysight
|
||||
Based on work Written by: Adam Fedor <fedor@gnu.org>
|
||||
Date: Mar 2002, Aug 2023
|
||||
|
||||
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/HeadlessServer.h"
|
||||
#include "xheadless/HeadlessInputServer.h"
|
||||
|
||||
extern int XGErrorHandler(Display *display, XErrorEvent *err);
|
||||
|
||||
@interface HeadlessServer (Window)
|
||||
- (void) _setupRootWindow;
|
||||
@end
|
||||
|
||||
@interface HeadlessServer (Private)
|
||||
- (void) setupRunLoopInputSourcesForMode: (NSString*)mode;
|
||||
@end
|
||||
|
||||
@interface HeadlessScreenContext : NSObject
|
||||
{
|
||||
RContext *rcontext;
|
||||
XGDrawMechanism drawMechanism;
|
||||
}
|
||||
|
||||
- (instancetype) initForDisplay: (Display *)dpy screen: (int)screen_number;
|
||||
- (XGDrawMechanism) drawMechanism;
|
||||
- (RContext *) context;
|
||||
@end
|
||||
|
||||
@implementation HeadlessScreenContext
|
||||
|
||||
- (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>HeadlessServer</heading>
|
||||
|
||||
<p> HeadlessServer is a concrete subclass of GSDisplayServer that handles
|
||||
events and interactions for the headless server. The purpose of the headless
|
||||
server is to allow apps which would normally have an interface under X to
|
||||
show no visible windows. This is useful for testing or for running applications
|
||||
on machines that have no display available, but where the application needs to run.
|
||||
This also can be used in continuous integration to test an application in the
|
||||
background.
|
||||
</unit>
|
||||
*/
|
||||
|
||||
@implementation HeadlessServer
|
||||
|
||||
/* Initialize AppKit backend */
|
||||
+ (void) initializeBackend
|
||||
{
|
||||
NSDebugLog(@"Initializing GNUstep x11 backend.\n");
|
||||
[GSDisplayServer setDefaultServerClass: [HeadlessServer class]];
|
||||
signal(SIGTERM, terminate);
|
||||
signal(SIGINT, terminate);
|
||||
}
|
||||
|
||||
/**
|
||||
Returns a pointer to the current X-Windows display variable for
|
||||
the current context.
|
||||
*/
|
||||
+ (Display*) currentXDisplay
|
||||
{
|
||||
return [(HeadlessServer*)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;
|
||||
}
|
||||
|
||||
- (HeadlessScreenContext *) _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 HeadlessServer (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 ====================================
|
339
Source/xheadless/HeadlessServerEvent.m
Normal file
339
Source/xheadless/HeadlessServerEvent.m
Normal file
|
@ -0,0 +1,339 @@
|
|||
/*
|
||||
HeadlessServerEvent - Window/Event code for X11 backends.
|
||||
|
||||
Copyright (C) 1998,2002,2023 Free Software Foundation, Inc.
|
||||
|
||||
Re-written by: Gregory John Casamento <greg.casamento@gmail.com>
|
||||
Based on work by: Marcian Lytwyn <gnustep@advcsi.com> for Keysight
|
||||
Based on work Written by: Adam Fedor <fedor@gnu.org>
|
||||
Date: 1998, Nov 1999, Aug 2023
|
||||
|
||||
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/HeadlessServerWindow.h"
|
||||
#include "xheadless/HeadlessInputServer.h"
|
||||
#include "xheadless/HeadlessGeneric.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 HeadlessServer (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) HeadlessErrorHandler: (Display*)display : (XErrorEvent*)err;
|
||||
- (void) processEvent: (XEvent *) event;
|
||||
- (NSEvent *)_handleTakeFocusAtom: (XEvent)xEvent
|
||||
forContext: (NSGraphicsContext *)gcontext;
|
||||
@end
|
||||
|
||||
|
||||
int
|
||||
HeadlessErrorHandler(Display *display, XErrorEvent *err)
|
||||
{
|
||||
HeadlessServer *ctxt = (HeadlessServer*)GSCurrentServer();
|
||||
|
||||
return [ctxt HeadlessErrorHandler: display : err];
|
||||
}
|
||||
|
||||
@interface HeadlessServer (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 HeadlessServer (EventOps)
|
||||
|
||||
- (int) HeadlessErrorHandler: (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, HeadlessServer* 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 HeadlessServer (XSync)
|
||||
- (BOOL) xSyncMap: (void*)windowHandle
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation HeadlessServer (X11Ops)
|
||||
|
||||
/*
|
||||
* Return mouse location in base coords ignoring the event loop
|
||||
*/
|
||||
- (NSPoint) mouselocation
|
||||
{
|
||||
return [self mouseLocationOnScreen: defScreen window: NULL];
|
||||
}
|
||||
|
||||
- (NSPoint) mouseLocationOnScreen: (int)screen window: (int *)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 HeadlessServer (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
|
759
Source/xheadless/HeadlessServerWindow.m
Normal file
759
Source/xheadless/HeadlessServerWindow.m
Normal file
|
@ -0,0 +1,759 @@
|
|||
/* XGServerWindows - methods for window/screen handling
|
||||
|
||||
Copyright (C) 1998,2002,2023 Free Software Foundation, Inc.
|
||||
|
||||
Re-written by: Gregory John Casamento <greg.casamento@gmail.com>
|
||||
Based on work by: Marcian Lytwyn <gnustep@advcsi.com> for Keysight
|
||||
Based on work Written by: Adam Fedor <fedor@gnu.org>
|
||||
Date: Nov 1999, Aug 2023
|
||||
|
||||
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/HeadlessServerWindow.h>
|
||||
#include <xheadless/HeadlessGeneric.h>
|
||||
#include <xheadless/XWindowBuffer.h>
|
||||
#include <xheadless/HeadlessServer.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)
|
||||
{
|
||||
}
|
||||
|
||||
@interface NSEvent (WindowHack)
|
||||
- (void) _patchLocation: (NSPoint)loc;
|
||||
@end
|
||||
|
||||
@implementation NSEvent (WindowHack)
|
||||
- (void) _patchLocation: (NSPoint)loc
|
||||
{
|
||||
location_point = loc;
|
||||
}
|
||||
@end
|
||||
|
||||
@interface HeadlessServer (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 HeadlessServer (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: (int)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
|
||||
{
|
||||
}
|
||||
|
||||
- (int) 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;
|
||||
}
|
||||
|
||||
- (int) nativeWindow: (void *)winref : (NSRect*)frame : (NSBackingStoreType*)type
|
||||
: (unsigned int*)style : (int*)screen
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (void) termwindow: (int)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 : (int) win
|
||||
{
|
||||
}
|
||||
|
||||
- (void) setbackgroundcolor: (NSColor *)color : (int)win
|
||||
{
|
||||
}
|
||||
|
||||
- (void) windowbacking: (NSBackingStoreType)type : (int) win
|
||||
{
|
||||
}
|
||||
|
||||
- (void) titlewindow: (NSString *)window_title : (int) win
|
||||
{
|
||||
}
|
||||
|
||||
- (void) docedited: (int)edited : (int) win
|
||||
{
|
||||
}
|
||||
|
||||
- (BOOL) appOwnsMiniwindow
|
||||
{
|
||||
return generic.flags.appOwnsMiniwindow;
|
||||
}
|
||||
|
||||
- (void) miniwindow: (int) win
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
Make sure we have the most up-to-date window information and then
|
||||
make sure the context has our new information
|
||||
*/
|
||||
- (void) setWindowdevice: (int)win forContext: (NSGraphicsContext *)ctxt
|
||||
{
|
||||
}
|
||||
|
||||
-(int) _createAppIconPixmaps
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
- (void) orderwindow: (int)op : (int)otherWin : (int)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: (int)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 : (int)win
|
||||
{
|
||||
}
|
||||
|
||||
- (void) placewindow: (NSRect)rect : (int)win
|
||||
{
|
||||
}
|
||||
|
||||
- (BOOL) findwindow: (NSPoint)loc : (int) op : (int) otherWin : (NSPoint *)floc
|
||||
: (int*) winFound
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (NSRect) windowbounds: (int)win
|
||||
{
|
||||
|
||||
return NSMakeRect(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
- (void) setwindowlevel: (int)level : (int)win
|
||||
{
|
||||
}
|
||||
|
||||
- (int) windowlevel: (int)win
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (NSArray *) windowlist
|
||||
{
|
||||
return [NSMutableArray array];
|
||||
}
|
||||
|
||||
- (int) windowdepth: (int)win
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (void) setmaxsize: (NSSize)size : (int)win
|
||||
{
|
||||
}
|
||||
|
||||
- (void) setminsize: (NSSize)size : (int)win
|
||||
{
|
||||
}
|
||||
|
||||
- (void) setresizeincrements: (NSSize)size : (int)win
|
||||
{
|
||||
}
|
||||
|
||||
// process expose event
|
||||
- (void) _addExposedRectangle: (XRectangle)rectangle : (int)win : (BOOL) ignoreBacking
|
||||
{
|
||||
}
|
||||
|
||||
- (void) flushwindowrect: (NSRect)rect : (int)win
|
||||
{
|
||||
}
|
||||
|
||||
// handle X expose events
|
||||
- (void) _processExposedRectangles: (int)win
|
||||
{
|
||||
}
|
||||
|
||||
- (BOOL) capturemouse: (int)win
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void) setMouseLocation: (NSPoint)mouseLocation onScreen: (int)aScreen
|
||||
{
|
||||
}
|
||||
|
||||
- (void) setinputfocus: (int)win
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Instruct window manager that the specified window is 'key', 'main', or
|
||||
* just a normal window.
|
||||
*/
|
||||
- (void) setinputstate: (int)st : (int)win
|
||||
{
|
||||
}
|
||||
|
||||
/** Sets the transparancy value for the whole window */
|
||||
- (void) setalpha: (float)alpha : (int) win
|
||||
{
|
||||
}
|
||||
|
||||
- (float) getAlpha: (int)win
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
- (void *) serverDevice
|
||||
{
|
||||
return dpy;
|
||||
}
|
||||
|
||||
- (void *) windowDevice: (int)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: (int)parentWin
|
||||
forChildWindow: (int)childWin
|
||||
{
|
||||
}
|
||||
|
||||
- (void) setIgnoreMouse: (BOOL)ignoreMouse : (int)win
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
|
@ -4,12 +4,15 @@
|
|||
#define SERVER_x11 1
|
||||
#define SERVER_win32 2
|
||||
#define SERVER_wayland 3
|
||||
#define SERVER_xheadless 4
|
||||
|
||||
#define GRAPHICS_xdps 0
|
||||
#define GRAPHICS_art 1
|
||||
#define GRAPHICS_xlib 2
|
||||
#define GRAPHICS_winlib 3
|
||||
#define GRAPHICS_cairo 4
|
||||
#define GRAPHICS_opal 5
|
||||
#define GRAPHICS_headlesslib 6
|
||||
|
||||
|
||||
/* Define to type of graphics context to build */
|
||||
|
@ -139,9 +142,6 @@
|
|||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#undef PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
|
|
45
configure.ac
45
configure.ac
|
@ -161,6 +161,9 @@ AC_PATH_XTRA
|
|||
if test "x$no_x" = xyes; then
|
||||
set_x_paths=no
|
||||
fi
|
||||
if test "x$BUILD_SERVER" = xxheadless; then
|
||||
set_x_paths=no
|
||||
fi
|
||||
|
||||
PKG_PROG_PKG_CONFIG
|
||||
|
||||
|
@ -565,14 +568,20 @@ case $target_os in
|
|||
esac
|
||||
|
||||
AC_ARG_ENABLE(server,
|
||||
[ --enable-server=SRV Build server type: x11, win32, wayland],,
|
||||
[ --enable-server=SRV Build server type: x11, win32, wayland, xheadless],,
|
||||
enable_server=$BUILD_SERVER)
|
||||
AC_ARG_ENABLE(graphics,
|
||||
[ --enable-graphics=GPH Build graphics: xlib, xdps, winlib, art, cairo, opal],,
|
||||
[ --enable-graphics=GPH Build graphics: xlib, xdps, winlib, art, cairo, opal, headlesslib],,
|
||||
enable_graphics="$BUILD_GRAPHICS")
|
||||
|
||||
BUILD_SERVER=$enable_server
|
||||
BUILD_GRAPHICS="$enable_graphics"
|
||||
|
||||
# Force the graphics to be headless if the server is...
|
||||
if test "x$BUILD_SERVER" = xxheadless; then
|
||||
BUILD_GRAPHICS=headlesslib
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(Backend Server)
|
||||
AC_MSG_RESULT($BUILD_SERVER)
|
||||
|
||||
|
@ -666,6 +675,16 @@ if test x"$BUILD_GRAPHICS" = "xcairo"; then
|
|||
fi
|
||||
fi
|
||||
|
||||
if test x"$BUILD_GRAPHICS" = "xheadlesslib"; then
|
||||
if test $BUILD_SERVER != xheadless; then
|
||||
AC_MSG_WARN([Invalid build server for headless lib: $BUILD_SERVER])
|
||||
else
|
||||
AC_MSG_CHECKING(headless lib)
|
||||
AC_MSG_RESULT(headlesslib)
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if test x"$BUILD_GRAPHICS" = "xxdps"; then
|
||||
CPPFLAGS="-I$x_includes/X11 $CPPFLAGS"
|
||||
LIBS="-ldpstk -ldps -lpsres -lXt $X_PRE_LIBS $LIBS"
|
||||
|
@ -694,6 +713,8 @@ elif test x"$BUILD_GRAPHICS" = "xart"; then
|
|||
fi
|
||||
elif test x"$BUILD_GRAPHICS" = "xxlib"; then
|
||||
LIBS="$FREETYPE_LIBS $LIBS"
|
||||
elif test x"$BUILD_GRAPHICS" = "xheadlesslib"; then
|
||||
: # Nothing to do
|
||||
elif test x"$BUILD_GRAPHICS" = "xwinlib"; then
|
||||
: # Nothing to do
|
||||
elif test x"$BUILD_GRAPHICS" = "xopal"; then
|
||||
|
@ -757,15 +778,17 @@ if test $BUILD_SERVER = win32; then
|
|||
fi
|
||||
|
||||
AH_TOP([
|
||||
#define SERVER_x11 1
|
||||
#define SERVER_win32 2
|
||||
#define SERVER_wayland 3
|
||||
#define GRAPHICS_xdps 0
|
||||
#define GRAPHICS_art 1
|
||||
#define GRAPHICS_xlib 2
|
||||
#define GRAPHICS_winlib 3
|
||||
#define GRAPHICS_cairo 4
|
||||
#define GRAPHICS_opal 5
|
||||
#define SERVER_x11 1
|
||||
#define SERVER_win32 2
|
||||
#define SERVER_wayland 3
|
||||
#define SERVER_xheadless 4
|
||||
#define GRAPHICS_xdps 0
|
||||
#define GRAPHICS_art 1
|
||||
#define GRAPHICS_xlib 2
|
||||
#define GRAPHICS_winlib 3
|
||||
#define GRAPHICS_cairo 4
|
||||
#define GRAPHICS_opal 5
|
||||
#define GRAPHICS_headlesslib 6
|
||||
])
|
||||
AC_DEFINE_UNQUOTED(BUILD_SERVER,SERVER_$BUILD_SERVER,
|
||||
[Define to type of window server to build])
|
||||
|
|
Loading…
Reference in a new issue