Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions | Variables
nsWindow.cpp File Reference
#include <stdio.h>
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
#include <gtk/gtkprivate.h>
#include <gdk/gdkprivate.h>
#include <X11/Xatom.h>
#include "nsWindow.h"
#include "nsWidgetsCID.h"
#include "nsIFontMetrics.h"
#include "nsFont.h"
#include "nsGUIEvent.h"
#include "nsIRenderingContext.h"
#include "nsIDOMNode.h"
#include "nsRect.h"
#include "nsTransform2D.h"
#include "nsGfxCIID.h"
#include "nsGtkEventHandler.h"
#include "nsIAppShell.h"
#include "nsClipboard.h"
#include "nsIRollupListener.h"
#include "nsIPref.h"
#include "nsICharsetConverterManager.h"
#include "nsIPlatformCharset.h"
#include "nsIServiceManager.h"
#include "nsIIOService.h"
#include "nsIProtocolHandler.h"
#include "nsIURI.h"
#include "nsNetUtil.h"
#include "nsIResProtocolHandler.h"
#include "nsIFileURL.h"
#include "nsGtkUtils.h"
#include "nsIDragService.h"
#include "nsIDragSessionGTK.h"
#include "nsGtkIMEHelper.h"
#include "nsKeyboardUtils.h"
#include "nsGtkCursors.h"
#include "nspr.h"
#include <unistd.h>

Go to the source code of this file.

Classes

struct  IconEntry

Defines

#define MODAL_TIMERS_BROKEN
#define NS_TO_GDK_RGB(ns)   (ns & 0xff) << 16 | (ns & 0xff00) | ((ns >> 16) & 0xff)
#define CAPS_LOCK_IS_ON   (nsGtkUtils::gdk_keyboard_get_modifiers() & GDK_LOCK_MASK)
#define WANT_PAINT_FLASHING   (debug_WantPaintFlashing() && CAPS_LOCK_IS_ON)
#define kWindowPositionSlop   20
#define NS_WINDOW_TITLE_MAX_LENGTH   4095
#define UTF8_FOLLOWBYTE(ch)   (((ch) & 0xC0) == 0x80)
#define _NET_WM_STATE_REMOVE   0 /* remove/unset property */
#define _NET_WM_STATE_ADD   1 /* add/set property */
#define _NET_WM_STATE_TOGGLE   2 /* toggle property */

Functions

static NS_DEFINE_IID (kCDragServiceCID, NS_DRAGSERVICE_CID)
gint handle_mozarea_focus_in (GtkWidget *aWidget, GdkEventFocus *aGdkFocusEvent, gpointer aData)
gint handle_mozarea_focus_out (GtkWidget *aWidget, GdkEventFocus *aGdkFocusEvent, gpointer aData)
void handle_toplevel_configure (GtkMozArea *aArea, nsWindow *aWindow)
static int is_parent_ungrab_enter (GdkEventCrossing *aEvent)
static int is_parent_grab_leave (GdkEventCrossing *aEvent)
static PRBool ButtonEventInsideWindow (GdkWindow *window, GdkEventButton *aGdkButtonEvent)
void handle_invalidate_pos (GtkMozArea *aArea, gpointer p)
static NS_DEFINE_CID (kRegionCID, NS_REGION_CID)
gint handle_delete_event (GtkWidget *w, GdkEventAny *e, nsWindow *win)
static void gdk_wmspec_change_state (gboolean add, GdkWindow *window, GdkAtom state1, GdkAtom state2)

Variables

static PRBool gGlobalsInitialized = PR_FALSE
static PRBool gRaiseWindows = PR_TRUE
static PLDHashTableOps iconHashOps
PRBool gJustGotDeactivate = PR_FALSE
PRBool gJustGotActivate = PR_FALSE
static GSList * update_queue = NULL
static guint update_idle = 0

Define Documentation

#define _NET_WM_STATE_ADD   1 /* add/set property */
#define _NET_WM_STATE_REMOVE   0 /* remove/unset property */
#define _NET_WM_STATE_TOGGLE   2 /* toggle property */

Definition at line 111 of file nsWindow.cpp.

Definition at line 117 of file nsWindow.cpp.

Definition at line 107 of file nsWindow.cpp.

#define NS_TO_GDK_RGB (   ns)    (ns & 0xff) << 16 | (ns & 0xff00) | ((ns >> 16) & 0xff)

Definition at line 109 of file nsWindow.cpp.

Definition at line 178 of file nsWindow.cpp.

#define UTF8_FOLLOWBYTE (   ch)    (((ch) & 0xC0) == 0x80)
#define WANT_PAINT_FLASHING   (debug_WantPaintFlashing() && CAPS_LOCK_IS_ON)

Definition at line 114 of file nsWindow.cpp.


Function Documentation

static PRBool ButtonEventInsideWindow ( GdkWindow *  window,
GdkEventButton *  aGdkButtonEvent 
) [static]

Definition at line 227 of file nsWindow.cpp.

{
  gint x, y;
  gint width, height;
  gdk_window_get_position(window, &x, &y);
  gdk_window_get_size(window, &width, &height);

  // This event is measured from the origin of the window itself, not
  // from the origin of the screen.
  if (aGdkButtonEvent->x >= x && aGdkButtonEvent->y >= y &&
      aGdkButtonEvent->x <= width + x && aGdkButtonEvent->y <= height + y)
    return TRUE;

  return FALSE;
}

Here is the caller graph for this function:

static void gdk_wmspec_change_state ( gboolean  add,
GdkWindow *  window,
GdkAtom  state1,
GdkAtom  state2 
) [static]

Definition at line 4178 of file nsWindow.cpp.

{
  XEvent xev;

#define _NET_WM_STATE_REMOVE        0    /* remove/unset property */
#define _NET_WM_STATE_ADD           1    /* add/set property */
#define _NET_WM_STATE_TOGGLE        2    /* toggle property  */

  xev.xclient.type = ClientMessage;
  xev.xclient.serial = 0;
  xev.xclient.send_event = True;
  xev.xclient.window = GDK_WINDOW_XWINDOW(window);
  xev.xclient.message_type = gdk_atom_intern("_NET_WM_STATE", FALSE);
  xev.xclient.format = 32;
  xev.xclient.data.l[0] = add ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE;
  xev.xclient.data.l[1] = state1;
  xev.xclient.data.l[2] = state2;

  XSendEvent(gdk_display, GDK_ROOT_WINDOW(), False,
             SubstructureRedirectMask | SubstructureNotifyMask, &xev);
}
gint handle_delete_event ( GtkWidget *  w,
GdkEventAny *  e,
nsWindow win 
)

Definition at line 1809 of file nsWindow.cpp.

{

  PRBool isEnabled;
  // If this window is disabled, don't dispatch the delete event
  win->IsEnabled(&isEnabled);
  if (!isEnabled)
    return TRUE;

  NS_ADDREF(win);

  // dispatch an "onclose" event. to delete immediately, call win->Destroy()
  nsGUIEvent event(PR_TRUE, NS_XUL_CLOSE, win);
  nsEventStatus status;
  
  win->DispatchEvent(&event, status);

  NS_RELEASE(win);
  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void handle_invalidate_pos ( GtkMozArea *  aArea,
gpointer  p 
)

Definition at line 471 of file nsWindow.cpp.

{
  nsWindow *widget = (nsWindow *)p;
  widget->InvalidateWindowPos();
}

Here is the call graph for this function:

Here is the caller graph for this function:

gint handle_mozarea_focus_in ( GtkWidget *  aWidget,
GdkEventFocus *  aGdkFocusEvent,
gpointer  aData 
)

Definition at line 2858 of file nsWindow.cpp.

{
  if (!aWidget)
    return FALSE;

  if (!aGdkFocusEvent)
    return FALSE;

  nsWindow *widget = (nsWindow *)aData;

  if (!widget)
    return FALSE;

#ifdef DEBUG_FOCUS
  printf("handle_mozarea_focus_in\n");
#endif

#ifdef DEBUG_FOCUS
  printf("aWidget is %p\n", NS_STATIC_CAST(void *, aWidget));
#endif

  // set the flag since got a focus in event
  GTK_WIDGET_SET_FLAGS(aWidget, GTK_HAS_FOCUS);

  widget->HandleMozAreaFocusIn();

  return FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

gint handle_mozarea_focus_out ( GtkWidget *  aWidget,
GdkEventFocus *  aGdkFocusEvent,
gpointer  aData 
)

Definition at line 2889 of file nsWindow.cpp.

{
#ifdef DEBUG_FOCUS
  printf("handle_mozarea_focus_out\n");
#endif

  if (!aWidget) {
    return FALSE;
  }
  
  if (!aGdkFocusEvent) {
    return FALSE;
  }

  nsWindow *widget = (nsWindow *) aData;

  if (!widget) {
    return FALSE;
  }

  // make sure that we unset our focus flag
  GTK_WIDGET_UNSET_FLAGS(aWidget, GTK_HAS_FOCUS);

  widget->HandleMozAreaFocusOut();

  return FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void handle_toplevel_configure ( GtkMozArea *  aArea,
nsWindow aWindow 
)

Definition at line 2919 of file nsWindow.cpp.

{
  // This event handler is only installed on toplevel windows

  // Find out if the window position has changed
  nsRect oldBounds;
  aWindow->GetBounds(oldBounds);

  // this is really supposed to be get_origin, not get_root_origin
  // - bryner
  nscoord x,y;
  gdk_window_get_origin(GTK_WIDGET(aArea)->window, &x, &y);

  if ((oldBounds.x == x) && (oldBounds.y == y)) {
    return;
  }

  aWindow->OnMove(x, y);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int is_parent_grab_leave ( GdkEventCrossing *  aEvent) [static]

Definition at line 4461 of file nsWindow.cpp.

{
  return (GDK_CROSSING_GRAB == event->mode) &&
    ((GDK_NOTIFY_ANCESTOR == event->detail) ||
     (GDK_NOTIFY_VIRTUAL == event->detail));
}

Here is the caller graph for this function:

int is_parent_ungrab_enter ( GdkEventCrossing *  aEvent) [static]

Definition at line 4452 of file nsWindow.cpp.

{
  return (GDK_CROSSING_UNGRAB == event->mode) &&
    ((GDK_NOTIFY_ANCESTOR == event->detail) ||
     (GDK_NOTIFY_VIRTUAL == event->detail));
}

Here is the caller graph for this function:

static NS_DEFINE_CID ( kRegionCID  ,
NS_REGION_CID   
) [static]
static NS_DEFINE_IID ( kCDragServiceCID  ,
NS_DRAGSERVICE_CID   
) [static]

Variable Documentation

Definition at line 121 of file nsWindow.cpp.

Definition at line 176 of file nsWindow.cpp.

Definition at line 175 of file nsWindow.cpp.

Definition at line 122 of file nsWindow.cpp.

guint update_idle = 0 [static]

Definition at line 803 of file nsWindow.cpp.

GSList* update_queue = NULL [static]

Definition at line 802 of file nsWindow.cpp.