Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • ryanneph/xserver
  • wjp/xserver
  • DemiMarie/xserver
  • uvas/xserver
  • cl91/xserver
  • heymiaoO/xserver
  • oreaus/xserver
  • miztake/xserver
  • stapelberg/xserver
  • PaulKocialkowski/xserver
  • CendioOssman/xserver
  • wiz/xserver
  • maos20008/xserver
  • dougvj/xserver
  • gldrk/xserver
  • TMR5454/xserver
  • cubanismo/xserver
  • agoins/xserver
  • kleinerm/xserver
  • alanc/xserver
  • zagursky/xserver
  • Kyawswat/xserver
  • hexiaodong/xserver
  • gilvbp/xserver
  • vliaskov/xserver
  • aarondill/xserver
  • zzyiwei/xserver
  • arichardson/xserver
  • jcherry/xserver
  • erwinou/xserver
  • nathankidd/xserver
  • jexposit/xserver
  • refi_64/xserver
  • kupper.pa/xserver
  • kbrenneman/xserver
  • thesamesam/xserver
  • LickmeDown/xserver
  • meMuszr/xserver
  • Julia/xserver
  • twaik/xserver
  • fvalasiad/xserver
  • zzxyb/xserver
  • HermannSW/xserver
  • ekurzinger/xserver
  • NSUTanghaixiang/xserver
  • huxd1532/xserver
  • vinilokorlok/xserver
  • bbeckett/xserver
  • dslater38/xserver
  • emersion/xserver
  • zzag/xserver
  • ccullumbine2018/xserver
  • daniels/xserver
  • doraskayo/xserver
  • llandwerlin/xserver
  • XDXTHX/xserver
  • zboszor/xserver
  • jadahl/xserver
  • shadeslayer/xserver
  • ecurtin/xserver
  • pekdon/xserver
  • tomty89/xserver
  • russellcnv/xserver
  • orbea/xserver
  • lyudess/xserver
  • lucmann/xserver
  • tmlind/xserver
  • tholin/xserver
  • chema/xserver
  • J-Bu/xserver
  • chenhuacai/xserver
  • E5ten/xserver
  • haagch/xserver
  • whot/xserver
  • nacho.resa/xserver
  • strassek/xserver
  • tzimmermann/xserver
  • liyi42/xserver
  • YusufKhan-gamedev/xserver
  • mgorse1/xserver
  • iv-m/xserver
  • vanvugt/xserver
  • keithp/xserver
  • Rui511/xserver
  • catap/xserver
  • tjbp/xserver
  • webi123/xserver
  • djlucas/xserver
  • noblock/xserver
  • freemangordon/xserver
  • xdandys/xserver
  • afett/xserver
  • xexaxo/xserver
  • jbeich/xserver
  • zeising/xserver
  • romangg/xserver
  • mbiebl/xserver
  • pq/xserver
  • azhadchenko/xserver
  • manu/xserver
  • vsyrjala/xserver
  • Emantor/xserver
  • lostgoat/xserver
  • carlosg/xserver
  • yarivb/xserver
  • kwg/xserver
  • pichika/xserver
  • marv/xserver
  • jcristau/xserver
  • mntmn/xserver
  • klniu/xserver
  • TAAPArthur/xserver
  • sjoerd/xserver
  • Sjecai2/xserver
  • 3v1n0/xserver
  • awilfox/xserver
  • pkubaj/xserver
  • os369510/xserver
  • Gorg/xserver
  • Zamundaaa/xserver
  • lkundrak/xserver
  • niveditharau/xserver
  • ForTheReallys/xserver
  • jmonteiro/xserver
  • jocelyn/xserver
  • ThatMG393/xserver
  • fweimer/xserver
  • mlankhorst/xserver
  • dbn/xserver
  • jturney/xserver
  • mattrope/xserver
  • coypoop/xserver
  • schreibemirhalt/xserver
  • frog/xserver
  • metux/xserver
  • mherrb/xserver
  • rarbab/xserver
  • yshui/xserver
  • muesli4/xserver
  • jannau/xserver
  • mikeroyal/xserver
  • andrebsguedes/xserver
  • JeffyCN/xserver
  • ipominov/xserver
  • gtrentalancia/xserver
  • lucyllewy/xserver
  • qarmin/xserver
  • tagr/xserver
  • zwenna/xserver
  • bkylerussell/xserver
  • mupuf/xserver
  • zubzub/xserver
  • galaxytgtabiday/xserver
  • OlCe/xserver
  • ashafer/xserver
  • dengbo/xserver
  • valpackett/xserver
  • andreyknyazev077/xserver
  • antonovitch/xserver
  • contactshashanksharma/xserver-fork-shashank
  • xorg/xserver
  • gsittyz/xserver
  • akihiko.odaki/xserver
  • sknsean/xserver
  • rnpnr/xserver
  • hitong602/xserver
  • halfline/xserver
  • ismailsiege/xserver
  • dongwonk/xserver
  • GermanAizek/xserver
  • FeepingCreature/xserver
  • Acidburn0zzz/xserver
  • mvlad/xserver
  • puleglot/xserver
  • smelenius/xserver
  • sewn/xserver
  • kaichuan.hsieh/xserver
  • Fatton1/xserver
  • aditj/xserver
  • SimonPilkington/xserver
  • adamdruppe/xserver
  • floppym/xserver
  • trevdave/xserver
  • headrush/xserver
  • luke-jr/xserver
  • davidriley/xserver
  • heitbaum/xserver
  • goosen78/xserver
  • Ma/xserver
  • gmbr3/xserver
  • tsutsui/xserver
  • sherrodejjohnson/xserver
  • ydc-dadada/xserver
  • wengxt/xserver
  • icenowy/xserver
  • denisfa/xserver
  • StarsGreen/xserver
  • adamjrichter/xserver
  • bigon/xserver
  • djacewicz/xserver
  • davidre/xserver
  • kylin0061/xserver
  • arrowd/xserver
  • p12tic/xserver
  • karlosrangel337/xserver
  • bbrezillon/xserver
  • penguin42/xserver
  • anarsoul/xserver
  • marvinjr35/xserver
  • gerddie/xserver
  • knisht/xserver
  • xry111/xserver
  • psyruss85/xserver
  • volkanorhan/xserver
  • luporl/xserver
  • cbur201592/xserver
  • bphaslett/xserver
  • guillem/xserver
  • haihao/xserver
  • zaps166/xserver
  • bentiss/xserver
  • rilian-la-te/xserver
  • wujiangGitHub/xserver
  • mrisaacb/xserver
  • ross/xserver
  • davidedmundson/xserver
  • topimiettinen/xserver
  • MisterDA/xserver
  • DPA/xserver
  • dkorkmazturk/xserver
  • sthibaul/xserver
  • ydirson/xserver
  • lihongtao/xserver
  • karamjameelmoore/xserver
  • RyzenDew/xserver
  • christian-rauch/xserver
  • Vivek/xserver
  • peigongdsd/xserver
  • peng.jin/xserver
  • dixler/xserver
  • mehdigh419/xserver
  • BBaoVanC/xserver
  • Drakulix/xserver
  • bafanahub/xserver
  • jengelh/xserver
  • yangxiaojuan-loongson/xserver
  • pepp/xserver
  • cgzones/xserver
  • luyn/xserver
  • ids1024/xserver
  • svalaskevicius/xserver
  • eschwartz/xserver
  • jayantpranjal0/xserver
  • hmazlan/xserver
  • kerneltoast/xserver
  • Michaelypk/xserver
  • dottedmag/xserver
  • hassoon1986/xserver
  • aplattner/xserver
  • sergiomb/xserver
  • looi/xserver
  • robclark/xserver
  • vitoux.pascal/xserver
  • kennylevinsen/xserver
  • Kishore409/xserver
  • msizanoen1/xserver
  • Daasin/xserver
  • xinbowang/xserver
  • mwei/xserver
  • SpikyCaterpillar1/xserver
  • devin11911191/xserver
  • alex-tu-cc/xserver
  • kaniini/xserver
  • alagner/xserver
  • jcourreges/xserver
  • n3rdopolis/xserver
  • cooperch/xserver
  • peterh/xserver
  • anholt/xserver
  • themaister/xserver
  • josch/xserver
  • jrtc27/xserver
  • JoseExposito/xserver
  • lanodan/xserver
  • Hi-Angel/xserver
  • City-busz/xserver
  • karolherbst/xserver
  • daenzer/xserver
  • dawnhan/xserver
  • avolkov/xserver
  • Tuetuopay/xserver
  • gabifalk/xserver
  • jeremyhu/xserver
  • road2react/xserver
  • 1480c1/xserver
  • Spintzyk/xserver
  • abono/xserver
  • ajax/xserver
  • dougg3/xserver
  • chenx_dust/xserver
  • ernstp/xserver
  • EXtremeExploit/xserver
  • starnight/xserver
  • dirbaio/xserver
  • jwrdegoede/xserver
  • vfjpl/xserver
  • acelan/xserver
  • airlied/xserver
  • justazarsky/xserver
  • sri-ka1ki/xserver
  • benpicco/xserver
  • kaocher82/xserver
  • rgfernandes/xserver
  • lynxeye/xserver
  • tintou/xserver
  • rmader/xserver
  • linkmauve/xserver
  • mattst88/xserver
  • kamarul6401/xserver
  • andy-zetier/xserver
  • bernhardu/xserver
  • causztic/xserver
  • cpmichael/modesetting
  • mwyraz/xserver
  • zhangyaning/xserver
  • olv/xserver
  • hongaoo/xserver
  • LiChenG-P/xserver
  • jsg/xserver
  • Ivaniku/x-taylan
  • dk/xserver
  • manuelcrack642/xserver
  • dkg/xserver
  • ofourdan/xserver
  • mahkoh/xserver
  • AkiSakurai/xserver
  • 1740301466jxz/xserver
  • ZhiJie.Zhang/xserver
  • chengbo7135/xserver
339 results
Show changes
Commits on Source (23)
Showing
with 79 additions and 949 deletions
......@@ -1292,21 +1292,13 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
int rc;
InputClients *iclients = NULL;
*mask = NULL;
*grab = NULL;
if (listener->type == TOUCH_LISTENER_GRAB ||
listener->type == TOUCH_LISTENER_POINTER_GRAB) {
*grab = listener->grab;
BUG_RETURN_VAL(!*grab, FALSE);
}
else if (ti->emulate_pointer && dev->deviceGrab.grab &&
!dev->deviceGrab.fromPassiveGrab) {
/* There may be an active pointer grab on the device */
*grab = dev->deviceGrab.grab;
}
if (*grab) {
*client = rClient(*grab);
*win = (*grab)->window;
*mask = (*grab)->xi2mask;
......@@ -1363,6 +1355,8 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
/* if owner selected, oclients is NULL */
*client = oclients ? rClient(oclients) : wClient(*win);
}
*grab = NULL;
}
return TRUE;
......@@ -1379,6 +1373,16 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
int nevents;
DeviceIntPtr kbd;
/* There may be a pointer grab on the device */
if (!grab) {
grab = dev->deviceGrab.grab;
if (grab) {
win = grab->window;
xi2mask = grab->xi2mask;
client = rClient(grab);
}
}
/* We don't deliver pointer events to non-owners */
if (!TouchResourceIsOwner(ti, listener->listener))
return !Success;
......
......@@ -684,10 +684,6 @@ case $host_os in
fi
fi
AC_CHECK_FUNC(dispatch_async,
AC_DEFINE([HAVE_LIBDISPATCH], 1, [Define to 1 if you have the libdispatch (GCD) available]),
[])
if test "x$XQUARTZ" = xyes ; then
XQUARTZ=yes
XVFB=no
......
......@@ -1482,14 +1482,27 @@ UpdateTouchesForGrab(DeviceIntPtr mouse)
CLIENT_BITS(listener->listener) == grab->resource) {
listener->listener = grab->resource;
listener->level = grab->grabtype;
listener->state = TOUCH_LISTENER_IS_OWNER;
listener->window = grab->window;
if (grab->grabtype == CORE || grab->grabtype == XI ||
!xi2mask_isset(grab->xi2mask, mouse, XI_TouchBegin))
!xi2mask_isset(grab->xi2mask, mouse, XI_TouchBegin)) {
if (listener->type == TOUCH_LISTENER_REGULAR &&
listener->state != TOUCH_LISTENER_AWAITING_BEGIN &&
listener->state != TOUCH_LISTENER_HAS_END) {
/* if the listener already got any events relating to the touch, we must send
a touch end because the grab overrides the previous listener and won't
itself send any touch events.
*/
TouchEmitTouchEnd(mouse, ti, 0, listener->listener);
}
listener->type = TOUCH_LISTENER_POINTER_GRAB;
else
} else {
listener->type = TOUCH_LISTENER_GRAB;
}
listener->state = TOUCH_LISTENER_IS_OWNER;
if (listener->grab)
FreeGrab(listener->grab);
listener->grab = AllocGrab(grab);
......
......@@ -1343,7 +1343,7 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
int buttons, CARD32 ms, int flags,
const ValuatorMask *mask_in)
{
int num_events = 1;
int num_events = 0;
DeviceEvent *event;
RawDeviceEvent *raw = NULL;
double screenx = 0.0, screeny = 0.0; /* desktop coordinate system */
......@@ -1386,6 +1386,10 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
num_events++;
init_raw(pDev, raw, ms, type, buttons);
if (flags & POINTER_EMULATED)
raw->flags = XIPointerEmulated;
set_raw_valuators(raw, &mask, TRUE, raw->valuators.data_raw);
}
......@@ -1454,35 +1458,36 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
master->last.valuators[1] = screeny;
}
event = &events->device_event;
init_device_event(event, pDev, ms, EVENT_SOURCE_NORMAL);
if ((flags & POINTER_RAWONLY) == 0) {
num_events++;
if (type == MotionNotify) {
event->type = ET_Motion;
event->detail.button = 0;
}
else {
if (type == ButtonPress) {
event->type = ET_ButtonPress;
set_button_down(pDev, buttons, BUTTON_POSTED);
event = &events->device_event;
init_device_event(event, pDev, ms, EVENT_SOURCE_NORMAL);
if (type == MotionNotify) {
event->type = ET_Motion;
event->detail.button = 0;
}
else if (type == ButtonRelease) {
event->type = ET_ButtonRelease;
set_button_up(pDev, buttons, BUTTON_POSTED);
else {
if (type == ButtonPress) {
event->type = ET_ButtonPress;
set_button_down(pDev, buttons, BUTTON_POSTED);
}
else if (type == ButtonRelease) {
event->type = ET_ButtonRelease;
set_button_up(pDev, buttons, BUTTON_POSTED);
}
event->detail.button = buttons;
}
event->detail.button = buttons;
}
/* root_x and root_y must be in per-screen coordinates */
event_set_root_coordinates(event, screenx - scr->x, screeny - scr->y);
/* root_x and root_y must be in per-screen coordinates */
event_set_root_coordinates(event, screenx - scr->x, screeny - scr->y);
if (flags & POINTER_EMULATED) {
if (raw)
raw->flags = XIPointerEmulated;
event->flags = XIPointerEmulated;
}
if (flags & POINTER_EMULATED)
event->flags = XIPointerEmulated;
set_valuators(pDev, event, &mask);
set_valuators(pDev, event, &mask);
}
return num_events;
}
......
......@@ -75,7 +75,7 @@
*/
#define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 4)
#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(25, 2)
#define ABI_XINPUT_VERSION SET_ABI_VERSION(24, 2)
#define ABI_XINPUT_VERSION SET_ABI_VERSION(24, 3)
#define ABI_EXTENSION_VERSION SET_ABI_VERSION(10, 0)
#define MODINFOSTRING1 0xef23fdc5
......
......@@ -35,8 +35,6 @@
#include <dix-config.h>
#endif
#include <AvailabilityMacros.h>
#include <dlfcn.h>
#include <OpenGL/OpenGL.h>
......
......@@ -33,8 +33,7 @@ libXquartz_la_SOURCES = \
quartzCocoa.m \
quartzKeyboard.c \
quartzStartup.c \
quartzRandR.c \
console_redirect.c
quartzRandR.c
libXquartz_la_LIBADD = $(top_builddir)/pseudoramiX/libPseudoramiX.la
......@@ -51,5 +50,4 @@ EXTRA_DIST = \
quartzKeyboard.h \
quartzRandR.h \
sanitizedCarbon.h \
sanitizedCocoa.h \
console_redirect.h
sanitizedCocoa.h
......@@ -48,7 +48,6 @@
#include <mach/mach.h>
#include <unistd.h>
#include <AvailabilityMacros.h>
#include <pthread.h>
......@@ -64,11 +63,9 @@ xpbproxy_run(void);
#define XSERVER_VERSION "?"
#endif
#ifdef HAVE_LIBDISPATCH
#include <dispatch/dispatch.h>
static dispatch_queue_t eventTranslationQueue;
#endif
#ifndef __has_feature
#define __has_feature(x) 0
......@@ -85,11 +82,7 @@ static dispatch_queue_t eventTranslationQueue;
extern Bool noTestExtensions;
extern Bool noRenderExtension;
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
static TISInputSourceRef last_key_layout;
#else
static KeyboardLayoutRef last_key_layout;
#endif
/* This preference is only tested on Lion or later as it's not relevant to
* earlier OS versions.
......@@ -352,14 +345,11 @@ message_kit_thread(SEL selector, NSObject *arg)
swallow_keycode = [e keyCode];
do_swallow = YES;
for_x = NO;
#if XPLUGIN_VERSION >= 1
}
else if (XQuartzEnableKeyEquivalents &&
} else if (XQuartzEnableKeyEquivalents &&
xp_is_symbolic_hotkey_event([e eventRef])) {
swallow_keycode = [e keyCode];
do_swallow = YES;
for_x = NO;
#endif
}
else if (XQuartzEnableKeyEquivalents &&
[[self mainMenu] performKeyEquivalent:e]) {
......@@ -490,13 +480,9 @@ message_kit_thread(SEL selector, NSObject *arg)
if (for_appkit) [super sendEvent:e];
if (for_x) {
#ifdef HAVE_LIBDISPATCH
dispatch_async(eventTranslationQueue, ^{
[self sendX11NSEvent:e];
});
#else
[self sendX11NSEvent:e];
#endif
}
}
......@@ -1096,12 +1082,15 @@ X11ApplicationCanEnterRandR(void)
if (!XQuartzIsRootless)
QuartzShowFullscreen(FALSE);
switch (NSRunAlertPanel(title, @"%@",
NSLocalizedString(@"Allow",
@""),
NSLocalizedString(@"Cancel",
@""),
NSLocalizedString(@"Always Allow", @""), msg)) {
NSInteger __block alert_result;
dispatch_sync(dispatch_get_main_queue(), ^{
alert_result = NSRunAlertPanel(title, @"%@",
NSLocalizedString(@"Allow", @""),
NSLocalizedString(@"Cancel", @""),
NSLocalizedString(@"Always Allow", @""), msg);
});
switch (alert_result) {
case NSAlertOtherReturn:
[X11App prefs_set_boolean:@PREFS_NO_RANDR_ALERT value:YES];
[X11App prefs_synchronize];
......@@ -1219,35 +1208,21 @@ X11ApplicationMain(int argc, char **argv, char **envp)
/* Calculate the height of the menubar so we can avoid it. */
aquaMenuBarHeight = [[NSApp mainMenu] menuBarHeight];
#if ! __LP64__
if (!aquaMenuBarHeight) {
aquaMenuBarHeight = [NSMenuView menuBarHeight];
}
#endif
if (!aquaMenuBarHeight) {
NSScreen* primaryScreen = [[NSScreen screens] objectAtIndex:0];
aquaMenuBarHeight = NSHeight([primaryScreen frame]) - NSMaxY([primaryScreen visibleFrame]);
}
#ifdef HAVE_LIBDISPATCH
eventTranslationQueue = dispatch_queue_create(
BUNDLE_ID_PREFIX ".X11.NSEventsToX11EventsQueue", NULL);
assert(eventTranslationQueue != NULL);
#endif
/* Set the key layout seed before we start the server */
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
last_key_layout = TISCopyCurrentKeyboardLayoutInputSource();
if (!last_key_layout)
ErrorF(
"X11ApplicationMain: Unable to determine TISCopyCurrentKeyboardLayoutInputSource() at startup.\n");
#else
KLGetCurrentKeyboardLayout(&last_key_layout);
if (!last_key_layout)
ErrorF(
"X11ApplicationMain: Unable to determine KLGetCurrentKeyboardLayout() at startup.\n");
#endif
if (!QuartsResyncKeymap(FALSE)) {
ErrorF("X11ApplicationMain: Could not build a valid keymap.\n");
......@@ -1583,8 +1558,6 @@ handle_mouse:
}
if (!XQuartzServerVisible && noTestExtensions) {
#if defined(XPLUGIN_VERSION) && XPLUGIN_VERSION > 0
/* Older libXplugin (Tiger/"Stock" Leopard) aren't thread safe, so we can't call xp_find_window from the Appkit thread */
xp_window_id wid = 0;
xp_error err;
......@@ -1597,7 +1570,6 @@ handle_mouse:
err = xp_find_window(location.x, location.y, 0, &wid);
if (err != XP_Success || (err == XP_Success && wid == 0))
#endif
{
bgMouseLocation = location;
bgMouseLocationUpdated = TRUE;
......@@ -1653,11 +1625,6 @@ handle_mouse:
case NSScrollWheel:
{
#if MAC_OS_X_VERSION_MAX_ALLOWED < 1050
float deltaX = [e deltaX];
float deltaY = [e deltaY];
BOOL isContinuous = NO;
#else
CGFloat deltaX = [e deltaX];
CGFloat deltaY = [e deltaY];
CGEventRef cge = [e CGEvent];
......@@ -1679,28 +1646,13 @@ handle_mouse:
deltaY *= lineHeight / 5.0;
}
#endif
#endif
#if !defined(XPLUGIN_VERSION) || XPLUGIN_VERSION == 0
/* If we're in the background, we need to send a MotionNotify event
* first, since we aren't getting them on background mouse motion
*/
if (!XQuartzServerVisible && noTestExtensions) {
bgMouseLocationUpdated = FALSE;
DarwinSendPointerEvents(darwinPointer, MotionNotify, 0,
location.x, location.y,
0.0, 0.0);
}
#endif
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
// TODO: Change 1117 to NSAppKitVersionNumber10_7 when it is defined
if (NSAppKitVersionNumber >= 1117 &&
if (NSAppKitVersionNumber >= NSAppKitVersionNumber10_7 &&
XQuartzScrollInDeviceDirection &&
[e isDirectionInvertedFromDevice]) {
deltaX *= -1;
deltaY *= -1;
}
#endif
/* This hack is in place to better deal with "clicky" scroll wheels:
* http://xquartz.macosforge.org/trac/ticket/562
*/
......@@ -1806,7 +1758,6 @@ handle_mouse:
}
if (darwinSyncKeymap) {
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
TISInputSourceRef key_layout =
TISCopyCurrentKeyboardLayoutInputSource();
TISInputSourceRef clear;
......@@ -1818,12 +1769,7 @@ handle_mouse:
clear = last_key_layout;
last_key_layout = key_layout;
CFRelease(clear);
#else
KeyboardLayoutRef key_layout;
KLGetCurrentKeyboardLayout(&key_layout);
if (key_layout != last_key_layout) {
last_key_layout = key_layout;
#endif
/* Update keyInfo */
if (!QuartsResyncKeymap(TRUE)) {
ErrorF(
......
......@@ -46,20 +46,7 @@
#undef BOOL
#endif
#ifndef NSINTEGER_DEFINED
#if __LP64__ || NS_BUILD_32_LIKE_64
typedef long NSInteger;
typedef unsigned long NSUInteger;
#else
typedef int NSInteger;
typedef unsigned int NSUInteger;
#endif
#endif
@interface X11Controller : NSObject
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
<NSTableViewDataSource>
#endif
@interface X11Controller : NSObject <NSTableViewDataSource>
{
IBOutlet NSPanel *prefs_panel;
......
......@@ -29,7 +29,6 @@
*/
#include "sanitizedCarbon.h"
#include <AvailabilityMacros.h>
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
......@@ -347,10 +346,8 @@ extern char *bundle_id_prefix;
const char *newargv[4];
char buf[128];
char *s;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
int stdout_pipe[2];
int stderr_pipe[2];
#endif
newargv[0] = [X11App prefs_get_string:@PREFS_LOGIN_SHELL default:"/bin/sh"];
newargv[1] = "-c";
......@@ -363,7 +360,6 @@ extern char *bundle_id_prefix;
setenv("DISPLAY", buf, TRUE);
}
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
if (&asl_log_descriptor) {
char *asl_sender;
aslmsg amsg = asl_new(ASL_TYPE_MSG);
......@@ -395,7 +391,6 @@ extern char *bundle_id_prefix;
asl_free(amsg);
}
#endif
/* Do the fork-twice trick to avoid having to reap zombies */
child1 = fork();
......@@ -413,13 +408,11 @@ extern char *bundle_id_prefix;
_exit(1);
case 0: /* child2 */
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
if (&asl_log_descriptor) {
/* Replace our stdout/stderr */
dup2(stdout_pipe[1], STDOUT_FILENO);
dup2(stderr_pipe[1], STDERR_FILENO);
}
#endif
/* close all open files except for standard streams */
max_files = sysconf(_SC_OPEN_MAX);
......@@ -442,13 +435,11 @@ extern char *bundle_id_prefix;
waitpid(child1, &status, 0);
}
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
if (&asl_log_descriptor) {
/* Close the write ends of the pipe */
close(stdout_pipe[1]);
close(stderr_pipe[1]);
}
#endif
}
- (void) app_selected:sender
......@@ -868,13 +859,7 @@ extern char *bundle_id_prefix;
- (IBAction) x11_help:sender
{
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
AHLookupAnchor((CFStringRef)NSLocalizedString(@"Mac Help",
no comment),
CFSTR("mchlp2276"));
#else
AHLookupAnchor(CFSTR("com.apple.machelp"), CFSTR("mchlp2276"));
#endif
}
- (OSX_BOOL) validateMenuItem:(NSMenuItem *)item
......
......@@ -35,12 +35,6 @@
#include "window.h"
#include <Xplugin.h>
#if XPLUGIN_VERSION < 4
typedef int xp_frame_attr;
typedef int xp_frame_class;
typedef int xp_frame_rect;
#endif
typedef int (*DisableUpdateProc)(void);
typedef int (*EnableUpdateProc)(void);
typedef int (*SetWindowLevelProc)(WindowPtr pWin, int level);
......
/*
* Copyright (c) 2011-2012 Apple Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
* HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name(s) of the above
* copyright holders shall not be used in advertising or otherwise to
* promote the sale, use or other dealings in this Software without
* prior written authorization.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#else
#define DEBUG_CONSOLE_REDIRECT 1
#define HAVE_LIBDISPATCH 1
#endif
#include <assert.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/event.h>
#include <asl.h>
#include <errno.h>
#include <fcntl.h>
#include "console_redirect.h"
#define BUF_SIZE 512
#ifdef HAVE_LIBDISPATCH
#include <dispatch/dispatch.h>
static dispatch_queue_t redirect_serial_q;
static dispatch_group_t read_source_group;
#else
#include <pthread.h>
static pthread_t redirect_pthread;
static pthread_mutex_t redirect_fds_lock = PTHREAD_MUTEX_INITIALIZER;
static int kq;
/* Notifications to our reader thread */
#define ASL_REDIRECT_TERMINATE ((void *)(uintptr_t)1)
#endif
typedef struct {
int level;
aslclient asl;
aslmsg msg;
/* Buffered reading */
char *buf;
char *w;
#ifdef HAVE_LIBDISPATCH
dispatch_source_t read_source;
#endif
} asl_redirect;
static asl_redirect *redirect_fds = NULL;
static int n_redirect_fds = 0;
/* Read from the FD until there is no more to read and redirect to ASL.
* Preconditions:
* 1: pthread_mutex_lock lock is held (pthreads) or called
* from the appropriate serial queue for operating on
* redirect_fds
* 2: fd corresponds to a valid entry in redirect_fds
*
* Return values:
* If the pipe is closed, EOF is returned regardless of how many bytes
* were processed. If the pipe is still open, the number of read bytes
* is returned.
*/
static inline int
_read_redirect(int fd, int flush)
{
int total_read = 0;
int nbytes;
asl_redirect *aslr = &redirect_fds[fd];
while ((nbytes =
read(fd, aslr->w,
BUF_SIZE - (aslr->w - aslr->buf) - 1)) > 0) {
char *s, *p;
/* Increment our returned number read */
total_read += nbytes;
/* Increment our write location */
aslr->w += nbytes;
aslr->w[0] = '\0';
/* One line at a time */
for (p = aslr->buf; p < aslr->w; p = s + 1) {
// Find null or \n
for (s = p; *s && *s != '\n'; s++) ;
if (*s == '\n') {
*s = '\0';
}
if (s < aslr->w || aslr->buf == p) {
/* Either the first of multiple messages or one message which is larger than our buffer */
asl_log(aslr->asl, aslr->msg, aslr->level, "%s", p);
}
else {
/* We reached the end of the buffer, move this chunk to the start. */
memmove(aslr->buf, p, BUF_SIZE - (p - aslr->buf));
aslr->w = aslr->buf + (s - p);
break;
}
}
if (p == aslr->w) {
/* Start writing at the beginning in the case where we flushed */
aslr->w = aslr->buf;
}
}
/* Flush if requested or we're at EOF */
if (flush || nbytes == 0) {
if (aslr->w > aslr->buf) {
*aslr->w = '\0';
asl_log(aslr->asl, aslr->msg, aslr->level, "%s", aslr->buf);
}
}
if (nbytes == 0)
return EOF;
return total_read;
}
#ifdef HAVE_LIBDISPATCH
static void
read_from_source(void *_source)
{
dispatch_source_t source = (dispatch_source_t)_source;
int fd = dispatch_source_get_handle(source);
if (_read_redirect(fd, 0) == EOF) {
dispatch_source_cancel(source);
}
}
static void
cancel_source(void *_source)
{
dispatch_source_t source = (dispatch_source_t)_source;
int fd = dispatch_source_get_handle(source);
asl_redirect *aslr = &redirect_fds[fd];
/* Flush the buffer */
_read_redirect(fd, 1);
close(fd);
free(aslr->buf);
memset(aslr, 0, sizeof(*aslr));
dispatch_release(source);
dispatch_group_leave(read_source_group);
}
#else /* !HAVE_LIBDISPATCH */
static void *
redirect_thread(void *ctx __unused)
{
struct kevent ev;
int n;
while (1) {
n = kevent(kq, NULL, 0, &ev, 1, NULL);
/* Bail on errors */
if (n < 0) {
asl_log(NULL, NULL, ASL_LEVEL_ERR, "kevent failure: %s",
strerror(errno));
break;
}
/* This should not happen */
if (n == 0)
continue;
switch (ev.filter) {
case EVFILT_READ:
pthread_mutex_lock(&redirect_fds_lock);
{
int fd = ev.ident;
int close_fd = 0;
asl_redirect *aslr = &redirect_fds[fd];
if (fd < 0 || fd >= n_redirect_fds || aslr->buf == NULL) {
asl_log(NULL, NULL, ASL_LEVEL_ERR,
"Unexpected file descriptor: %d",
fd);
goto next;
}
if (ev.flags & EV_EOF) {
close_fd = 1;
if (EOF != _read_redirect(fd, 1)) {
asl_log(
NULL, NULL, ASL_LEVEL_ERR,
"kevent reported EOF on %d, but read doesn't concur.",
fd);
}
}
else {
close_fd = (EOF == _read_redirect(fd, 0));
}
if (close_fd) {
EV_SET(&ev, fd, EVFILT_READ, EV_DELETE, 0, 0, 0);
kevent(kq, &ev, 1, NULL, 0, NULL);
close(fd);
free(aslr->buf);
memset(aslr, 0, sizeof(*aslr));
}
}
next:
pthread_mutex_unlock(&redirect_fds_lock);
case EVFILT_TIMER:
if (ev.udata == ASL_REDIRECT_TERMINATE)
return NULL;
default:
;
;
}
}
return NULL;
}
#endif
static void
redirect_atexit(void)
{
/* stdout is linebuffered, so flush the buffer */
if (redirect_fds[STDOUT_FILENO].buf)
fflush(stdout);
#ifdef HAVE_LIBDISPATCH
{
int i;
/* Cancel all of our dispatch sources, so they flush to ASL */
for (i = 0; i < n_redirect_fds; i++)
if (redirect_fds[i].read_source)
dispatch_source_cancel(redirect_fds[i].read_source);
/* Wait at least three seconds for our sources to flush to ASL */
dispatch_group_wait(read_source_group,
dispatch_time(DISPATCH_TIME_NOW, 3LL *
NSEC_PER_SEC));
}
#else
{
struct kevent ev;
/* Tell our reader thread it is time to pack up and go home */
EV_SET(&ev, 0, EVFILT_TIMER, EV_ADD | EV_ONESHOT, 0, 0,
ASL_REDIRECT_TERMINATE);
kevent(kq, &ev, 1, NULL, 0, NULL);
pthread_join(redirect_pthread, NULL);
}
#endif
}
#ifdef HAVE_LIBDISPATCH
static void
xq_asl_init(void *ctx __unused)
#else
static void
xq_asl_init(void)
#endif
{
assert((redirect_fds = calloc(16, sizeof(*redirect_fds))) != NULL);
n_redirect_fds = 16;
#ifdef HAVE_LIBDISPATCH
redirect_serial_q = dispatch_queue_create("com.apple.asl-redirect", NULL);
assert(redirect_serial_q != NULL);
read_source_group = dispatch_group_create();
assert(read_source_group != NULL);
#else
assert((kq = kqueue()) != -1);
assert(pthread_create(&redirect_pthread, NULL, redirect_thread,
NULL) == 0);
#endif
atexit(redirect_atexit);
}
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
#define fls(v) xq_fls(v)
static inline int fls(int value) {
unsigned int b, v;
v = *((unsigned int *)&value);
for(b=0 ; v ; v >>= 1 , b++);
return b;
}
#endif
int
xq_asl_log_fd(aslclient asl, aslmsg msg, int level, int fd)
{
#ifdef HAVE_LIBDISPATCH
int err __block = 0;
static dispatch_once_t once_control;
dispatch_once_f(&once_control, NULL, xq_asl_init);
#else
int err = 0;
static pthread_once_t once_control = PTHREAD_ONCE_INIT;
assert(pthread_once(&once_control, xq_asl_init) == 0);
#endif
if (fd < 0)
return EBADF;
#ifdef HAVE_LIBDISPATCH
#define BLOCK_DONE return
dispatch_sync(redirect_serial_q, ^
#else
#define BLOCK_DONE goto done
assert(pthread_mutex_lock(&redirect_fds_lock) == 0);
#endif
{
/* Reallocate if we need more space */
if (fd >= n_redirect_fds) {
size_t new_n = 1 << (fls(fd) + 1);
asl_redirect *new_array =
realloc(redirect_fds, new_n *
sizeof(*redirect_fds));
if (!new_array) {
err = errno;
BLOCK_DONE;
}
redirect_fds = new_array;
memset(redirect_fds + n_redirect_fds, 0, (new_n -
n_redirect_fds) * sizeof(*redirect_fds));
n_redirect_fds = new_n;
}
/* If we're already listening on it, return error. */
if (redirect_fds[fd].buf != NULL) {
err = EBADF;
BLOCK_DONE;
}
/* Initialize our buffer */
redirect_fds[fd].buf = (char *)malloc(BUF_SIZE);
if (redirect_fds[fd].buf == NULL) {
err = errno;
BLOCK_DONE;
}
redirect_fds[fd].w = redirect_fds[fd].buf;
/* Store our ASL settings */
redirect_fds[fd].level = level;
redirect_fds[fd].asl = asl;
redirect_fds[fd].msg = msg;
/* Don't block on reads from this fd */
fcntl(fd, F_SETFL,
O_NONBLOCK);
/* Start listening */
#ifdef HAVE_LIBDISPATCH
{
dispatch_source_t read_source =
dispatch_source_create(
DISPATCH_SOURCE_TYPE_READ, fd, 0,
redirect_serial_q);
redirect_fds[fd].read_source = read_source;
dispatch_set_context(read_source, read_source);
dispatch_source_set_event_handler_f(read_source,
read_from_source);
dispatch_source_set_cancel_handler_f(read_source,
cancel_source);
dispatch_group_enter(read_source_group);
dispatch_resume(read_source);
}
#else
{
struct kevent ev;
EV_SET(&ev, fd, EVFILT_READ, EV_ADD, 0, 0, 0);
kevent(kq, &ev, 1, NULL, 0, NULL);
}
#endif
}
#ifdef HAVE_LIBDISPATCH
);
#else
done:
assert(pthread_mutex_unlock(&redirect_fds_lock) == 0);
#endif
#undef BLOCK_DONE
return err;
}
int
xq_asl_capture_fd(aslclient asl, aslmsg msg, int level, int fd)
{
int pipepair[2];
/* Create pipe */
if (pipe(pipepair) == -1)
return errno;
/* Close the read fd but not the write fd on exec */
if (fcntl(pipepair[0], F_SETFD, FD_CLOEXEC) == -1)
return errno;
/* Replace the existing fd */
if (dup2(pipepair[1], fd) == -1) {
close(pipepair[0]);
close(pipepair[1]);
return errno;
}
/* If we capture STDOUT_FILENO, make sure we linebuffer stdout */
if (fd == STDOUT_FILENO)
setlinebuf(stdout);
/* Close the duplicate fds since they've been reassigned */
close(pipepair[1]);
/* Hand off the read end of our pipe to xq_asl_log_fd */
return xq_asl_log_fd(asl, msg, level, pipepair[0]);
}
#ifdef DEBUG_CONSOLE_REDIRECT
int
main(int argc __unused, char * *argv __unused)
{
xq_asl_capture_fd(NULL, NULL, ASL_LEVEL_NOTICE, STDOUT_FILENO);
xq_asl_capture_fd(NULL, NULL, ASL_LEVEL_ERR, STDERR_FILENO);
fprintf(stderr, "TEST ERR1\n");
fprintf(stdout, "TEST OUT1\n");
fprintf(stderr, "TEST ERR2\n");
fprintf(stdout, "TEST OUT2\n");
system("/bin/echo SYST OUT");
system("/bin/echo SYST ERR >&2");
fprintf(stdout, "TEST OUT3\n");
fprintf(stdout, "TEST OUT4\n");
fprintf(stderr, "TEST ERR3\n");
fprintf(stderr, "TEST ERR4\n");
exit(0);
}
#endif
/* Copyright (c) 2011-2012 Apple Inc.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
* HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name(s) of the above
* copyright holders shall not be used in advertising or otherwise to
* promote the sale, use or other dealings in this Software without
* prior written authorization.
*/
#ifndef _XQUARTZ_CONSOLE_REDIRECT_H_
#define _XQUARTZ_CONSOLE_REDIRECT_H_
#include <asl.h>
/* The given fd is replaced with a pipe. Anything written to it will will be
* logged to ASL.
*/
int
xq_asl_capture_fd(aslclient asl, aslmsg msg, int level, int fd);
/* The given fd is read from and passed along to ASL until all write ends of the
* pipe are closed. Once the last writer has closed the pipe, we close our end.
*/
int
xq_asl_log_fd(aslclient asl, aslmsg msg, int level, int fd);
#endif
......@@ -29,7 +29,6 @@
*/
#include <CoreFoundation/CoreFoundation.h>
#include <AvailabilityMacros.h>
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
......@@ -44,11 +43,7 @@
#include <stdbool.h>
#include <signal.h>
#ifdef HAVE_LIBDISPATCH
#include <dispatch/dispatch.h>
#else
#include <pthread.h>
#endif
#include <sys/socket.h>
#include <sys/un.h>
......@@ -61,7 +56,7 @@
#include "mach_startup.h"
#include "mach_startupServer.h"
#include "console_redirect.h"
#include <asl.h>
/* From darwinEvents.c ... but don't want to pull in all the server cruft */
void
......@@ -91,12 +86,8 @@ extern int noPanoramiXExtension;
static char __crashreporter_info_buff__[4096] = { 0 };
static const char *__crashreporter_info__ __attribute__((__used__)) =
&__crashreporter_info_buff__[0];
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
// This is actually a toolchain requirement, but I'm not sure the correct check,
// but it should be fine to just only include it for Leopard and later. This line
// just tells the linker to never strip this symbol (such as for space optimization)
// This line just tells the linker to never strip this symbol (such as for space optimization)
asm (".desc ___crashreporter_info__, 0x10");
#endif
static const char *__crashreporter_info__base =
"X.Org X Server " XSERVER_VERSION;
......@@ -119,23 +110,6 @@ static char *pref_app_to_run;
static char *pref_login_shell;
static char *pref_startx_script;
#ifndef HAVE_LIBDISPATCH
/*** Pthread Magics ***/
static pthread_t
create_thread(void *(*func)(void *), void *arg)
{
pthread_attr_t attr;
pthread_t tid;
pthread_attr_init(&attr);
pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
pthread_create(&tid, &attr, func, arg);
pthread_attr_destroy(&attr);
return tid;
}
#endif
/*** Mach-O IPC Stuffs ***/
......@@ -243,16 +217,9 @@ typedef struct {
/* This thread accepts an incoming connection and hands off the file
* descriptor for the new connection to accept_fd_handoff()
*/
#ifdef HAVE_LIBDISPATCH
static void
socket_handoff(socket_handoff_t *handoff_data)
{
#else
static void *
socket_handoff_thread(void *arg)
{
socket_handoff_t *handoff_data = (socket_handoff_t *)arg;
#endif
int launchd_fd = -1;
int connected_fd;
......@@ -287,9 +254,6 @@ socket_handoff_thread(void *arg)
launchd_fd);
DarwinListenOnOpenFD(launchd_fd);
#ifndef HAVE_LIBDISPATCH
return NULL;
#endif
}
static int
......@@ -373,14 +337,10 @@ do_request_fd_handoff_socket(mach_port_t port, string_t filename)
strlcpy(filename, handoff_data->filename, STRING_T_SIZE);
#ifdef HAVE_LIBDISPATCH
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,
0), ^ {
socket_handoff(handoff_data);
});
#else
create_thread(socket_handoff_thread, handoff_data);
#endif
#ifdef DEBUG
ErrorF(
......@@ -477,14 +437,9 @@ startup_trigger(int argc, char **argv, char **envp)
kr = bootstrap_look_up(bootstrap_port, server_bootstrap_name, &mp);
if (kr != KERN_SUCCESS) {
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
ErrorF("bootstrap_look_up(%s): %s\n", server_bootstrap_name,
bootstrap_strerror(
kr));
#else
ErrorF("bootstrap_look_up(%s): %ul\n", server_bootstrap_name,
(unsigned long)kr);
#endif
exit(EXIT_FAILURE);
}
......@@ -564,24 +519,8 @@ setup_console_redirect(const char *bundle_id)
asl_set_filter(aslc, ASL_FILTER_MASK_UPTO(ASL_LEVEL_WARNING));
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
# if MAC_OS_X_VERSION_MIN_REQUIRED < 1080
if (asl_log_descriptor)
# endif
{
asl_log_descriptor(aslc, NULL, ASL_LEVEL_INFO, STDOUT_FILENO, ASL_LOG_DESCRIPTOR_WRITE);
asl_log_descriptor(aslc, NULL, ASL_LEVEL_NOTICE, STDERR_FILENO, ASL_LOG_DESCRIPTOR_WRITE);
}
# if MAC_OS_X_VERSION_MIN_REQUIRED < 1080
else {
xq_asl_capture_fd(aslc, NULL, ASL_LEVEL_INFO, STDOUT_FILENO);
xq_asl_capture_fd(aslc, NULL, ASL_LEVEL_NOTICE, STDERR_FILENO);
}
# endif
#else
xq_asl_capture_fd(aslc, NULL, ASL_LEVEL_INFO, STDOUT_FILENO);
xq_asl_capture_fd(aslc, NULL, ASL_LEVEL_NOTICE, STDERR_FILENO);
#endif
asl_log_descriptor(aslc, NULL, ASL_LEVEL_INFO, STDOUT_FILENO, ASL_LOG_DESCRIPTOR_WRITE);
asl_log_descriptor(aslc, NULL, ASL_LEVEL_NOTICE, STDERR_FILENO, ASL_LOG_DESCRIPTOR_WRITE);
}
static void
......
......@@ -50,8 +50,6 @@
#include <signal.h>
#include <AvailabilityMacros.h>
#include "launchd_fd.h"
static char x11_path[PATH_MAX + 1];
......@@ -61,8 +59,6 @@ aslclient aslc;
static void
set_x11_path(void)
{
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
CFURLRef appURL = NULL;
OSStatus osstatus =
LSFindApplicationForInfo(kLSUnknownCreator, CFSTR(
......@@ -104,11 +100,6 @@ set_x11_path(void)
(int)osstatus);
exit(11);
}
#else
/* TODO: Make Tiger smarter... but TBH, this should never get called on Tiger... */
strlcpy(x11_path, "/Applications/Utilities/X11.app/Contents/MacOS/X11",
sizeof(x11_path));
#endif
}
static int
......@@ -291,15 +282,9 @@ main(int argc, char **argv, char **envp)
}
if (kr != KERN_SUCCESS) {
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
asl_log(aslc, NULL, ASL_LEVEL_ERR,
"Xquartz: bootstrap_look_up(): %s", bootstrap_strerror(
kr));
#else
asl_log(aslc, NULL, ASL_LEVEL_ERR,
"Xquartz: bootstrap_look_up(): %ul",
(unsigned long)kr);
#endif
return EXIT_FAILURE;
}
}
......
......@@ -120,7 +120,7 @@ or you can include extra information such as the file, line, and function where
.TP 8
.B $ syslog -w -F '$(Time) $(Sender) <$(Level)> $(File):$(Line) $(Function) :: $(Message)' -k Facility eq @bundle_id_prefix@
.PP
By default, XQaurtz sets an ASL mask which prevents it from logging messages
By default, XQuartz sets an ASL mask which prevents it from logging messages
below the ASL_LEVEL_WARNING level (meaning almost all logging is done strictly
to the file referenced above). To force XQuartz to send all log messages to
syslogd(8), you can adjust this mask using the following syslog(1) command:
......
......@@ -35,17 +35,6 @@
#include <asl.h>
#include <AvailabilityMacros.h>
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
#if __LP64__ || NS_BUILD_32_LIKE_64
typedef long NSInteger;
typedef unsigned long NSUInteger;
#else
typedef int NSInteger;
typedef unsigned int NSUInteger;
#endif
#endif
#define Cursor X_Cursor
#undef _SHAPE_H_
#include <X11/Xlib.h>
......
......@@ -673,13 +673,8 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete,
return;
}
#ifdef __LP64__
DebugF("pbtypes retainCount after containsObject: %lu\n",
[pbtypes retainCount]);
#else
DebugF("pbtypes retainCount after containsObject: %u\n",
[pbtypes retainCount]);
#endif
data = [pb stringForType:NSStringPboardType];
......@@ -698,11 +693,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete,
if (length < 50) {
DebugF("UTF-8: %s\n", bytes);
#ifdef __LP64__
DebugF("UTF-8 length: %lu\n", length);
#else
DebugF("UTF-8 length: %u\n", length);
#endif
}
}
else {
......@@ -1196,13 +1187,8 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete,
return;
}
#ifdef __LP64__
DebugF("data retainCount before NSBitmapImageRep initWithData: %lu\n",
[data retainCount]);
#else
DebugF("data retainCount before NSBitmapImageRep initWithData: %u\n",
[data retainCount]);
#endif
bmimage = [[NSBitmapImageRep alloc] initWithData:data];
......@@ -1212,13 +1198,8 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete,
return;
}
#ifdef __LP64__
DebugF("data retainCount after NSBitmapImageRep initWithData: %lu\n",
[data retainCount]);
#else
DebugF("data retainCount after NSBitmapImageRep initWithData: %u\n",
[data retainCount]);
#endif
@try
{
......@@ -1233,13 +1214,8 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete,
return;
}
#ifdef __LP64__
DebugF("bmimage retainCount after TIFFRepresentation %lu\n",
[bmimage retainCount]);
#else
DebugF("bmimage retainCount after TIFFRepresentation %u\n",
[bmimage retainCount]);
#endif
pbtypes = [NSArray arrayWithObjects:NSTIFFPboardType, nil];
......@@ -1256,11 +1232,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete,
[data autorelease];
#ifdef __LP64__
DebugF("bmimage retainCount before release %lu\n", [bmimage retainCount]);
#else
DebugF("bmimage retainCount before release %u\n", [bmimage retainCount]);
#endif
[bmimage autorelease];
}
......
......@@ -72,12 +72,6 @@
#include <rootlessCommon.h>
#include <Xplugin.h>
/* Work around a bug on Leopard's headers */
#if defined (__LP64__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 && MAC_OS_X_VERSION_MAX_ALLOWED < 1060
extern OSErr UpdateSystemActivity(UInt8 activity);
#define OverallAct 0
#endif
DevPrivateKeyRec quartzScreenKeyRec;
int aquaMenuBarHeight = 0;
QuartzModeProcsPtr quartzProcs = NULL;
......
......@@ -46,7 +46,6 @@
#include <stdlib.h>
#include <errno.h>
#include <sys/stat.h>
#include <AvailabilityMacros.h>
#include "quartz.h"
#include "darwin.h"
......@@ -733,54 +732,6 @@ DarwinModifierStringToNXMask(const char *str, int separatelr)
return 0;
}
#if !defined(__LP64__) || MAC_OS_X_VERSION_MIN_REQUIRED < 1050
static inline UniChar
macroman2ucs(unsigned char c)
{
/* Precalculated table mapping MacRoman-128 to Unicode. Generated
by creating single element CFStringRefs then extracting the
first character. */
static const unsigned short table[128] = {
0xc4, 0xc5, 0xc7, 0xc9, 0xd1, 0xd6, 0xdc,
0xe1,
0xe0, 0xe2, 0xe4, 0xe3, 0xe5, 0xe7, 0xe9,
0xe8,
0xea, 0xeb, 0xed, 0xec, 0xee, 0xef, 0xf1,
0xf3,
0xf2, 0xf4, 0xf6, 0xf5, 0xfa, 0xf9, 0xfb,
0xfc,
0x2020, 0xb0, 0xa2, 0xa3, 0xa7, 0x2022, 0xb6,
0xdf,
0xae, 0xa9, 0x2122, 0xb4, 0xa8, 0x2260, 0xc6,
0xd8,
0x221e, 0xb1, 0x2264, 0x2265, 0xa5, 0xb5, 0x2202,
0x2211,
0x220f, 0x3c0, 0x222b, 0xaa, 0xba, 0x3a9, 0xe6,
0xf8,
0xbf, 0xa1, 0xac, 0x221a, 0x192, 0x2248, 0x2206,
0xab,
0xbb, 0x2026, 0xa0, 0xc0, 0xc3, 0xd5, 0x152,
0x153,
0x2013, 0x2014, 0x201c, 0x201d, 0x2018, 0x2019, 0xf7,
0x25ca,
0xff, 0x178, 0x2044, 0x20ac, 0x2039, 0x203a, 0xfb01,
0xfb02,
0x2021, 0xb7, 0x201a, 0x201e, 0x2030, 0xc2, 0xca,
0xc1,
0xcb, 0xc8, 0xcd, 0xce, 0xcf, 0xcc, 0xd3,
0xd4,
0xf8ff, 0xd2, 0xda, 0xdb, 0xd9, 0x131, 0x2c6,
0x2dc,
0xaf, 0x2d8, 0x2d9, 0x2da, 0xb8, 0x2dd, 0x2db,
0x2c7,
};
if (c < 128) return c;
else return table[c - 128];
}
#endif
static KeySym
make_dead_key(KeySym in)
{
......@@ -795,10 +746,6 @@ make_dead_key(KeySym in)
static Bool
QuartzReadSystemKeymap(darwinKeyboardInfo *info)
{
#if !defined(__LP64__) || MAC_OS_X_VERSION_MIN_REQUIRED < 1050
KeyboardLayoutRef key_layout;
int is_uchr = 1;
#endif
const void *chr_data = NULL;
int num_keycodes = NUM_KEYCODES;
UInt32 keyboard_type = LMGetKbdType();
......@@ -807,7 +754,6 @@ QuartzReadSystemKeymap(darwinKeyboardInfo *info)
KeySym *k;
CFDataRef currentKeyLayoutDataRef = NULL;
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
TISInputSourceRef currentKeyLayoutRef =
TISCopyCurrentKeyboardLayoutInputSource();
......@@ -816,62 +762,8 @@ QuartzReadSystemKeymap(darwinKeyboardInfo *info)
currentKeyLayoutRef, kTISPropertyUnicodeKeyLayoutData);
if (currentKeyLayoutDataRef)
chr_data = CFDataGetBytePtr(currentKeyLayoutDataRef);
}
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations" // KLGetCurrentKeyboardLayout, KLGetKeyboardLayoutProperty
#endif
#if !defined(__LP64__) || MAC_OS_X_VERSION_MIN_REQUIRED < 1050
if (chr_data == NULL) {
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
ErrorF(
"X11.app: Error detected in determining keyboard layout. If you are using an Apple-provided keyboard layout, please report this error at http://xquartz.macosforge.org and http://bugreport.apple.com\n");
ErrorF(
"X11.app: Debug Info: keyboard_type=%u, currentKeyLayoutRef=%p, currentKeyLayoutDataRef=%p, chr_data=%p\n",
(unsigned)keyboard_type, currentKeyLayoutRef,
currentKeyLayoutDataRef, chr_data);
#endif
KLGetCurrentKeyboardLayout(&key_layout);
KLGetKeyboardLayoutProperty(key_layout, kKLuchrData, &chr_data);
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
if (chr_data != NULL) {
ErrorF(
"X11.app: Fallback succeeded, but this is still a bug. Please report the above information.\n");
}
#endif
}
if (chr_data == NULL) {
ErrorF(
"X11.app: Debug Info: kKLuchrData failed, trying kKLKCHRData.\n");
ErrorF(
"If you are using a 3rd party keyboard layout, please see http://xquartz.macosforge.org/trac/ticket/154\n");
KLGetKeyboardLayoutProperty(key_layout, kKLKCHRData, &chr_data);
is_uchr = 0;
num_keycodes = 128;
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
if (chr_data != NULL) {
ErrorF(
"X11.app: Fallback succeeded, but this is still a bug. Please report the above information.\n");
}
#endif
}
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
if (currentKeyLayoutRef)
CFRelease(currentKeyLayoutRef);
#endif
}
if (chr_data == NULL) {
ErrorF("Couldn't get uchr or kchr resource\n");
......@@ -895,9 +787,6 @@ QuartzReadSystemKeymap(darwinKeyboardInfo *info)
k = info->keyMap + i * GLYPHS_PER_KEY;
for (j = 0; j < 4; j++) {
#if !defined(__LP64__) || MAC_OS_X_VERSION_MIN_REQUIRED < 1050
if (is_uchr) {
#endif
UniChar s[8];
UniCharCount len;
UInt32 dead_key_state = 0, extra_dead = 0;
......@@ -924,42 +813,6 @@ QuartzReadSystemKeymap(darwinKeyboardInfo *info)
k[j] = ucs2keysym(s[0]);
if (dead_key_state != 0) k[j] = make_dead_key(k[j]);
}
#if !defined(__LP64__) || MAC_OS_X_VERSION_MIN_REQUIRED < 1050
}
else { // kchr
UInt32 c, state = 0, state2 = 0;
UInt16 code;
code = i | mods[j];
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations" // KeyTranslate
#endif
c = KeyTranslate(chr_data, code, &state);
/* Dead keys are only processed on key-down, so ask
to translate those events. When we find a dead key,
translating the matching key up event will give
us the actual dead character. */
if (state != 0)
c = KeyTranslate(chr_data, code | 128, &state2);
#ifdef __clang__
#pragma clang diagnostic pop
#endif
/* Characters seem to be in MacRoman encoding. */
if (c != 0 && c != 0x0010) {
k[j] = ucs2keysym(macroman2ucs(c & 255));
if (state != 0) k[j] = make_dead_key(k[j]);
}
}
#endif
}
if (k[3] == k[2]) k[3] = NoSymbol;
......