/* xtcontext - implementation of some DPS functions for Xlib/Xt library.

   Copyright (C) 1995 Free Software Foundation, Inc.

   Written by:  Adam Fedor <fedor@boulder.colorado.edu>
   Date: Nov 1995
   
   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 Library 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
   Library General Public License for more details.
   
   You should have received a copy of the GNU Library General Public
   License along with this library; if not, write to the Free
   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
   */

#include "dpsclient.h"
#include "xwfriends.h"
#include "DrawContext.h"

/* Setting and getting the current context - from dpsfriends.h */
void 
DPSSetContext( DPSContext ctxt )
{
  [DrawContext setContext: ctxt];
}

DPSContext DPSGetCurrentContext(void)
{
  return [DrawContext currentContext];
}

/* Routines from dpsclient.h */
void DPSDefaultErrorProc(
  DPSContext ctxt,
  DPSErrorCode errorCode,
  long unsigned int arg1,
  long unsigned int arg2 )
{
  fprintf(stderr, "Got an error\n");
}

void DPSDestroyContext(DPSContext ctxt)
{
  [(DrawContext *)ctxt->priv release];
}

/* Creating contexts, event handling - from dpsGNU.h */

void DPSAsynchronousWaitContext(DPSContext ctxt, DPSPingProc handler, 
				void *userData)
{
}


DPSContext DPSCreateContext(
    const char *hostName,
    const char *serverName,
    DPSTextProc textProc,
    DPSErrorProc errorProc )
{
  DrawContext *ctxt;
  ctxt = [DrawContext defaultContext: hostName : serverName : textProc 
   : errorProc timeout: 0 withZone: NULL];
  [ctxt retain];
  return [ctxt context];
}

DPSContext DPSCreateContextWithTimeoutFromZone(
    const char *hostName,
    const char *serverName,
    DPSTextProc textProc,
    DPSErrorProc errorProc,
    int timeout,
    NSZone *zone )
{
  DrawContext *ctxt;
  ctxt = [DrawContext defaultContext: hostName : serverName : textProc 
   : errorProc timeout: timeout withZone: zone];
  [ctxt retain];
  return [ctxt context];
}

DPSContext DPSCreateNonsecureContext(
    const char *hostName,
    const char *serverName,
    DPSTextProc textProc,
    DPSErrorProc errorProc,
    int timeout,
    NSZone *zone )
{
  DrawContext *ctxt;
  ctxt = [DrawContext defaultContext: hostName : serverName : textProc 
   : errorProc timeout: timeout withZone: zone];
  [ctxt retain];
  return [ctxt context];
}

DPSContext DPSCreateStreamContext(
    NXStream *st,
    int debugging,
    DPSProgramEncoding progEnc,
    DPSNameEncoding nameEnc,
    DPSErrorProc errorProc )
{
  DrawContext *ctxt;
  ctxt = [DrawContext streamContext: st 
   programEnc: progEnc
   nameEnc: nameEnc
   errorProc: errorProc];
  [ctxt retain];
  return [ctxt context];
}

int DPSSetTracking( int flag )
{
  return 0;
}

void DPSStartWaitCursorTimer(void)
{
}

DPSTimedEntry DPSAddTimedEntry(
    double period,
    DPSTimedEntryProc handler,
    void *userData,
    int priority )
{
  return 0;
}

void DPSRemoveTimedEntry( DPSTimedEntry te )
{
}

void DPSAddFD(
    int fd,
    DPSFDProc routine,
    void *data,
    int priority )
{
}

void DPSRemoveFD( int fd )
{
}

void DPSSetDeadKeysEnabled(DPSContext ctxt, int flag)
{
}

DPSEventFilterFunc DPSSetEventFunc(
    DPSContext ctxt,
    DPSEventFilterFunc func )
{
  return 0;
}

int _DPSGetOrPeekEvent( DPSContext ctxt, NXEvent *eventStorage,
			int mask, double wait, int threshold, int peek )
{
  return 0;
}

int DPSPostEvent( NXEvent *event, int atStart )
{
  return 0;
}

void DPSDiscardEvents( DPSContext ctxt, int mask )
{
}

int DPSTraceContext( DPSContext ctxt, int flag )
{
  return 0;
}

void DPSTraceEvents(DPSContext ctxt, int flag)
{
}

void DPSSendEOF(DPSContext ctxtArg)
{
}

