Back to index

plt-scheme  4.2.1
Classes | Defines | Functions | Variables
mredx.cxx File Reference
#include "wx_main.h"
#include "wx_win.h"
#include "wx_clipb.h"
#include "scheme.h"
#include "mred.h"
#include <X11/Shell.h>
#include "wx_timer.h"

Go to the source code of this file.

Classes

class  Check_Ungrab_Record
class  wxXtTimer
struct  FindRec

Defines

#define Uses_XtIntrinsic
#define Uses_XtIntrinsicP
#define Uses_XLib
#define WSTACK_INC   3
#define WINCASEEX(type, record, field)   case type: window = e->record.field; break
#define WINCASE(type, record)   WINCASEEX(type, record, window)
#define SINGLE_INSTANCE_HANDLER_CODE

Functions

Window wxAddClipboardWindowProperty (Atom prop)
wxWindowwxLocationToWindow (int x, int y)
void wxAddGrab (Widget w)
void wxRemoveGrab (Widget w)
Widget wxGetAppToplevel ()
void wxPutAppToplevel (Widget w)
void MrEdInitFirstContext (MrEdContext *c)
void MrEdInitNewContext (MrEdContext *c)
void MrEdDestroyContext (MrEdFinalizedContext *c)
static Window GetEventWindow (XEvent *e)
static void CheckUngrab (Display *dpy, Check_Ungrab_Record *cur)
static Bool CheckPred (Display *display, XEvent *e, char *args)
int MrEdGetNextEvent (int check_only, int current_only, XEvent *event, MrEdContext **which)
void wxSetSensitive (Widget w, Bool enabled)
Display * MrEdGetXDisplay (void)
int MrEdGetDoubleTime (void)
void MrEdDispatchEvent (XEvent *event)
int MrEdCheckForBreak (void)
void wxRemoveTimeOut (long timer)
long wxAppAddTimeOut (XtAppContext app_ctx, unsigned long interval, XtTimerCallbackProc callback, XtPointer data, Widget w)
voidIsWidgetFrame (wxObject *f, void *d)
static wxWindowFindMrEdWindow (Display *d, Window xw)
int wxLocaleStringToChar (char *str, int slen)
int wxUTF8StringToChar (char *str, int slen)
static int has_property (Display *d, Window w, Atom atag)
static int wxSendOrSetTag (char *tag, char *pre_tag, char *msg)
static Scheme_Objectprep_single_instance (int argc, Scheme_Object **argv)
int wxCheckSingleInstance (Scheme_Env *global_env)

Variables

static int short_circuit = 0
static int just_check = 0
static int checking_for_break = 0
static Widget just_this_one
static Widget orig_top_level
static Widget save_top_level = 0
static KeyCode breaking_code
static int breaking_code_set = 0
static Widget * grab_stack
static Widget grabber
static int grab_stack_pos = 0
static int grab_stack_size = 0
Widget wx_clipWindow
Widget wx_selWindow
Atom wx_single_instance_tag
static unsigned long lastUngrabTime
static unsigned long lastUnhideTime
static int need_unhide = 0
static int cur_registered = 0
static Check_Ungrab_Recordfirst_cur = NULL
static Check_Ungrab_Recordlast_cur = NULL
static Scheme_Hash_Tabledisabled_widgets

Class Documentation

class Check_Ungrab_Record

Definition at line 159 of file mredx.cxx.

Collaboration diagram for Check_Ungrab_Record:
Class Members
Check_Ungrab_Record * next
Window window
int x
int x_root
int y
int y_root
struct FindRec

Definition at line 672 of file mredx.cxx.

Collaboration diagram for FindRec:
Class Members
Widget w
wxWindow * wx

Define Documentation

Value:
"(lambda (f host)" \
"  (let-values ([(path) (simplify-path" \
"                        (path->complete-path" \
"                         (or (find-executable-path (find-system-path 'run-file) #f)" \
"                             (find-system-path 'run-file))" \
"                         (current-directory)))])" \
"    (let-values ([(tag) (string->bytes/utf-8" \
"                         (format \"~a:~a_~a\" host path (version)))])" \
"      (f tag " \
"         (bytes-append #\"pre\" tag)" \
"         (apply" \
"          bytes-append" \
"          (map (lambda (s)" \
"                 (let-values ([(s) (path->string" \
"                                    (path->complete-path s (current-directory)))])" \
"                   (string->bytes/utf-8" \
"                    (format \"~a:~a\"" \
"                            (string-length s)" \
"                            s))))" \
"               (vector->list" \
"                (current-command-line-arguments))))))))"

Definition at line 929 of file mredx.cxx.

#define Uses_XLib

Definition at line 12 of file mredx.cxx.

Definition at line 10 of file mredx.cxx.

Definition at line 11 of file mredx.cxx.

#define WINCASE (   type,
  record 
)    WINCASEEX(type, record, window)
#define WINCASEEX (   type,
  record,
  field 
)    case type: window = e->record.field; break
#define WSTACK_INC   3

Definition at line 34 of file mredx.cxx.


Function Documentation

static Bool CheckPred ( Display *  display,
XEvent *  e,
char *  args 
) [static]

Definition at line 194 of file mredx.cxx.

{
  Window window;
  Widget widget;

  switch (e->type) {
  case ButtonPress:
  case ButtonRelease:
  case MotionNotify:
    if (e->xbutton.time > lastUnhideTime) {
      lastUnhideTime = e->xbutton.time;
      need_unhide = 1;
    }
    break;
  default:
    break;
  }

  if (short_circuit)
    return FALSE;

#if 0
  printf("trying %s\n", get_event_type(e));
#endif

  window = GetEventWindow(e);

  if (window) {
    widget = XtWindowToWidget(display, window);
#if 1
    if (widget)
      if (e->type == DestroyNotify)
       printf("DestroyNotified window %lx is still widget-mapped; BadWindow error is imminent.\n", window);
#endif
  } else
    widget = 0;

  /* Check for mouse-down events outside the indicated window.  That
     might indicate a mouse grab gone awry, and we need to fix it.
     The only legitimate grabs that operate on other windows are with
     menus, and those have no wx counterpart. */
  if (widget && (e->type == ButtonPress)) {
    /* lastUngrabTime keeps us from checking the same events
       over and over again. */
    if (e->xbutton.time > lastUngrabTime) {
      Check_Ungrab_Record *cur;
      if (!cur_registered) {
       wxREGGLOB(first_cur);
       wxREGGLOB(last_cur);
      }
      cur = new WXGC_PTRS Check_Ungrab_Record;
      cur->window = e->xbutton.window;
      cur->x = e->xbutton.x;
      cur->y = e->xbutton.y;
      cur->x_root = e->xbutton.x_root;
      cur->y_root = e->xbutton.y_root;
      if (last_cur)
       last_cur->next = cur;
      else
       first_cur = cur;
      last_cur = cur;
      lastUngrabTime = e->xbutton.time;
    }
  }

  if (widget) {
    Widget parent = 0;

    /* Special hack in cooperation with Clipboard.cc
       to make clipboard operations happen in the right
       eventspace. */
    if (widget == wx_clipWindow) {
      wxClipboardClient *clipOwner;
      clipOwner = wxTheClipboard->GetClipboardClient();
      if (clipOwner) {
       MrEdContext *cc = (MrEdContext *)clipOwner->context;
       if (cc)
         parent = cc->finalized->toplevel;
      }
    }
    if (widget == wx_selWindow) {
      wxClipboardClient *clipOwner;
      clipOwner = wxTheSelection->GetClipboardClient();
      if (clipOwner) {
       MrEdContext *cc = (MrEdContext *)clipOwner->context;
       if (cc)
         parent = cc->finalized->toplevel;
      }
    }

    if (!parent) {
      for (parent = widget; XtParent(parent); parent = XtParent(parent)) {
      }
    }
    
#if 0
    printf("parent: %lx context: %lx\n", parent, parent_context);
#endif

    if (just_this_one) {
      if (parent == just_this_one) {
       if (checking_for_break) {
         if (e->type == KeyPress) {
           if ((e->xkey.state & ControlMask) 
#if BREAKING_REQUIRES_SHIFT
              && (e->xkey.state & ShiftMask)
#endif
              && (e->xkey.keycode == breaking_code))
             goto found;
         }
       } else {
         goto found;
       }
      } else {
#if 0
       printf("wrong eventspace (%lx != %lx)\n", just_this_one, parent_context);
#endif
      }
    } else {
      MrEdContext *c;
      
      for (c = mred_contexts; c; c = c->next) {
       if (c->finalized->toplevel == parent) {
         if (!c->ready) {
#if 0
           printf("not ready\n");
#endif
           return FALSE;
         } else {
           if (args)
             *(MrEdContext **)args = c;
           goto found;
         }
       }
      }

      /* Toplevel without context; handle in the main context: */
#if 0
      printf("Can't map top-level to eventspace for %lx\n", window);
#endif
      if (checking_for_break)
       return FALSE;
      else {
       if (args)
         *(MrEdContext **)args = NULL;
       goto found;
      }
    }

  } else {
#if 0
    printf("warning: window->widget mapping failed: %lx; event: %d; parent: %lx\n", 
          window, e->type, ((XCreateWindowEvent *)e)->parent);
#endif
    if (checking_for_break)
      return FALSE;
    else if (just_this_one)
      return FALSE;
    else {
      /* Toplevel without context; handle in the main context: */
      if (args)
       *(MrEdContext **)args = NULL;
      goto found;
    }
  }

  return FALSE;

 found:
  if (just_check) {
    short_circuit = TRUE;
    return FALSE;
  } else
    return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void CheckUngrab ( Display *  dpy,
Check_Ungrab_Record cur 
) [static]

Definition at line 169 of file mredx.cxx.

{     
  Window root;
  int x, y;
  unsigned w, h, b, d;
  
  XGetGeometry(dpy, cur->window, 
              &root, &x, &y, &w, &h,
              &b, &d);
  if ((cur->x < 0) || (cur->y < 0)
      || ((unsigned int)cur->x > w) || ((unsigned int)cur->y > h)) {
    /* Looks bad, but is it a click in a MrEd window
       that we could care about? */
    
    wxWindow *w;
    w = wxLocationToWindow(cur->x_root, cur->y_root);
    
    if (w) {
      /* Looks like we need to ungrab */
      XUngrabPointer(dpy, 0);
      XUngrabKeyboard(dpy, 0);
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static wxWindow* FindMrEdWindow ( Display *  d,
Window  xw 
) [static]

Definition at line 690 of file mredx.cxx.

{
  Widget w;
  w = XtWindowToWidget(d, xw);
  if (w) {
    FindRec fr;
    fr.w = w;
    fr.wx = NULL;
    MrEdForEachFrame(IsWidgetFrame, &fr);
    return fr.wx;
  } else {
    wxWindow *m;
    Window root, parent, *children;
    unsigned int n, i;
    if (XQueryTree(d, xw, &root, &parent, &children, &n)) {
      if (children) {
       m = NULL;
       for (i = 0; i < n; i++) {
         m = FindMrEdWindow(d, children[i]);
         if (m)
           break;
       }
       XFree(children);
       return m;
      }
    }
     
    return NULL;
  }
}

Here is the call graph for this function:

static Window GetEventWindow ( XEvent *  e) [static]

Definition at line 107 of file mredx.cxx.

{
  Window window = 0;

#define WINCASEEX(type, record, field) case type: window = e->record.field; break
#define WINCASE(type, record) WINCASEEX(type, record, window)

  switch (e->type) {
    WINCASE(KeyPress, xkey);
    WINCASE(KeyRelease, xkey);
    WINCASE(ButtonPress, xbutton);
    WINCASE(ButtonRelease, xbutton);
    WINCASE(MotionNotify, xmotion);
    WINCASE(EnterNotify, xcrossing);
    WINCASE(LeaveNotify, xcrossing);
    WINCASE(FocusIn, xfocus);
    WINCASE(FocusOut, xfocus);
    WINCASE(KeymapNotify, xkeymap);
    WINCASE(Expose, xexpose);
    WINCASEEX(GraphicsExpose, xgraphicsexpose, drawable);
    WINCASEEX(NoExpose, xnoexpose, drawable);
    WINCASE(VisibilityNotify, xvisibility);
    WINCASE(CreateNotify, xcreatewindow);
    WINCASE(DestroyNotify, xdestroywindow);
    WINCASE(UnmapNotify, xunmap);
    WINCASE(MapNotify, xmap);
    WINCASE(MapRequest, xmaprequest);
    WINCASE(ReparentNotify, xreparent);
    WINCASE(ConfigureNotify, xconfigure);
    WINCASE(ConfigureRequest, xconfigurerequest);
    WINCASE(GravityNotify, xgravity);
    WINCASE(ResizeRequest, xresizerequest);
    WINCASE(CirculateNotify, xcirculate);
    WINCASE(CirculateRequest, xcirculaterequest);
    WINCASE(PropertyNotify, xproperty);
    WINCASE(SelectionClear, xselectionclear);
    WINCASEEX(SelectionRequest, xselectionrequest, owner);
    WINCASEEX(SelectionNotify, xselection, requestor);
    WINCASE(ColormapNotify, xcolormap);
    WINCASE(ClientMessage, xclient);
    WINCASE(MappingNotify, xmapping);
  default:
    break;
  }

  return window;
}

Here is the caller graph for this function:

static int has_property ( Display *  d,
Window  w,
Atom  atag 
) [static]

Definition at line 777 of file mredx.cxx.

{
  Atom actual;
  int format;
  unsigned long count, remaining;
  unsigned char *data = 0;

  XGetWindowProperty(d, w, atag,
                   0, 0x8000000L, FALSE, 
                   AnyPropertyType, &actual, &format,
                   &count, &remaining, &data);

  if (data)
    XFree(data);

  return (actual != None);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void* IsWidgetFrame ( wxObject f,
void d 
)

Definition at line 677 of file mredx.cxx.

{
  FindRec *fr = (FindRec *)d;
  wxWindow_Xintern *i;
  
  i = ((wxWindow *)f)->GetHandle();
  if (i->frame == fr->w) {
    fr->wx = (wxWindow *)f;
  }

  return d;
}

Here is the caller graph for this function:

Definition at line 544 of file mredx.cxx.

{
  int br;
  GC_CAN_IGNORE XEvent e;
  Display *d;

  if (!orig_top_level)
    d = XtDisplay(save_top_level);
  else
    d = XtDisplay(orig_top_level);

  if (!breaking_code_set) {
    breaking_code = XKeysymToKeycode(d, 'c');
    breaking_code_set = 1;
  }

  XFlush(d);

  checking_for_break = 1;
  br = MrEdGetNextEvent(0, 1, &e, NULL);
  checking_for_break = 0;

  return br;
}

Here is the call graph for this function:

Definition at line 102 of file mredx.cxx.

{
  XtDestroyWidget(c->toplevel);
}

Here is the caller graph for this function:

void MrEdDispatchEvent ( XEvent *  event)

Definition at line 474 of file mredx.cxx.

{
  if (disabled_widgets) {
    int type = event->type;
    Display *d;
    
    d = MrEdGetXDisplay();

    if ((type == KeyPress)
       || (type == KeyRelease)
       || (type == ButtonPress)
       || (type == ButtonRelease)
       || (type == MotionNotify)
       || (type == EnterNotify)
       || (type == LeaveNotify)
       || ((type == ClientMessage)
           && !strcmp(XGetAtomName(d, event->xclient.message_type), "WM_PROTOCOLS")
           && !strcmp(XGetAtomName(d, event->xclient.data.l[0]), "WM_DELETE_WINDOW"))) {
      Window window;
      Widget widget, ow, exempt = 0;
      MrEdContext *c;
      wxWindow *ew;

      window = GetEventWindow(event);

      if (window)
       widget = XtWindowToWidget(d, window);
      else
       widget = 0;
      ow = widget;

      c = MrEdGetContext();
      ew = c->modal_window;
      if (ew) {
       wxWindow_Xintern *ph;
       ph = ew->GetHandle();
       exempt = ph->frame;
      }

      while (widget) {
       if (widget == grabber)
         break;

       /* Only start checking the enabled state with the first
          top-level window. That way, PreOnChar and PreOnEvent are
           called appropriately. wxWindows/Xt ensures that key and mouse
           events are not dispatched to disabled items. */

       if (XtIsSubclass(widget, transientShellWidgetClass)
           || XtIsSubclass(widget, topLevelShellWidgetClass)) {
         
         if (scheme_hash_get(disabled_widgets, (Scheme_Object *)widget)) {
#if 0
           printf("disabled: %lx from %lx\n", widget, ow);
#endif
           return;
         }
       }

       if (widget == exempt)
         break;

       widget = XtParent(widget);
      }
    }
  }

  XtDispatchEvent(event);
}

Here is the call graph for this function:

Definition at line 465 of file mredx.cxx.

{
  return XtGetMultiClickTime(MrEdGetXDisplay());
}

Here is the call graph for this function:

Here is the caller graph for this function:

int MrEdGetNextEvent ( int  check_only,
int  current_only,
XEvent *  event,
MrEdContext **  which 
)

Definition at line 371 of file mredx.cxx.

{
  Display *d;
  int got;

  if (which)
    *which = NULL;

  just_check = check_only;
  just_this_one = (current_only ? wxGetAppToplevel() : (Widget)NULL);

  if (!orig_top_level)
    d = XtDisplay(save_top_level);
  else
    d = XtDisplay(orig_top_level);

  got = XCheckIfEvent(d, event, CheckPred, (char *)which);

  if (need_unhide) {
    need_unhide = 0;
    wxUnhideAllCursors();
  }

  while (first_cur) {
    CheckUngrab(d, first_cur);
    first_cur = first_cur->next;
  }
  last_cur = NULL;

  if (got) {
    just_check = 0;
    return 1;
  } else if (short_circuit) {
    short_circuit = 0;
    return 1;
  }

  return 0;
}

Here is the call graph for this function:

Display* MrEdGetXDisplay ( void  )

Definition at line 457 of file mredx.cxx.

{
  if (!orig_top_level)
    return XtDisplay(save_top_level);
  else
    return XtDisplay(orig_top_level);
}

Here is the caller graph for this function:

Definition at line 88 of file mredx.cxx.

Here is the caller graph for this function:

Definition at line 95 of file mredx.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

static Scheme_Object* prep_single_instance ( int  argc,
Scheme_Object **  argv 
) [static]

Definition at line 952 of file mredx.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

Window wxAddClipboardWindowProperty ( Atom  prop)

Definition at line 111 of file Clipboard.cc.

{
  unsigned char data[1] = { 'm' };
  XChangeProperty(XtDisplay(wx_clipWindow), XtWindow(wx_clipWindow),
                prop, prop, 8, PropModeReplace, data, 1);
  return XtWindow(wx_clipWindow);
}

Here is the caller graph for this function:

void wxAddGrab ( Widget  w)

Definition at line 44 of file mredx.cxx.

    {
      if (!grab_stack_pos) {
       Widget *naya;
       if (!grab_stack)
         wxREGGLOB(grab_stack);
       grab_stack_size += WSTACK_INC;
       naya = (Widget *)scheme_malloc(grab_stack_size * sizeof(Widget));
       memcpy(naya + WSTACK_INC, grab_stack, (grab_stack_size - WSTACK_INC) * sizeof(Widget));
       grab_stack = naya;
       grab_stack_pos = WSTACK_INC;
      }

      grabber = grab_stack[--grab_stack_pos] = w;
    }

Here is the caller graph for this function:

long wxAppAddTimeOut ( XtAppContext  app_ctx,
unsigned long  interval,
XtTimerCallbackProc  callback,
XtPointer  data,
Widget  w 
)

Definition at line 647 of file mredx.cxx.

    {
      wxTimer *t;
      long result;

      t = new wxXtTimer(w, callback, data);
      t->Start(interval, TRUE);
#ifdef MZ_PRECISE_GC
      result = (long)GC_malloc_immobile_box(t);
#else
      result = (long)t;
#endif

#ifdef MZ_PRECISE_GC
      XFORM_RESET_VAR_STACK;
#endif

      return result;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 961 of file mredx.cxx.

{
  Scheme_Object *a[2], *v, *nam, *nr, *ns;
  char buf[256];
  Scheme_Config *config;
  Scheme_Cont_Frame_Data frame;

  if (!wxGetHostName(buf, 256)) {
    buf[0] = 0;
  }

  /* ************************************************************ */
  /* Set up a namespace to evaluate SINGLE_INSTANCE_HANDLER_CODE: */
  ns = scheme_make_namespace(0, NULL);

  config = scheme_extend_config(scheme_current_config(),
                                MZCONFIG_ENV,
                                ns);
  scheme_push_continuation_frame(&frame);
  scheme_install_config(config);

  nam = scheme_builtin_value("namespace-attach-module");
  a[0] = (Scheme_Object *)global_env;
  a[1] = scheme_make_pair(scheme_intern_symbol("quote"),
                          scheme_make_pair(scheme_intern_symbol("#%utils"),
                                           scheme_null));
  scheme_apply(nam, 2, a);

  nr = scheme_builtin_value("namespace-require");
  a[0] = a[1];
  scheme_apply(nr, 1, a);

  a[0] = scheme_make_pair(scheme_intern_symbol("quote"),
                          scheme_make_pair(scheme_intern_symbol("#%min-stx"),
                                           scheme_null));
  scheme_apply(nr, 1, a);

  a[0] = scheme_make_pair(scheme_intern_symbol("quote"),
                          scheme_make_pair(scheme_intern_symbol("#%kernel"),
                                           scheme_null));
  scheme_apply(nr, 1, a);
  /* *********************************************************** **/

  a[0] = scheme_make_prim(prep_single_instance);
  a[1] = scheme_make_byte_string(buf);
  v = scheme_apply(scheme_eval_string(SINGLE_INSTANCE_HANDLER_CODE,
                                  (Scheme_Env *)ns),
                 2,
                 a);

  /* Pop the namespace: */
  scheme_pop_continuation_frame(&frame);

  return SCHEME_TRUEP(v);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Widget wxGetAppToplevel ( )

Definition at line 72 of file mredx.cxx.

{
  if (save_top_level)
    return save_top_level;
  else {
    MrEdContext *c;
    c = MrEdGetContext();
    return c->finalized->toplevel;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

int wxLocaleStringToChar ( char *  str,
int  slen 
)

Definition at line 755 of file mredx.cxx.

{
  Scheme_Object *s;
  s = scheme_make_locale_string(str);
  if (SCHEME_CHAR_STRLEN_VAL(s))
    return SCHEME_CHAR_STR_VAL(s)[0];
  else
    return 0;
}

Here is the caller graph for this function:

Definition at line 1315 of file mredmac.cxx.

{
  Point p;
  WindowPtr f;
  Rect bounds;
  int part;

  p.h = x;
  p.v = y;
  part = FindWindow(p, &f);
  
  GetWindowBounds(f, kWindowContentRgn, &bounds);
  if (IsWindowVisible(f)
      && (bounds.left <= x)
      && (bounds.right >= x)
      && (bounds.top <= y)
      && (bounds.bottom >= y)) {
    /* Found it */
    wxFrame *frame;
    void *refcon;

    refcon = (void *)GetWRefCon(f);
    frame = (wxFrame *)GET_SAFEREF(refcon);

    if (frame) {
      /* Mac: some frames really represent dialogs. Any modal frame is
        a dialog, so extract its only child. */
      if (frame->IsModal()) {
       wxChildNode *node2;
       wxChildList *cl;
       cl = frame->GetChildren();
       node2 = cl->First();
       if (node2)
         return (wxWindow *)node2->Data();
      } else
       return frame;
    } else
      return NULL;
  }
  
  return NULL;
}

Here is the call graph for this function:

void wxPutAppToplevel ( Widget  w)

Definition at line 83 of file mredx.cxx.

{
  save_top_level = w;
}

Here is the caller graph for this function:

void wxRemoveGrab ( Widget  w)

Definition at line 60 of file mredx.cxx.

    {
      if (w != grabber)
       return;

      if (++grab_stack_pos < grab_stack_size)
       grabber = grab_stack[grab_stack_pos];
      else
       grabber = NULL;
    }

Here is the caller graph for this function:

void wxRemoveTimeOut ( long  timer)

Definition at line 629 of file mredx.cxx.

    {
      wxXtTimer *t;
#ifdef MZ_PRECISE_GC
      t = *(wxXtTimer **)timer;
      GC_free_immobile_box((void **)timer);
#else
      t = (wxXtTimer *)timer;
#endif

      t->Stop();
      t->Stopped();

#ifdef MZ_PRECISE_GC
      XFORM_RESET_VAR_STACK;
#endif
    }

Here is the call graph for this function:

Here is the caller graph for this function:

static int wxSendOrSetTag ( char *  tag,
char *  pre_tag,
char *  msg 
) [static]

Definition at line 795 of file mredx.cxx.

{
  Display *d;
  Window root, parent, *children;
  unsigned int n, i;
  Atom atag, apre_tag;
  Window target = 0, me;
  int try_again = 0, add_property_back = 0, found_nothing;

  /* Elect a leader, relying on the fact that the X server serializes
     its interactions.
     
     Each client sets a pre-tag, and then checks all windows. If any
     window has a (non-pre) tag already, then that's the leader. If no
     one else has a pre tag, then this client is elected, and it sets
     the tag on itself.  If someone else has a pre tag, we try again;
     if the other window id is lower, this client drops it pre tag, so
     that the other will be elected eventually.  Note that if two
     clients set a pre tag, then one must see the other (because
     neither looks until its tag is set). Livelock is a possibility if
     clients continuously appear with ever higher window ids, but that
     possibility is exceedingly remote. */

  if (!orig_top_level)
    d = XtDisplay(save_top_level);
  else
    d = XtDisplay(orig_top_level);

  apre_tag = XInternAtom(d, pre_tag, False);
  atag = XInternAtom(d, tag, False);

  wx_single_instance_tag = atag;

  me = wxAddClipboardWindowProperty(apre_tag);


  do {
    if (add_property_back) {
      wxAddClipboardWindowProperty(apre_tag);
      add_property_back = 1;
    }

    XFlush(d);
    XSync(d, FALSE);
    
    found_nothing = 1;

    if (XQueryTree(d, DefaultRootWindow(d),
                 &root, &parent, &children, &n)) {
      for (i = n; i--; ) {
       if (children[i] != me) {
         if (has_property(d, children[i], atag)) {
           /* Found the leader: */
           target = children[i];
           try_again = 0;
           found_nothing = 0;
           break;
         } else if (has_property(d, children[i], apre_tag)) {
           /* Found another candidate. If our ID is
              higher, then withdrawl candidacy. Loop
              to wait for some process to assume leadership. */
           if ((long)me >= (long)children[i])
             XDeleteProperty(d, me, apre_tag);
           try_again = 1;
           found_nothing = 0;
         }
       }
      }
      
      if (found_nothing && try_again) {
       /* This can only happen if some candidate process
          (with a lower window ID) has now exited. Try 
          again to become the leader. */
       add_property_back = 1;
      }
      
      if (children)
       XFree(children);
    }
  } while (try_again);

  if (target) {
    GC_CAN_IGNORE XEvent xevent;
    long mlen, offset = 0;
    int sent_last = 0;

    mlen = strlen(msg);

    /* Send the message(s): */
    while (!sent_last) {
      memset(&xevent, 0, sizeof (xevent));
      
      xevent.xany.type = ClientMessage;
      xevent.xany.display = d;
      xevent.xclient.window = target;
      xevent.xclient.message_type = atag;
      xevent.xclient.format = 8;

      {
       int i = sizeof(Window);
       long w = (long)me;

       while (i--) {
         xevent.xclient.data.b[i] = (char)(w & 0xFF);
         w = w >> 8;
       }
      }

      if (offset < mlen) {
       long amt;
       amt = mlen - offset;
       if (amt > (int)(20 - sizeof(Window)))
         amt = 20 - sizeof(Window);
       memcpy(xevent.xclient.data.b + sizeof(Window), msg + offset, amt);
       offset += amt;
       sent_last = (amt < (int)(20 - sizeof(Window)));
      } else
       sent_last = 1;

      XSendEvent(d, target, 0, 0, &xevent);
    }

    XFlush(d);
    XSync(d, FALSE);

    return 1;
  } else {
    /* Set the property on the clipboard window */
    wxAddClipboardWindowProperty(atag);

    return 0;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void wxSetSensitive ( Widget  w,
Bool  enabled 
)

Definition at line 432 of file mredx.cxx.

{
  if (!disabled_widgets) {
    if (enabled)
      return;

    wxREGGLOB(disabled_widgets);
    disabled_widgets = scheme_make_hash_table(SCHEME_hash_ptr);
#ifdef MZ_PRECISE_GC
    disabled_widgets->make_hash_indices = widget_hash_indices;
#endif
  }

  if (enabled) {
    scheme_hash_set(disabled_widgets, (Scheme_Object *)w, NULL);
  } else {
    scheme_hash_set(disabled_widgets, (Scheme_Object *)w, (Scheme_Object *)0x1);
  }
}

Here is the caller graph for this function:

int wxUTF8StringToChar ( char *  str,
int  slen 
)

Definition at line 765 of file mredx.cxx.

{
  mzchar s[1];
  s[0] = 0;
  scheme_utf8_decode((unsigned char *)str, 0, slen,
                   s, 0, 1,
                   NULL, 0, '?');
  return (int)s[0];
}

Here is the caller graph for this function:


Variable Documentation

KeyCode breaking_code [static]

Definition at line 29 of file mredx.cxx.

int breaking_code_set = 0 [static]

Definition at line 30 of file mredx.cxx.

int checking_for_break = 0 [static]

Definition at line 23 of file mredx.cxx.

int cur_registered = 0 [static]

Definition at line 166 of file mredx.cxx.

Definition at line 412 of file mredx.cxx.

Definition at line 167 of file mredx.cxx.

Widget* grab_stack [static]

Definition at line 32 of file mredx.cxx.

int grab_stack_pos = 0 [static]

Definition at line 33 of file mredx.cxx.

int grab_stack_size = 0 [static]

Definition at line 33 of file mredx.cxx.

Widget grabber [static]

Definition at line 32 of file mredx.cxx.

int just_check = 0 [static]

Definition at line 23 of file mredx.cxx.

Widget just_this_one [static]

Definition at line 24 of file mredx.cxx.

Definition at line 167 of file mredx.cxx.

unsigned long lastUngrabTime [static]

Definition at line 155 of file mredx.cxx.

unsigned long lastUnhideTime [static]

Definition at line 156 of file mredx.cxx.

int need_unhide = 0 [static]

Definition at line 157 of file mredx.cxx.

Widget orig_top_level [static]

Definition at line 26 of file mredx.cxx.

Widget save_top_level = 0 [static]

Definition at line 27 of file mredx.cxx.

int short_circuit = 0 [static]

Definition at line 23 of file mredx.cxx.

Widget wx_clipWindow

Definition at line 32 of file Clipboard.cc.

Widget wx_selWindow

Definition at line 32 of file Clipboard.cc.

Definition at line 78 of file Window.cc.