patches/gtkglext-01-modern.diff
author jurikm
Sun, 12 Feb 2012 14:04:10 +0000
changeset 8245 383896da4129
parent 3225 e07595f86ea5
permissions -rw-r--r--
SFEsauerbraten.spec: add IPS package name
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3224
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
     1
--- a/gtk/gtkglwidget.c
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
     2
+++ b/gtk/gtkglwidget.c
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
     3
@@ -70,6 +70,7 @@ static void
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
     4
 gtk_gl_widget_realize (GtkWidget       *widget,
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
     5
                        GLWidgetPrivate *private)
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
     6
 {
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
     7
+  GdkWindow *window;
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
     8
   GdkGLWindow *glwindow;
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
     9
 
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    10
   GTK_GL_NOTE_FUNC_PRIVATE ();
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    11
@@ -79,9 +80,10 @@ gtk_gl_widget_realize (GtkWidget       *widget,
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    12
    * handlers.
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    13
    */
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    14
 
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    15
-  if (!gdk_window_is_gl_capable (widget->window))
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    16
+  window = gtk_widget_get_window (widget);
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    17
+  if (!gdk_window_is_gl_capable (window))
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    18
     {
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    19
-      glwindow = gdk_window_set_gl_capability (widget->window,
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    20
+      glwindow = gdk_window_set_gl_capability (window,
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    21
                                                private->glconfig,
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    22
                                                NULL);
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    23
       if (glwindow == NULL)
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    24
@@ -129,9 +131,9 @@ gtk_gl_widget_size_allocate (GtkWidget       *widget,
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    25
    * Synchronize OpenGL and window resizing request streams.
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    26
    */
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    27
 
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    28
-  if (GTK_WIDGET_REALIZED (widget) && private->is_realized)
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    29
+  if (gtk_widget_get_realized (widget) && private->is_realized)
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    30
     {
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    31
-      gldrawable = gdk_window_get_gl_drawable (widget->window);
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    32
+      gldrawable = gdk_window_get_gl_drawable (gtk_widget_get_window (widget));
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    33
       gdk_gl_drawable_wait_gdk (gldrawable);
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    34
     }
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    35
 }
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    36
@@ -156,8 +158,8 @@ gtk_gl_widget_unrealize (GtkWidget       *widget,
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    37
    * Remove OpenGL-capability from widget->window.
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    38
    */
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    39
 
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    40
-  if (GTK_WIDGET_REALIZED (widget))
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    41
-    gdk_window_unset_gl_capability (widget->window);
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    42
+  if (gtk_widget_get_realized (widget))
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    43
+    gdk_window_unset_gl_capability (gtk_widget_get_window (widget));
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    44
 
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    45
   private->is_realized = FALSE;
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    46
 }
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    47
@@ -176,7 +178,7 @@ gtk_gl_widget_parent_set (GtkWidget   *widget,
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    48
    */
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    49
 
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    50
   toplevel = gtk_widget_get_toplevel (widget);
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    51
-  if (GTK_WIDGET_TOPLEVEL (toplevel) && !GTK_WIDGET_REALIZED (toplevel))
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    52
+  if (gtk_widget_is_toplevel (toplevel) && !gtk_widget_get_realized (toplevel))
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    53
     {
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    54
       GTK_GL_NOTE (MISC,
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    55
         g_message (" - Install colormap to the top-level window."));
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    56
@@ -190,23 +192,27 @@ gtk_gl_widget_style_set (GtkWidget *widget,
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    57
                          GtkStyle  *previous_style,
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    58
                          gpointer   user_data)
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    59
 {
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    60
+  GdkWindow *window;
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    61
+
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    62
   GTK_GL_NOTE_FUNC_PRIVATE ();
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    63
 
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    64
   /* 
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    65
    * Set a background of "None" on window to avoid AIX X server crash.
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    66
    */
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    67
 
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    68
-  if (GTK_WIDGET_REALIZED (widget))
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    69
+  if (gtk_widget_get_realized (widget))
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    70
     {
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    71
+      window = gtk_widget_get_window (widget);
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    72
+
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    73
       GTK_GL_NOTE (MISC,
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    74
         g_message (" - window->bg_pixmap = %p",
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    75
-                   ((GdkWindowObject *) (widget->window))->bg_pixmap));
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    76
+                   ((GdkWindowObject *) window)->bg_pixmap));
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    77
 
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    78
-      gdk_window_set_back_pixmap (widget->window, NULL, FALSE);
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    79
+      gdk_window_set_back_pixmap (window, NULL, FALSE);
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    80
 
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    81
       GTK_GL_NOTE (MISC,
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    82
         g_message (" - window->bg_pixmap = %p",
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    83
-                   ((GdkWindowObject *) (widget->window))->bg_pixmap));
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    84
+                   ((GdkWindowObject *) window)->bg_pixmap));
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    85
     }
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    86
 }
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    87
 
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    88
@@ -252,8 +258,8 @@ gtk_widget_set_gl_capability (GtkWidget    *widget,
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    89
   GTK_GL_NOTE_FUNC ();
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    90
 
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    91
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    92
-  g_return_val_if_fail (!GTK_WIDGET_NO_WINDOW (widget), FALSE);
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    93
-  g_return_val_if_fail (!GTK_WIDGET_REALIZED (widget), FALSE);
3225
e07595f86ea5 SFEgtkglext.spec: fix packaging and linking error
jurikm
parents: 3224
diff changeset
    94
+  g_return_val_if_fail (gtk_widget_get_has_window (widget), FALSE);
3224
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    95
+  g_return_val_if_fail (!gtk_widget_get_realized (widget), FALSE);
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    96
   g_return_val_if_fail (GDK_IS_GL_CONFIG (glconfig), FALSE);
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    97
 
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    98
   /* 
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
    99
@@ -434,9 +440,9 @@ gtk_widget_create_gl_context (GtkWidget    *widget,
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
   100
   GTK_GL_NOTE_FUNC ();
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
   101
 
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
   102
   g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
   103
-  g_return_val_if_fail (GTK_WIDGET_REALIZED (widget), NULL);
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
   104
+  g_return_val_if_fail (gtk_widget_get_realized (widget), NULL);
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
   105
 
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
   106
-  gldrawable = gdk_window_get_gl_drawable (widget->window);
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
   107
+  gldrawable = gdk_window_get_gl_drawable (gtk_widget_get_window (widget));
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
   108
   if (gldrawable == NULL)
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
   109
     return NULL;
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
   110
 
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
   111
@@ -476,7 +482,7 @@ gtk_widget_get_gl_context (GtkWidget *widget)
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
   112
   GLWidgetPrivate *private;
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
   113
 
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
   114
   g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
   115
-  g_return_val_if_fail (GTK_WIDGET_REALIZED (widget), NULL);
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
   116
+  g_return_val_if_fail (gtk_widget_get_realized (widget), NULL);
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
   117
 
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
   118
   private = g_object_get_qdata (G_OBJECT (widget), quark_gl_private);
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
   119
   if (private == NULL)
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
   120
@@ -503,7 +509,7 @@ GdkGLWindow *
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
   121
 gtk_widget_get_gl_window (GtkWidget *widget)
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
   122
 {
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
   123
   g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
   124
-  g_return_val_if_fail (GTK_WIDGET_REALIZED (widget), NULL);
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
   125
+  g_return_val_if_fail (gtk_widget_get_realized (widget), NULL);
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
   126
 
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
   127
-  return gdk_window_get_gl_window (widget->window);
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
   128
+  return gdk_window_get_gl_window (gtk_widget_get_window (widget));
b3a189c6c1af SFEgtkglext.spec: fix linking error with the latest GTK+
jurikm
parents:
diff changeset
   129
 }