[MPlayer-cvslog] r38492 - in trunk/gui: dialog/dialog.c dialog/fileselect.c dialog/playlist.c gtk-compat.h

ib subversion at mplayerhq.hu
Wed May 1 15:57:47 EEST 2024


Author: ib
Date: Wed May  1 15:57:47 2024
New Revision: 38492

Log:
If available, prefer gtk_widget_get_window() to direct property access.

The GUI should preferably use a more recent GTK+ 2 style.

Modified:
   trunk/gui/dialog/dialog.c
   trunk/gui/dialog/fileselect.c
   trunk/gui/dialog/playlist.c
   trunk/gui/gtk-compat.h

Modified: trunk/gui/dialog/dialog.c
==============================================================================
--- trunk/gui/dialog/dialog.c	Wed May  1 15:55:41 2024	(r38491)
+++ trunk/gui/dialog/dialog.c	Wed May  1 15:57:47 2024	(r38492)
@@ -32,6 +32,7 @@
 #include "skinbrowser.h"
 #include "tools.h"
 #include "url.h"
+#include "gui/gtk-compat.h"
 #include "gui/interface.h"
 #include "gui/app/app.h"
 #include "gui/app/gui.h"
@@ -164,7 +165,7 @@ void gtkInit(char *display_name)
  */
 void gtkAddIcon(GtkWidget *window)
 {
-    wsWindowIcon(XDISPLAY, GDK_WINDOW_XWINDOW(window->window), &guiIcon);
+    wsWindowIcon(XDISPLAY, GDK_WINDOW_XWINDOW(gtk_widget_get_window(window)), &guiIcon);
 }
 
 /**
@@ -242,7 +243,7 @@ void gtkMessageBox(int type, const gchar
  */
 void gtkSetLayer(GtkWidget *window)
 {
-    wsWindowLayer(XDISPLAY, GDK_WINDOW_XWINDOW(window->window), guiApp.videoWindow.isFullScreen);
+    wsWindowLayer(XDISPLAY, GDK_WINDOW_XWINDOW(gtk_widget_get_window(window)), guiApp.videoWindow.isFullScreen);
     gtkRaise(window);
 }
 
@@ -253,7 +254,7 @@ void gtkSetLayer(GtkWidget *window)
  */
 void gtkRaise(GtkWidget *window)
 {
-    wsWindowRaiseTop(XDISPLAY, GDK_WINDOW_XWINDOW(window->window));
+    wsWindowRaiseTop(XDISPLAY, GDK_WINDOW_XWINDOW(gtk_widget_get_window(window)));
 }
 
 static void gtkSelectInCList(GtkWidget *list, char *item)

Modified: trunk/gui/dialog/fileselect.c
==============================================================================
--- trunk/gui/dialog/fileselect.c	Wed May  1 15:55:41 2024	(r38491)
+++ trunk/gui/dialog/fileselect.c	Wed May  1 15:57:47 2024	(r38492)
@@ -257,28 +257,28 @@ static void fs_get_pixmap(const char *ex
     switch (fsType) {
     case FILESELECT_SUBTITLE:
         if (!spixmap)
-            spixmap = gdk_pixmap_colormap_create_from_xpm_d(FileSelector->window, fsColorMap, &smask, &style->bg[GTK_STATE_NORMAL], (gchar **)file_subtitle_xpm);
+            spixmap = gdk_pixmap_colormap_create_from_xpm_d(gtk_widget_get_window(FileSelector), fsColorMap, &smask, &style->bg[GTK_STATE_NORMAL], (gchar **)file_subtitle_xpm);
         *pixmap = spixmap;
         *mask   = smask;
         break;
 
     case FILESELECT_AUDIO_TRACK:
         if (!atpixmap)
-            atpixmap = gdk_pixmap_colormap_create_from_xpm_d(FileSelector->window, fsColorMap, &atmask, &style->bg[GTK_STATE_NORMAL], (gchar **)file_audio_track_xpm);
+            atpixmap = gdk_pixmap_colormap_create_from_xpm_d(gtk_widget_get_window(FileSelector), fsColorMap, &atmask, &style->bg[GTK_STATE_NORMAL], (gchar **)file_audio_track_xpm);
         *pixmap = atpixmap;
         *mask   = atmask;
         break;
 
     case FILESELECT_FONT:
         if (!fpixmap)
-            fpixmap = gdk_pixmap_colormap_create_from_xpm_d(FileSelector->window, fsColorMap, &fmask, &style->bg[GTK_STATE_NORMAL], (gchar **)file_font_xpm);
+            fpixmap = gdk_pixmap_colormap_create_from_xpm_d(gtk_widget_get_window(FileSelector), fsColorMap, &fmask, &style->bg[GTK_STATE_NORMAL], (gchar **)file_font_xpm);
         *pixmap = fpixmap;
         *mask   = fmask;
         break;
 
     case FILESELECT_IMAGE:
         if (!ipixmap)
-            ipixmap = gdk_pixmap_colormap_create_from_xpm_d(FileSelector->window, fsColorMap, &imask, &style->bg[GTK_STATE_NORMAL], (gchar **)file_image_xpm);
+            ipixmap = gdk_pixmap_colormap_create_from_xpm_d(gtk_widget_get_window(FileSelector), fsColorMap, &imask, &style->bg[GTK_STATE_NORMAL], (gchar **)file_image_xpm);
         *pixmap = ipixmap;
         *mask   = imask;
         break;
@@ -291,7 +291,7 @@ static void fs_get_pixmap(const char *ex
             if (strcmp(MSGTR_GUI_FilterVideoAll, fsVideoAudioFilterNames[i][0]) == 0) {
                 if ((p = strstr(fsVideoAudioFilterNames[i][1], ext)) && (p[len] == ',' || p[len] == 0)) {
                     if (!vpixmap)
-                        vpixmap = gdk_pixmap_colormap_create_from_xpm_d(FileSelector->window, fsColorMap, &vmask, &style->bg[GTK_STATE_NORMAL], (gchar **)file_video_xpm);
+                        vpixmap = gdk_pixmap_colormap_create_from_xpm_d(gtk_widget_get_window(FileSelector), fsColorMap, &vmask, &style->bg[GTK_STATE_NORMAL], (gchar **)file_video_xpm);
                     *pixmap = vpixmap;
                     *mask   = vmask;
                     break;
@@ -301,7 +301,7 @@ static void fs_get_pixmap(const char *ex
             if (strcmp(MSGTR_GUI_FilterAudioAll, fsVideoAudioFilterNames[i][0]) == 0) {
                 if ((p = strstr(fsVideoAudioFilterNames[i][1], ext)) && (p[len] == ',' || p[len] == 0)) {
                     if (!apixmap)
-                        apixmap = gdk_pixmap_colormap_create_from_xpm_d(FileSelector->window, fsColorMap, &amask, &style->bg[GTK_STATE_NORMAL], (gchar **)file_audio_xpm);
+                        apixmap = gdk_pixmap_colormap_create_from_xpm_d(gtk_widget_get_window(FileSelector), fsColorMap, &amask, &style->bg[GTK_STATE_NORMAL], (gchar **)file_audio_xpm);
                     *pixmap = apixmap;
                     *mask   = amask;
                     break;
@@ -311,7 +311,7 @@ static void fs_get_pixmap(const char *ex
             if (strcmp(MSGTR_GUI_FilterFilePlaylist, fsVideoAudioFilterNames[i][0]) == 0) {
                 if ((p = strstr(fsVideoAudioFilterNames[i][1], ext)) && (p[len] == ',' || p[len] == 0)) {
                     if (!ppixmap)
-                        ppixmap = gdk_pixmap_colormap_create_from_xpm_d(FileSelector->window, fsColorMap, &pmask, &style->bg[GTK_STATE_NORMAL], (gchar **)file_playlist_xpm);
+                        ppixmap = gdk_pixmap_colormap_create_from_xpm_d(gtk_widget_get_window(FileSelector), fsColorMap, &pmask, &style->bg[GTK_STATE_NORMAL], (gchar **)file_playlist_xpm);
                     *pixmap = ppixmap;
                     *mask   = pmask;
                     break;
@@ -321,7 +321,7 @@ static void fs_get_pixmap(const char *ex
             if (strcmp(MSGTR_GUI_FilterImageCue, fsVideoAudioFilterNames[i][0]) == 0) {
                 if ((p = strstr(fsVideoAudioFilterNames[i][1], ext)) && (p[len] == ',' || p[len] == 0)) {
                     if (!ipixmap)
-                        ipixmap = gdk_pixmap_colormap_create_from_xpm_d(FileSelector->window, fsColorMap, &imask, &style->bg[GTK_STATE_NORMAL], (gchar **)file_image_xpm);
+                        ipixmap = gdk_pixmap_colormap_create_from_xpm_d(gtk_widget_get_window(FileSelector), fsColorMap, &imask, &style->bg[GTK_STATE_NORMAL], (gchar **)file_image_xpm);
                     *pixmap = ipixmap;
                     *mask   = imask;
                     break;
@@ -332,7 +332,7 @@ static void fs_get_pixmap(const char *ex
         for (i = 0; !*pixmap && ext && fsSubtitleFilterNames[i][0]; i++) {
             if ((p = strstr(fsSubtitleFilterNames[i][1], ext)) && (p[len] == ',' || p[len] == 0)) {
                 if (!spixmap)
-                    spixmap = gdk_pixmap_colormap_create_from_xpm_d(FileSelector->window, fsColorMap, &smask, &style->bg[GTK_STATE_NORMAL], (gchar **)file_subtitle_xpm);
+                    spixmap = gdk_pixmap_colormap_create_from_xpm_d(gtk_widget_get_window(FileSelector), fsColorMap, &smask, &style->bg[GTK_STATE_NORMAL], (gchar **)file_subtitle_xpm);
                 *pixmap = spixmap;
                 *mask   = smask;
                 break;
@@ -342,7 +342,7 @@ static void fs_get_pixmap(const char *ex
         for (i = 0; !*pixmap && ext && fsImageFilterNames[i][0]; i++) {
             if ((p = strstr(fsImageFilterNames[i][1], ext)) && (p[len] == ',' || p[len] == 0)) {
                 if (!ipixmap)
-                    ipixmap = gdk_pixmap_colormap_create_from_xpm_d(FileSelector->window, fsColorMap, &imask, &style->bg[GTK_STATE_NORMAL], (gchar **)file_image_xpm);
+                    ipixmap = gdk_pixmap_colormap_create_from_xpm_d(gtk_widget_get_window(FileSelector), fsColorMap, &imask, &style->bg[GTK_STATE_NORMAL], (gchar **)file_image_xpm);
                 *pixmap = ipixmap;
                 *mask   = imask;
                 break;
@@ -351,7 +351,7 @@ static void fs_get_pixmap(const char *ex
 
         if (!*pixmap) {
             if (!avpixmap)
-                avpixmap = gdk_pixmap_colormap_create_from_xpm_d(FileSelector->window, fsColorMap, &avmask, &style->bg[GTK_STATE_NORMAL], (gchar **)file_xpm);
+                avpixmap = gdk_pixmap_colormap_create_from_xpm_d(gtk_widget_get_window(FileSelector), fsColorMap, &avmask, &style->bg[GTK_STATE_NORMAL], (gchar **)file_xpm);
             *pixmap = avpixmap;
             *mask   = avmask;
         }
@@ -772,7 +772,7 @@ static GtkWidget *CreateFileSelect(void)
     gtkAddIcon(FileSelector);
 
     style   = gtk_widget_get_style(FileSelector);
-    dpixmap = gdk_pixmap_colormap_create_from_xpm_d(FileSelector->window, fsColorMap, &dmask, &style->bg[GTK_STATE_NORMAL], (gchar **)dir_xpm);
+    dpixmap = gdk_pixmap_colormap_create_from_xpm_d(gtk_widget_get_window(FileSelector), fsColorMap, &dmask, &style->bg[GTK_STATE_NORMAL], (gchar **)dir_xpm);
 
     vbox4 = gtkAddVBox(gtkAddDialogFrame(FileSelector), 0);
     hbox4 = gtkAddHBox(vbox4, 1);

Modified: trunk/gui/dialog/playlist.c
==============================================================================
--- trunk/gui/dialog/playlist.c	Wed May  1 15:55:41 2024	(r38491)
+++ trunk/gui/dialog/playlist.c	Wed May  1 15:57:47 2024	(r38492)
@@ -488,8 +488,8 @@ static GtkWidget * CreatePlaylist( void
   gtk_clist_column_titles_show( GTK_CLIST( CTDirTree ) );
   gtk_clist_set_shadow_type( GTK_CLIST( CTDirTree ),GTK_SHADOW_NONE );
 
-  if ( !pxOpenedBook ) pxOpenedBook=gdk_pixmap_create_from_xpm_d( Playlist->window,&msOpenedBook,&transparent,(gchar **)dir_xpm );
-  if ( !pxClosedBook ) pxClosedBook=gdk_pixmap_create_from_xpm_d( Playlist->window,&msClosedBook,&transparent,(gchar **)open_xpm );
+  if ( !pxOpenedBook ) pxOpenedBook=gdk_pixmap_create_from_xpm_d( gtk_widget_get_window(Playlist),&msOpenedBook,&transparent,(gchar **)dir_xpm );
+  if ( !pxClosedBook ) pxClosedBook=gdk_pixmap_create_from_xpm_d( gtk_widget_get_window(Playlist),&msClosedBook,&transparent,(gchar **)open_xpm );
 
   parent=gtk_ctree_insert_node( GTK_CTREE( CTDirTree ),NULL,NULL,&root,4,pxOpenedBook,msOpenedBook,pxClosedBook,msClosedBook,FALSE,FALSE );
   DirNode=malloc( sizeof( *DirNode ) );

Modified: trunk/gui/gtk-compat.h
==============================================================================
--- trunk/gui/gtk-compat.h	Wed May  1 15:55:41 2024	(r38491)
+++ trunk/gui/gtk-compat.h	Wed May  1 15:57:47 2024	(r38492)
@@ -30,6 +30,10 @@
 #define gtk_button_set_image(button, image) gtk_button_set_label(button, MSGTR_GUI_ ## image)
 #endif
 
+#if !GTK_CHECK_VERSION(2,14,0)
+#define gtk_widget_get_window(widget) widget->window
+#endif
+
 #if !GTK_CHECK_VERSION(2,22,0)
 #define GDK_KEY_BackSpace GDK_BackSpace
 #define GDK_KEY_Escape GDK_Escape


More information about the MPlayer-cvslog mailing list