Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions | Variables
nsAppShell.cpp File Reference
#include <stdlib.h>
#include <sys/time.h>
#include <unistd.h>
#include <ctype.h>
#include <errno.h>
#include <X11/keysym.h>
#include <X11/keysymdef.h>
#include <X11/Xlocale.h>
#include "nsWindow.h"
#include "nsWidget.h"
#include "nsAppShell.h"
#include "nsKeyCode.h"
#include "nsWidgetsCID.h"
#include "nsIWidget.h"
#include "nsIEventQueueService.h"
#include "nsIServiceManager.h"
#include "nsIDragService.h"
#include "nsIDragSessionXlib.h"
#include "nsITimer.h"
#include "xlibrgb.h"

Go to the source code of this file.

Defines

#define CHAR_BUF_SIZE   80
#define COMPARE_FLAG1(a, b)   ((b)[0]=='-' && !strcmp((a), &(b)[1]))
#define COMPARE_FLAG2(a, b)   ((b)[0]=='-' && (b)[1]=='-' && !strcmp((a), &(b)[2]))
#define COMPARE_FLAG12(a, b)   ((b)[0]=='-' && !strcmp((a), (b)[1]=='-'?&(b)[2]:&(b)[1]))
#define ALL_EVENTS
#define NUMBER_HASH_KEY(_num)   ((PLHashNumber) _num)
#define NEVER_BE_ZERO_MAGIC   (54321)

Functions

static NS_DEFINE_CID (kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID)
static NS_DEFINE_IID (kCDragServiceCID, NS_DRAGSERVICE_CID)
static PR_BEGIN_EXTERN_C int xerror_handler (Display *display, XErrorEvent *ev)
static PR_BEGIN_EXTERN_C void HandleQueueXtProc (XtPointer ptr, int *source_fd, XtInputId *id)
static PLHashNumber IntHashKey (PRInt32 key)
static PR_BEGIN_EXTERN_C
unsigned long 
getNextRequest (void *aClosure)
PRUint32 nsConvertCharCodeToUnicode (XKeyEvent *xkey)
static int is_wm_ungrab_enter (XCrossingEvent *event)
static int is_wm_grab_leave (XCrossingEvent *event)

Variables

static PLHashTablesQueueHashTable = nsnull
static PLHashTablesCountHashTable = nsnull
static nsVoidArraysEventQueueList = nsnull
static const char * event_names []

Define Documentation

Value:
( KeyPressMask | KeyReleaseMask | ButtonPressMask | \
                     ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | \
                     PointerMotionMask | PointerMotionHintMask | Button1MotionMask | \
                     Button2MotionMask | Button3MotionMask | \
                     Button4MotionMask | Button5MotionMask | ButtonMotionMask | \
                     KeymapStateMask | ExposureMask | VisibilityChangeMask | \
                     StructureNotifyMask | ResizeRedirectMask | \
                     SubstructureNotifyMask | SubstructureRedirectMask | \
                     FocusChangeMask | PropertyChangeMask | \
                     ColormapChangeMask | OwnerGrabButtonMask )

Definition at line 136 of file nsAppShell.cpp.

Definition at line 67 of file nsAppShell.cpp.

#define COMPARE_FLAG1 (   a,
  b 
)    ((b)[0]=='-' && !strcmp((a), &(b)[1]))

Definition at line 132 of file nsAppShell.cpp.

#define COMPARE_FLAG12 (   a,
  b 
)    ((b)[0]=='-' && !strcmp((a), (b)[1]=='-'?&(b)[2]:&(b)[1]))

Definition at line 134 of file nsAppShell.cpp.

#define COMPARE_FLAG2 (   a,
  b 
)    ((b)[0]=='-' && (b)[1]=='-' && !strcmp((a), &(b)[2]))

Definition at line 133 of file nsAppShell.cpp.

#define NEVER_BE_ZERO_MAGIC   (54321)
#define NUMBER_HASH_KEY (   _num)    ((PLHashNumber) _num)

Definition at line 365 of file nsAppShell.cpp.


Function Documentation

static PR_BEGIN_EXTERN_C unsigned long getNextRequest ( void aClosure) [static]

Definition at line 374 of file nsAppShell.cpp.

                                                     {
  return XNextRequest(nsAppShell::mDisplay);
}
static PR_BEGIN_EXTERN_C void HandleQueueXtProc ( XtPointer  ptr,
int source_fd,
XtInputId *  id 
) [static]

Definition at line 316 of file nsAppShell.cpp.

{
  nsIEventQueue *queue = (nsIEventQueue *)ptr;
  queue->ProcessPendingEvents();
}
static PLHashNumber IntHashKey ( PRInt32  key) [static]

Definition at line 368 of file nsAppShell.cpp.

{
  return NUMBER_HASH_KEY(key);
}
static int is_wm_grab_leave ( XCrossingEvent *  event) [inline, static]

Definition at line 1003 of file nsAppShell.cpp.

{
  return (NotifyGrab == event->mode) &&
    ((NotifyAncestor == event->detail) ||
     (NotifyVirtual == event->detail));
}

Here is the caller graph for this function:

static int is_wm_ungrab_enter ( XCrossingEvent *  event) [inline, static]

Definition at line 995 of file nsAppShell.cpp.

{
  return (NotifyGrab == event->mode) &&
    ((NotifyAncestor == event->detail) ||
     (NotifyVirtual == event->detail));
}

Here is the caller graph for this function:

static NS_DEFINE_IID ( kCDragServiceCID  ,
NS_DRAGSERVICE_CID   
) [static]
PRUint32 nsConvertCharCodeToUnicode ( XKeyEvent *  xkey)

Definition at line 792 of file nsAppShell.cpp.

{
  // The only Unicode specific at the moment is casting to PRUint32.

  // For control characters convert from the event ascii code (e.g. 1 for
  // control-a) to the ascii code for the key, e.g., 'a' for
  // control-a.

  KeySym         keysym;
  XComposeStatus compose;
  unsigned char  string_buf[CHAR_BUF_SIZE];
  int            len = 0;

  len = XLookupString(xkey, (char *)string_buf, CHAR_BUF_SIZE-1, &keysym, &compose);
  if (0 == len)
    return 0;

  if (xkey->state & ControlMask) {
    if (xkey->state & ShiftMask) {
      return (PRUint32)(string_buf[0] + 'A' - 1);
    }
    else {
      return (PRUint32)(string_buf[0] + 'a' - 1);
    }
  }
  if (!isprint(string_buf[0])) {
    return 0;
  }
  else {
    return (PRUint32)(string_buf[0]);
  }
}

Here is the call graph for this function:

static PR_BEGIN_EXTERN_C int xerror_handler ( Display display,
XErrorEvent *  ev 
) [static]

Definition at line 159 of file nsAppShell.cpp.

{
  /* this should _never_ be happen... but if this happens - debug mode or not - scream !!! */
  char errmsg[80];
  XGetErrorText(display, ev->error_code, errmsg, sizeof(errmsg));
  fprintf(stderr, "nsAppShellXlib: Warning (X Error) -  %s\n", errmsg);
  abort(); // die !!
  
  return 0;
}

Here is the call graph for this function:


Variable Documentation

const char* event_names[] [static]

Definition at line 93 of file nsAppShell.cpp.

Definition at line 88 of file nsAppShell.cpp.

Definition at line 89 of file nsAppShell.cpp.

Definition at line 87 of file nsAppShell.cpp.