]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/dcscreen.cpp
removed 2nd frame from html test sample; test sample now shows DL,DT,DD support
[wxWidgets.git] / src / gtk1 / dcscreen.cpp
index 4bab18b3795c48549117ccc45ee8ed865fa1c31e..33766926fd95d59cd927f0271f865bcaa9fc74b6 100644 (file)
@@ -4,7 +4,7 @@
 // Author:      Robert Roebling
 // Id:          $Id$
 // Copyright:   (c) 1998 Robert Roebling
 // Author:      Robert Roebling
 // Id:          $Id$
 // Copyright:   (c) 1998 Robert Roebling
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
 #include "wx/dcscreen.h"
 #include "wx/window.h"
 
 #include "wx/dcscreen.h"
 #include "wx/window.h"
 
+#include <gdk/gdk.h>
+#include <gtk/gtk.h>
+
 //-----------------------------------------------------------------------------
 // global data initialization
 //-----------------------------------------------------------------------------
 
 GdkWindow *wxScreenDC::sm_overlayWindow  = (GdkWindow*) NULL;
 //-----------------------------------------------------------------------------
 // global data initialization
 //-----------------------------------------------------------------------------
 
 GdkWindow *wxScreenDC::sm_overlayWindow  = (GdkWindow*) NULL;
-       int wxScreenDC::sm_overlayWindowX = 0;
-       int wxScreenDC::sm_overlayWindowY = 0;
+int wxScreenDC::sm_overlayWindowX = 0;
+int wxScreenDC::sm_overlayWindowY = 0;
 
 
-                            
 //-----------------------------------------------------------------------------
 // create X window
 //-----------------------------------------------------------------------------
 
 extern "C" {
 
 //-----------------------------------------------------------------------------
 // create X window
 //-----------------------------------------------------------------------------
 
 extern "C" {
 
-#include "gdk/gdk.h"
-#include "gdk/gdkprivate.h"
-#include "gdk/gdkx.h"
+#include <gdk/gdkprivate.h>
+#include <gdk/gdkx.h>
 #include <netinet/in.h>
 
 int my_nevent_masks = 17;
 #include <netinet/in.h>
 
 int my_nevent_masks = 17;
@@ -54,14 +55,14 @@ int my_event_masks_table[19] =
   StructureNotifyMask,
   PropertyChangeMask,
   VisibilityChangeMask,
   StructureNotifyMask,
   PropertyChangeMask,
   VisibilityChangeMask,
-  0,                           /* PROXIMITY_IN */
-  0                            /* PROXIMTY_OUT */
+  0,                                /* PROXIMITY_IN */
+  0                                /* PROXIMTY_OUT */
 };
 
 GdkWindow*
 gdk_window_transparent_new ( GdkWindow     *parent,
 };
 
 GdkWindow*
 gdk_window_transparent_new ( GdkWindow     *parent,
-                            GdkWindowAttr *attributes,
-                            gint           attributes_mask)
+                             GdkWindowAttr *attributes,
+                             gint           attributes_mask)
 {
   GdkWindow *window;
   GdkWindowPrivate *gprivate;
 {
   GdkWindow *window;
   GdkWindowPrivate *gprivate;
@@ -122,8 +123,8 @@ gdk_window_transparent_new ( GdkWindow     *parent,
   gprivate->height = (attributes->height > 1) ? (attributes->height) : (1);
   gprivate->window_type = attributes->window_type;
   gprivate->extension_events = FALSE;
   gprivate->height = (attributes->height > 1) ? (attributes->height) : (1);
   gprivate->window_type = attributes->window_type;
   gprivate->extension_events = FALSE;
-  
-#ifndef NEW_GTK_DND_CODE
+
+#if (GTK_MINOR_VERSION == 0)
   gprivate->dnd_drag_data_type = None;
   gprivate->dnd_drag_data_typesavail =
     gprivate->dnd_drop_data_typesavail = NULL;
   gprivate->dnd_drag_data_type = None;
   gprivate->dnd_drag_data_typesavail =
     gprivate->dnd_drop_data_typesavail = NULL;
@@ -149,16 +150,16 @@ gdk_window_transparent_new ( GdkWindow     *parent,
   for (i = 0; i < my_nevent_masks; i++)
     {
       if (attributes->event_mask & (1 << (i + 1)))
   for (i = 0; i < my_nevent_masks; i++)
     {
       if (attributes->event_mask & (1 << (i + 1)))
-       xattributes.event_mask |= my_event_masks_table[i];
+        xattributes.event_mask |= my_event_masks_table[i];
     }
 
   if (xattributes.event_mask)
     xattributes_mask |= CWEventMask;
 
   if(attributes_mask & GDK_WA_NOREDIR) {
     }
 
   if (xattributes.event_mask)
     xattributes_mask |= CWEventMask;
 
   if(attributes_mask & GDK_WA_NOREDIR) {
-       xattributes.override_redirect =
-               (attributes->override_redirect == FALSE)?False:True;
-       xattributes_mask |= CWOverrideRedirect;
+        xattributes.override_redirect =
+                (attributes->override_redirect == FALSE)?False:True;
+        xattributes_mask |= CWOverrideRedirect;
   } else
     xattributes.override_redirect = False;
 
   } else
     xattributes.override_redirect = False;
 
@@ -166,24 +167,24 @@ gdk_window_transparent_new ( GdkWindow     *parent,
       depth = visual->depth;
 
       if (attributes_mask & GDK_WA_COLORMAP)
       depth = visual->depth;
 
       if (attributes_mask & GDK_WA_COLORMAP)
-       gprivate->colormap = attributes->colormap;
+        gprivate->colormap = attributes->colormap;
       else
       else
-       gprivate->colormap = gdk_colormap_get_system ();
+        gprivate->colormap = gdk_colormap_get_system ();
 
 
-         xattributes.colormap = ((GdkColormapPrivate*) gprivate->colormap)->xcolormap;
-         xattributes_mask |= CWColormap;
+          xattributes.colormap = ((GdkColormapPrivate*) gprivate->colormap)->xcolormap;
+          xattributes_mask |= CWColormap;
 
 
-         xparent = gdk_root_window;
+          xparent = gdk_root_window;
 
 
-         xattributes.save_under = True;
-         xattributes.override_redirect = True;
-         xattributes.cursor = None;
-         xattributes_mask |= CWSaveUnder | CWOverrideRedirect;
+          xattributes.save_under = True;
+          xattributes.override_redirect = True;
+          xattributes.cursor = None;
+          xattributes_mask |= CWSaveUnder | CWOverrideRedirect;
 
   gprivate->xwindow = XCreateWindow (gprivate->xdisplay, xparent,
 
   gprivate->xwindow = XCreateWindow (gprivate->xdisplay, xparent,
-                                   x, y, gprivate->width, gprivate->height,
-                                   0, depth, gclass, xvisual,
-                                   xattributes_mask, &xattributes);
+                                    x, y, gprivate->width, gprivate->height,
+                                    0, depth, gclass, xvisual,
+                                    xattributes_mask, &xattributes);
   gdk_window_ref (window);
   gdk_xid_table_insert (&gprivate->xwindow, window);
 
   gdk_window_ref (window);
   gdk_xid_table_insert (&gprivate->xwindow, window);
 
@@ -212,7 +213,7 @@ gdk_window_transparent_new ( GdkWindow     *parent,
   if (attributes_mask & GDK_WA_TITLE)
     title = attributes->title;
   else
   if (attributes_mask & GDK_WA_TITLE)
     title = attributes->title;
   else
-#if (GTK_MINOR_VERSION == 1)
+#if (GTK_MINOR_VERSION > 0)
     title = "Unknown"; // GLH: Well I don't know for the moment what to write here.
 #else
     title = gdk_progname;
     title = "Unknown"; // GLH: Well I don't know for the moment what to write here.
 #else
     title = gdk_progname;
@@ -243,53 +244,55 @@ gdk_window_transparent_new ( GdkWindow     *parent,
 
 IMPLEMENT_DYNAMIC_CLASS(wxScreenDC,wxPaintDC)
 
 
 IMPLEMENT_DYNAMIC_CLASS(wxScreenDC,wxPaintDC)
 
-wxScreenDC::wxScreenDC(void)
+wxScreenDC::wxScreenDC()
 {
 {
-  m_ok = FALSE;
-  m_window = (GdkWindow *) NULL;
-  m_cmap = gdk_colormap_get_system();
-  
-  if (sm_overlayWindow)
-  {
-    m_window = sm_overlayWindow;
-    m_deviceOriginX = - sm_overlayWindowX;
-    m_deviceOriginY = - sm_overlayWindowY;
-  }
-  else
-    m_window = GDK_ROOT_PARENT();
-  
-  SetUpDC();
-  
-  gdk_gc_set_subwindow( m_penGC, GDK_INCLUDE_INFERIORS );
-  gdk_gc_set_subwindow( m_brushGC, GDK_INCLUDE_INFERIORS );
-  gdk_gc_set_subwindow( m_textGC, GDK_INCLUDE_INFERIORS );
-  gdk_gc_set_subwindow( m_bgGC, GDK_INCLUDE_INFERIORS );
+    m_ok = FALSE;
+    m_window = (GdkWindow *) NULL;
+    m_cmap = gdk_colormap_get_system();
+
+    if (sm_overlayWindow)
+    {
+        m_window = sm_overlayWindow;
+        m_deviceOriginX = - sm_overlayWindowX;
+        m_deviceOriginY = - sm_overlayWindowY;
+    }
+    else
+    {
+       m_window = GDK_ROOT_PARENT();
+    }
+
+    SetUpDC();
+
+    gdk_gc_set_subwindow( m_penGC, GDK_INCLUDE_INFERIORS );
+    gdk_gc_set_subwindow( m_brushGC, GDK_INCLUDE_INFERIORS );
+    gdk_gc_set_subwindow( m_textGC, GDK_INCLUDE_INFERIORS );
+    gdk_gc_set_subwindow( m_bgGC, GDK_INCLUDE_INFERIORS );
 }
 
 }
 
-wxScreenDC::~wxScreenDC(void)
+wxScreenDC::~wxScreenDC()
 {
 {
-  EndDrawingOnTop();
+    EndDrawingOnTop();
 }
 
 bool wxScreenDC::StartDrawingOnTop( wxWindow *window )
 {
 }
 
 bool wxScreenDC::StartDrawingOnTop( wxWindow *window )
 {
-  if (!window) return StartDrawingOnTop();
-  
-  int x = 0;
-  int y = 0;
-  window->GetPosition( &x, &y );
-  int w = 0;
-  int h = 0;
-  window->GetSize( &w, &h );
-  window->ClientToScreen( &x, &y );
-  
-  wxRect rect;
-  rect.x = x;
-  rect.y = y;
-  rect.width = 0;
-  rect.height = 0;
-  
-  return StartDrawingOnTop( &rect );
+    if (!window) return StartDrawingOnTop();
+
+    int x = 0;
+    int y = 0;
+    window->GetPosition( &x, &y );
+    int w = 0;
+    int h = 0;
+    window->GetSize( &w, &h );
+    window->ClientToScreen( &x, &y );
+
+    wxRect rect;
+    rect.x = x;
+    rect.y = y;
+    rect.width = 0;
+    rect.height = 0;
+
+    return StartDrawingOnTop( &rect );
 }
 
 bool wxScreenDC::StartDrawingOnTop( wxRect *rect )
 }
 
 bool wxScreenDC::StartDrawingOnTop( wxRect *rect )
@@ -305,7 +308,7 @@ bool wxScreenDC::StartDrawingOnTop( wxRect *rect )
     width = rect->width;
     height = rect->height;
   }
     width = rect->width;
     height = rect->height;
   }
-  
+
   sm_overlayWindowX = x;
   sm_overlayWindowY = y;
 
   sm_overlayWindowX = x;
   sm_overlayWindowY = y;
 
@@ -318,23 +321,23 @@ bool wxScreenDC::StartDrawingOnTop( wxRect *rect )
   attr.wclass = GDK_INPUT_OUTPUT;
   attr.event_mask = 0;
   attr.window_type = GDK_WINDOW_TEMP;
   attr.wclass = GDK_INPUT_OUTPUT;
   attr.event_mask = 0;
   attr.window_type = GDK_WINDOW_TEMP;
-  
+
   // GTK cannot set transparent backgrounds. :-(
   sm_overlayWindow = gdk_window_transparent_new( NULL, &attr, GDK_WA_NOREDIR | GDK_WA_X | GDK_WA_Y );
   // GTK cannot set transparent backgrounds. :-(
   sm_overlayWindow = gdk_window_transparent_new( NULL, &attr, GDK_WA_NOREDIR | GDK_WA_X | GDK_WA_Y );
-  
+
   if (sm_overlayWindow) gdk_window_show( sm_overlayWindow );
 
   if (sm_overlayWindow) gdk_window_show( sm_overlayWindow );
 
-  return (sm_overlayWindow);
+  return (sm_overlayWindow != NULL);
 }
 
 }
 
-bool wxScreenDC::EndDrawingOnTop(void)
+bool wxScreenDC::EndDrawingOnTop()
 {
 {
-  if (sm_overlayWindow) gdk_window_destroy( sm_overlayWindow );
-  
-  sm_overlayWindow = NULL;
-  sm_overlayWindowX = 0;
-  sm_overlayWindowY = 0;
-  
-  return TRUE;
+    if (sm_overlayWindow) gdk_window_destroy( sm_overlayWindow );
+
+    sm_overlayWindow = NULL;
+    sm_overlayWindowX = 0;
+    sm_overlayWindowY = 0;
+
+    return TRUE;
 }
 
 }