2017-04-25 14:41:48 +02:00
|
|
|
/* grTk4.c -
|
|
|
|
|
*
|
|
|
|
|
* Copyright 2003 Open Circuit Design, Inc., for MultiGiG Ltd.
|
|
|
|
|
*
|
|
|
|
|
* This file contains functions to manage the graphics tablet associated
|
|
|
|
|
* with the X display.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <signal.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
|
|
|
|
|
|
#include "tcltk/tclmagic.h"
|
|
|
|
|
#include "utils/magic.h"
|
|
|
|
|
#include "utils/magsgtty.h"
|
|
|
|
|
#include "textio/textio.h"
|
|
|
|
|
#include "utils/geometry.h"
|
|
|
|
|
#include "windows/windows.h"
|
|
|
|
|
#include "graphics/graphics.h"
|
|
|
|
|
#include "graphics/graphicsInt.h"
|
|
|
|
|
#include "textio/txcommands.h"
|
|
|
|
|
#include "grTkInt.h"
|
|
|
|
|
#include "grTkCommon.h"
|
|
|
|
|
|
2020-05-23 23:13:14 +02:00
|
|
|
|
2017-04-25 14:41:48 +02:00
|
|
|
/*---------------------------------------------------------
|
|
|
|
|
* GrTkDisableTablet:
|
|
|
|
|
* Turns off the cursor.
|
|
|
|
|
*
|
|
|
|
|
* Results: None.
|
|
|
|
|
*
|
2020-05-23 23:13:14 +02:00
|
|
|
* Side Effects: None.
|
2017-04-25 14:41:48 +02:00
|
|
|
*---------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
GrTkDisableTablet ()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-23 23:13:14 +02:00
|
|
|
|
2017-04-25 14:41:48 +02:00
|
|
|
/*---------------------------------------------------------
|
|
|
|
|
* GrTkEnableTablet:
|
|
|
|
|
* This routine enables the graphics tablet.
|
|
|
|
|
*
|
2020-05-23 23:13:14 +02:00
|
|
|
* Results:
|
2017-04-25 14:41:48 +02:00
|
|
|
* None.
|
|
|
|
|
*
|
|
|
|
|
* Side Effects:
|
|
|
|
|
* Simply turn on the crosshair.
|
|
|
|
|
*---------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
GrTkEnableTablet ()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-23 23:13:14 +02:00
|
|
|
|
2017-04-25 14:41:48 +02:00
|
|
|
/*
|
|
|
|
|
* ----------------------------------------------------------------------------
|
|
|
|
|
* grtkGetCursorPos:
|
|
|
|
|
* Read the cursor position in magic coordinates.
|
|
|
|
|
*
|
|
|
|
|
* Results:
|
|
|
|
|
* TRUE is returned if the coordinates were succesfully read, FALSE
|
|
|
|
|
* otherwise.
|
|
|
|
|
*
|
|
|
|
|
* Side effects:
|
|
|
|
|
* The parameter is filled in with the cursor position, in the form of
|
|
|
|
|
* a point in screen coordinates.
|
|
|
|
|
* ----------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
grtkGetCursorPos (mw, p)
|
|
|
|
|
MagWindow *mw;
|
|
|
|
|
Point *p; /* point to be filled in with screen coordinates */
|
|
|
|
|
{
|
|
|
|
|
int x, y, x1, y1;
|
|
|
|
|
unsigned int buttons;
|
|
|
|
|
Window win1, win2;
|
|
|
|
|
|
|
|
|
|
if (mw == NULL) mw = grCurrent.mw;
|
2022-09-27 16:43:04 +02:00
|
|
|
if (mw == NULL) return FALSE;
|
2020-05-23 23:13:14 +02:00
|
|
|
|
2017-04-25 14:41:48 +02:00
|
|
|
XQueryPointer(grXdpy, Tk_WindowId((Tk_Window)mw->w_grdata),
|
|
|
|
|
&win1, &win2, &x1, &y1,
|
|
|
|
|
&x, &y, &buttons);
|
|
|
|
|
p->p_x = x;
|
|
|
|
|
p->p_y = grXtransY(mw, y);
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* ----------------------------------------------------------------------------
|
|
|
|
|
* grtkGetCursorRootPos:
|
|
|
|
|
* Read the cursor position in screen root coordinates.
|
|
|
|
|
*
|
|
|
|
|
* Results:
|
|
|
|
|
* TRUE is returned if the coordinates were succesfully read, FALSE
|
|
|
|
|
* otherwise.
|
|
|
|
|
*
|
|
|
|
|
* Side effects:
|
|
|
|
|
* The parameter is filled in with the cursor position, in the form of
|
|
|
|
|
* a point in screen coordinates.
|
|
|
|
|
* ----------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
grtkGetCursorRootPos (mw, p)
|
|
|
|
|
MagWindow *mw;
|
|
|
|
|
Point *p; /* point to be filled in with root coordinates */
|
|
|
|
|
{
|
|
|
|
|
int x, y, x1, y1;
|
|
|
|
|
unsigned int buttons;
|
|
|
|
|
Window win1, win2;
|
|
|
|
|
|
|
|
|
|
if (mw == NULL) mw = grCurrent.mw;
|
2020-05-23 23:13:14 +02:00
|
|
|
|
2017-04-25 14:41:48 +02:00
|
|
|
XQueryPointer(grXdpy, Tk_WindowId((Tk_Window)mw->w_grdata),
|
|
|
|
|
&win1, &win2, &x1, &y1,
|
|
|
|
|
&x, &y, &buttons);
|
|
|
|
|
p->p_x = x1;
|
|
|
|
|
p->p_y = y1;
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|