Workaround compiler warnings and gtk+ deprecations
authorAlexander Koenig <alex@lisas.de>
Sat, 29 Feb 2020 14:10:51 +0000 (15:10 +0100)
committerAlexander Koenig <alex@lisas.de>
Sat, 29 Feb 2020 14:10:51 +0000 (15:10 +0100)
We probably depend on 3.22 now.

src/main.cc
src/tX_dialog.cc
src/tX_flash.c
src/tX_loaddlg.cc
src/tX_mastergui.cc
src/tX_mouse.cc
src/tX_panel.cc
src/tX_seqpar.cc
src/tX_vttgui.cc
src/tX_widget.c

index f4f3c9b7aefa804c6ca4d9755843d54b3e39d821..61421ad3603e835beacff038b42c5f9a5a52801d 100644 (file)
@@ -255,7 +255,7 @@ int main(int argc, char **argv)
        if (globals.show_nag) {
                while (!timesup) {
                        while (gtk_events_pending()) { gtk_main_iteration(); }
-                       gdk_flush();                            
+                       gdk_display_flush(gdk_display_get_default());
                        usleep(250);
                }
                destroy_about();
@@ -268,7 +268,7 @@ int main(int argc, char **argv)
        
        if (globals.startup_set) {
                while (gtk_events_pending()) { gtk_main_iteration(); }
-               gdk_flush();    
+               gdk_display_flush(gdk_display_get_default());
                tX_cursor::set_cursor(tX_cursor::WAIT_CURSOR);
                load_tt_part(globals.startup_set);
                tX_cursor::reset_cursor();
@@ -327,8 +327,8 @@ int main(int argc, char **argv)
        fprintf(stderr, "Have a nice life.\n");
 #else // CREATE_BENCHMARK
        gtk_widget_hide(main_window);
-       while (gtk_events_pending()) gtk_main_iteration(); gdk_flush(); 
-       gdk_flush();
+       while (gtk_events_pending()) gtk_main_iteration(); gdk_display_flush(gdk_display_get_default());
+       gdk_display_flush(gdk_display_get_default());
        
        vtt_class::set_sample_rate(48000);
        
index 948faf7ffd102a021b484c10746d3a3483edb220..fe4e00f471ba5952c9f1fb6e88e3fd2d35c2a3e3 100644 (file)
@@ -260,19 +260,19 @@ void append_oss_device_list(GtkComboBoxText *combo, char *current) {
     struct dirent **namelist;
     int n,i;
     n = scandir("/dev", &namelist, oss_select_dsp_only, alphasort);
-    
+
     if (n>0) {
-       for (i=0; i<n; i++) {
-                       char buffer[256];
-            sprintf(buffer, "/dev/%s", namelist[i]->d_name);
-            free(namelist[i]);
-            gtk_combo_box_text_append_text(combo, strdup(buffer));
-            
-            if (strcmp(buffer, current)==0) {
-                               gtk_combo_box_set_active(GTK_COMBO_BOX(combo), i);
-                       }
-               }
+    for (i=0; i<n; i++) {
+       char buffer[PATH_MAX];
+       snprintf(buffer, sizeof(buffer), "/dev/%s", namelist[i]->d_name);
+       free(namelist[i]);
+
+       gtk_combo_box_text_append_text(combo, strdup(buffer));
+       if (strcmp(buffer, current)==0) {
+           gtk_combo_box_set_active(GTK_COMBO_BOX(combo), i);
+       }
        }
+    }
 }
 
 
index dcd308d4d03e64f10294ebd2229c7dc9a9557a92..94a224299a6339397548fb390e2e85b74d5865a7 100644 (file)
@@ -360,7 +360,10 @@ static void gtk_tx_flash_set_channel_level(GtkTxFlash *tx_flash, f_prec new_valu
 {
        GtkWidget *widget=GTK_WIDGET(tx_flash);
        GtkAllocation allocation;
+       GdkDrawingContext *context;
+       GdkWindow *window;
        cairo_t *cr;
+       cairo_region_t *region;
        gint i, y;
        int new_level;
        int red=0;
@@ -368,7 +371,10 @@ static void gtk_tx_flash_set_channel_level(GtkTxFlash *tx_flash, f_prec new_valu
        new_level=(int) (new_value/tx_flash->level_value);
        gtk_widget_get_allocation(widget, &allocation);
        
-       cr = gdk_cairo_create (gtk_widget_get_window(widget));
+       region = cairo_region_create();
+       window = gtk_widget_get_window(widget);
+       context = gdk_window_begin_draw_frame(window, region);
+       cr =  gdk_drawing_context_get_cairo_context(context);
        cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
        cairo_set_line_width(cr,1);
        cairo_set_source_surface (cr, tx_flash->surface, 0, 0);
@@ -409,45 +415,45 @@ static void gtk_tx_flash_set_channel_level(GtkTxFlash *tx_flash, f_prec new_valu
                }
        }
        
-       if (new_level==channel->last_level) 
-               return;
-       
-       if (new_level<channel->last_level) {
-               new_level=channel->last_level*globals.flash_response;
+       if (new_level!=channel->last_level)  {
+           if (new_level<channel->last_level) {
+                   new_level=channel->last_level*globals.flash_response;
+           }
+
+           if (new_level>channel->last_level) {
+                   gdk_cairo_set_source_rgba (cr, &tx_flash->colors[COL_NORM]);
+
+                   for (i=channel->last_level, y=allocation.height-(DY+channel->last_level*DLEVEL); i<=new_level; y-=DLEVEL, i++) {
+                           if (!red) {
+                                   if (i>=tx_flash->red_level) {
+                                           gdk_cairo_set_source_rgba (cr, &tx_flash->colors[COL_LOUD]);
+                                           red=1;
+                                   }
+                           }
+                           cairo_move_to (cr, channel->x1, y);
+                           cairo_line_to (cr, channel->x2, y);
+                           cairo_stroke (cr);
+                   }
+           } else {
+                   gdk_cairo_set_source_rgba (cr, &tx_flash->colors[COL_BG]);
+
+                   if (channel->last_level==channel->max) {
+                           i=channel->last_level-1;
+                   } else {
+                           i=channel->last_level;
+                   }
+
+                   for (y=allocation.height-(DY+i*DLEVEL); i>new_level; y+=DLEVEL, i--) {
+                           cairo_move_to (cr, channel->x1, y);
+                           cairo_line_to (cr, channel->x2, y);
+                           cairo_stroke (cr);
+                   }
+           }
+           channel->last_level=new_level;
        }
-       
-       if (new_level>channel->last_level) {
-               gdk_cairo_set_source_rgba (cr, &tx_flash->colors[COL_NORM]);
-               
-               for (i=channel->last_level, y=allocation.height-(DY+channel->last_level*DLEVEL); i<=new_level; y-=DLEVEL, i++) {
-                       if (!red) {
-                               if (i>=tx_flash->red_level) {
-                                       gdk_cairo_set_source_rgba (cr, &tx_flash->colors[COL_LOUD]);
-                                       red=1;
-                               }
-                       }
-                       cairo_move_to (cr, channel->x1, y);
-                       cairo_line_to (cr, channel->x2, y);
-                       cairo_stroke (cr);
-               }
-       } else {
-               gdk_cairo_set_source_rgba (cr, &tx_flash->colors[COL_BG]);
-               
-               if (channel->last_level==channel->max) {
-                       i=channel->last_level-1;
-               } else {
-                       i=channel->last_level;
-               }
-               
-               for (y=allocation.height-(DY+i*DLEVEL); i>new_level; y+=DLEVEL, i--) {
-                       cairo_move_to (cr, channel->x1, y);
-                       cairo_line_to (cr, channel->x2, y);
-                       cairo_stroke (cr);
-               }
-       }
-       channel->last_level=new_level;
-       
-       cairo_destroy(cr);
+
+       gdk_window_end_draw_frame(window, context);
+       cairo_region_destroy(region);
 }
 
 void
@@ -463,9 +469,7 @@ gtk_tx_flash_clear (GtkWidget *widget)
        tx_flash->channel[1].last_level=0;
        tx_flash->max_cycles=0;
        
-       cairo_t *cr = gdk_cairo_create (gtk_widget_get_window(widget));
-       gtk_tx_flash_paint_yourself(widget, cr);
-       cairo_destroy(cr);
+       gtk_widget_queue_draw(widget);
 }
 
 #ifdef __cplusplus
index a42cf50a0a4bae1abb3c98bc291f1ffbd8850f1e..e6d31e2f16092ede741854568d5a90b33a1c24c9 100644 (file)
@@ -49,7 +49,7 @@ gfloat ld_old_prog;
 #define add_widget_fix(wid); gtk_box_pack_start(GTK_BOX(vbox), wid, WID_FIX);\
        gtk_widget_show(wid);
 
-#define gtk_flush(); { int ctr=0; while (gtk_events_pending()) { ctr++; if (ctr>5) break; gtk_main_iteration(); gdk_flush(); }}
+#define gtk_flush(); { int ctr=0; while (gtk_events_pending()) { ctr++; if (ctr>5) break; gtk_main_iteration(); gdk_display_flush(gdk_display_get_default()); }}
 
 
 int ld_create_loaddlg(int mode, int count)
index dcf144731b60faa6467b6bfa6c4ae45c356927f3..e884a61eef80a2becc4af625a3c9a192783a2a87 100644 (file)
@@ -151,7 +151,7 @@ void turn_audio_off(void)
 {
        if (audioon) {
                gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(engine_btn), 0);
-               while (gtk_events_pending()) gtk_main_iteration();              
+               while (gtk_events_pending()) gtk_main_iteration();
        }
 }
 
@@ -159,18 +159,18 @@ gint pos_update(gpointer data)
 {
        f_prec temp,temp2;
 
-       if (stop_update) {              
+       if (stop_update) {
                cleanup_all_vtts();
                tX_seqpar :: update_all_graphics();
                if (old_focus) gui_show_focus(old_focus, 0);
                old_focus=NULL;
                gtk_tx_flash_clear(main_flash);
-               gdk_flush();    
+               gdk_display_flush(gdk_display_get_default());
                update_tag=0;
                return FALSE;
        } else {
                update_all_vtts();
-               
+
                /*main vu meter */
                temp=vtt_class::mix_max_l;
                vtt_class::mix_max_l=0;
@@ -181,7 +181,7 @@ gint pos_update(gpointer data)
                if (vtt_class::focused_vtt!=old_focus) {
                        if (old_focus) gui_show_focus(old_focus, 0);
                        old_focus=vtt_class::focused_vtt;
-                       if (old_focus) gui_show_focus(old_focus, 1);                    
+                       if (old_focus) gui_show_focus(old_focus, 1);
                }
 
                grab_status = mouse.is_grabbed();
@@ -192,24 +192,24 @@ gint pos_update(gpointer data)
                                gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(grab_button), 0);
                        }
                }
-               gdk_flush();    
+               gdk_display_flush(gdk_display_get_default());
                update_delay--;
-               
+
                if (update_delay < 0) {
                        seq_update();
                        tX_seqpar::update_all_graphics();
                        update_delay=globals.update_delay;
                }
-               
+
                if (tX_engine::get_instance()->check_error()) {
                        tX_error("ouch - error while playback...");
-                       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(engine_btn), 0);                 
+                       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(engine_btn), 0);
                        return FALSE;
-               }               
-               
+               }
+
                // let the audio engine we got the chance to do something
                tX_engine::get_instance()->reset_cycles_ctr();
-               
+
                return TRUE;
        }
 }
@@ -222,9 +222,9 @@ void mg_update_status()
        pid_t mypid;
        char filename[PATH_MAX];
        char buffer[256];
-       int found=0;    
+       int found=0;
        int mem;
-       
+
        mypid=getpid();
        sprintf(filename, "/proc/%i/status", mypid);
        procfs=fopen(filename, "r");
@@ -1310,8 +1310,6 @@ void create_mastergui(int x, int y)
        
        main_window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
 
-       gtk_window_set_wmclass(GTK_WINDOW(main_window), "terminatorX", "tX_mastergui");
-
        gtk_window_set_title(GTK_WINDOW(main_window), "terminatorX");
 
        gtk_widget_realize(main_window);
index fd6761d6ae8e94696da05557e7e3039d0c333d3e..ee5034cd12472eb73ee7e62dd9129f3d59af54ea 100644 (file)
@@ -1,24 +1,24 @@
 /*
     terminatorX - realtime audio scratching software
     Copyright (C) 1999-2020  Alexander K├Ânig
+
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.
+
     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.
+
     You should have received a copy of the GNU General Public License
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
     File: tX_mouse.cc
+
     Description: This implements the mouse AND keyboard Input handling in
-                Grab-Mode.
+                Grab-Mode.
 */
 
 #include <sys/wait.h>
@@ -50,7 +50,7 @@ tx_mouse :: tx_mouse()
        keyboard = NULL;
        linux_input_channel = NULL;
        grab_mode = LINUX_INPUT;
-       
+
        grabbed=0;
        warp=TX_MOUSE_SPEED_NORMAL;
        enable_auto_mnemonics = FALSE;
@@ -61,23 +61,23 @@ tx_mouse :: tx_mouse()
 
 
 int tx_mouse :: grab()
-{      
+{
        if (grabbed) return 0;
 
        // release all keys
        memset(key_pressed, 0, sizeof(key_pressed));
 
        warp_override=false;
-       
+
        if (grab_linux_input()) {
                grab_mode = LINUX_INPUT;
        } else {
                grab_mode = FALLBACK;
        }
-       
+
        window =  gtk_widget_get_window(main_window);
        GdkDisplay* gdk_dpy = gdk_window_get_display(window);
-       GdkDeviceManager *device_manager = gdk_display_get_device_manager(gdk_dpy);
+       GdkSeat *seat = gdk_display_get_default_seat(gdk_dpy);
 
        if (grab_mode == FALLBACK) {
            enable_compression = gdk_window_get_event_compression(window);
@@ -102,34 +102,25 @@ int tx_mouse :: grab()
                g_object_set (gtk_widget_get_settings (main_window), "gtk-auto-mnemonics", off, NULL);
        }
 
-       pointer = gdk_device_manager_get_client_pointer(device_manager);
+       pointer = gdk_seat_get_pointer(seat);
        GdkGrabStatus grab_status = gdk_device_grab(pointer, top_window, GDK_OWNERSHIP_APPLICATION, FALSE, GdkEventMask (GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK), NULL, GDK_CURRENT_TIME);
 
-       gdk_device_get_position(pointer, &screen, &x_restore, &y_restore);      
-       
+       gdk_device_get_position(pointer, &screen, &x_restore, &y_restore);
+
        gint x = gdk_screen_get_width(screen) / 2;
        gint y = gdk_screen_get_height(screen) / 2;
-       
+
        x_abs = x;
        y_abs = y;
-       
+
        gdk_device_warp(pointer, screen, x_abs, y_abs);
 
        if (grab_status != GDK_GRAB_SUCCESS) {
                return(-1);
-       }       
-       
-       GList *list = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_MASTER);
-       for (GList *link = list; link != NULL; link = g_list_next (link)) {
-               GdkDevice *device = GDK_DEVICE (link->data);
-               
-               if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
-                       continue;
-
-               keyboard = device;
-               break;
        }
-       
+
+       keyboard = gdk_seat_get_keyboard(seat);
+
        grab_status = gdk_device_grab(keyboard, top_window, GDK_OWNERSHIP_APPLICATION, FALSE, GdkEventMask (GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK), NULL, GDK_CURRENT_TIME);
 
        if (grab_status != GDK_GRAB_SUCCESS) {
@@ -139,12 +130,12 @@ int tx_mouse :: grab()
 
        cursor = gdk_window_get_cursor(window);
        gdk_window_set_cursor(window, gdk_cursor_new_for_display(gdk_dpy, GDK_BLANK_CURSOR));
-       
+
        grabbed=1;
-       
+
        std::list<vtt_class *> :: iterator v;
        int c=0;
-       
+
        for (v=vtt_class::main_list.begin(); v!=vtt_class::main_list.end(); v++) {
                if (!(*v)->audio_hidden) {
                        vtt_class::focus_no(c);
@@ -154,7 +145,7 @@ int tx_mouse :: grab()
        }
 
        warp=TX_MOUSE_SPEED_NORMAL;
-       
+
        return 0;
 }
 
@@ -163,7 +154,7 @@ void tx_mouse :: ungrab()
        if (!grabbed) return;
 
        tX_debug("tX_mouse::ungrab(): this: %016" PRIxPTR, (uintptr_t) this);
-       
+
        gdk_device_ungrab(keyboard, GDK_CURRENT_TIME);
        gdk_device_ungrab(pointer, GDK_CURRENT_TIME);
 
@@ -176,15 +167,15 @@ void tx_mouse :: ungrab()
        if (enable_auto_mnemonics) {
                g_object_set (gtk_widget_get_settings (main_window), "gtk-auto-mnemonics", enable_auto_mnemonics, NULL);
        }
-       
+
        if (grab_mode == FALLBACK) {
            gdk_window_set_event_compression(window, enable_compression);
        }
 
        ungrab_linux_input();
-       
+
        tX_debug("tX_mouse::ungrab(): done");
-       
+
        grabbed=0;
 }
 
@@ -198,7 +189,7 @@ GError *tx_mouse::open_channel() {
        } else {
                return error;
        }
-       
+
        return NULL;
 }
 
@@ -211,7 +202,7 @@ void tx_mouse::close_channel() {
 }
 
 int tx_mouse::grab_linux_input() {
-       
+
        if (linux_input_channel) {
                linux_input_watch = g_io_add_watch_full(linux_input_channel, G_PRIORITY_HIGH, G_IO_IN, tx_mouse::linux_input_wrap, this, NULL);
        } else {
@@ -223,7 +214,7 @@ int tx_mouse::grab_linux_input() {
 
 void tx_mouse::ungrab_linux_input() {
        if (grab_mode == LINUX_INPUT) {
-               // only remove the watch, we keep the channel as we dropped root and might fail to re-open it
+               // only remove the watch, we keep the channel as we dropped root and might fail to re-open it
                g_source_remove(linux_input_watch);
        }
 }
@@ -234,13 +225,13 @@ void tx_mouse::motion_notify(GtkWidget *widget, GdkEventMotion *eventMotion) {
        if ((grab_mode == FALLBACK) && vtt) {
                gdouble d_x = eventMotion->x_root - x_abs;
                gdouble d_y = eventMotion->y_root - y_abs;
-               
+
                if ((d_x != 0.0) || (d_y != 0.0)) {
                        //gdouble xnow, ynow;
                        //gdk_device_get_position_double(pointer, NULL, &xnow, &ynow);
                        //printf("%lf -> %lf, %lf -> %lf\n", eventMotion->x_root, xnow, eventMotion->y_root, ynow);
                        gdk_device_warp(pointer, screen, x_abs, y_abs);
-                       
+
                        if (warp_override) {
                                f_prec value=(fabs(d_x)>fabs(d_y)) ? d_x : d_y;
                                vtt->sp_speed.handle_mouse_input(value*globals.mouse_speed*warp);
@@ -257,7 +248,7 @@ void tx_mouse::linux_input(tx_input_event *event) {
                        // gdk_device_warp(pointer, screen, x_abs, y_abs);
                        gdouble d_x = event->x_motion;
                        gdouble d_y = event->y_motion;
-               
+
                        if (warp_override) {
                                f_prec value=(fabs(d_x)>fabs(d_y)) ? d_x : d_y;
                                vtt->sp_speed.handle_mouse_input(value*globals.mouse_speed*warp);
@@ -410,12 +401,12 @@ gboolean tx_mouse::linux_input_wrap(GIOChannel *source, GIOCondition condition,
                tx_mouse* mouse = (tx_mouse *) data;
                gint fd = g_io_channel_unix_get_fd(mouse->linux_input_channel);
                ssize_t bytes_read = read(fd, &eventbuffer, sizeof(eventbuffer));
-               
+
                //printf("read %lu bytes, %lu events\n", bytes_read, bytes_read / sizeof(tx_input_event));
-               
+
                sum.x_motion = 0;
                sum.y_motion = 0;
-               
+
                for (ssize_t i = 0; i < bytes_read / ((ssize_t) sizeof(tx_input_event)); i++) {
                        sum.x_motion += eventbuffer[i].x_motion;
                        sum.y_motion += eventbuffer[i].y_motion;
index a8b9bb14b3d010c7632501f2fa516310f611db7f..348c17f1f287425c7988ddd0a38a03da99c916d4 100644 (file)
@@ -28,7 +28,9 @@
 #define WID_DYN TRUE, TRUE, 0
 #define WID_FIX FALSE, FALSE, 0
 
-static const GtkTargetEntry entries[] = { { "GTK_LIST_BOX_ROW", GTK_TARGET_SAME_APP, 0 } };
+// workaround GtkEntry not having target set to const for some reason
+static gchar entries_type[] = "GTK_LIST_BOX_ROW"; 
+static const GtkTargetEntry entries[] = { { entries_type, GTK_TARGET_SAME_APP, 0 } };
 
 static vtt_fx *dragged_effect = NULL;
 static GtkWidget *dragged_list_box = NULL;
index 690bd59d4a0e3d9fd8a1d3399ee39cb50b58c216..548259ef3900820e02577238cdf49caa00fcd759 100644 (file)
@@ -239,15 +239,15 @@ void tX_seqpar :: receive_forward_value(const float value)
 void tX_seqpar :: materialize_forward_values()
 {
        list <tX_seqpar *> :: iterator sp;
-       
+
        for (sp=all->begin(); sp!=all->end(); sp++) {
                (*sp)->exec_value((*sp)->fwd_value);
-       }       
-       gdk_flush();
+       }
+       gdk_display_flush(gdk_display_get_default());
 }
 
 const char * tX_seqpar :: get_vtt_name()
-{       
+{
         if (vtt) return tt->name;
         else return "Master Track";
 }
@@ -1183,8 +1183,8 @@ gboolean tX_seqpar::tX_seqpar_press(GtkWidget *widget, GdkEventButton *event, gp
                g_signal_connect(item, "activate", (GCallback) menu_delete_all_events_for_sp, sp);              
                                
                gtk_widget_show(menu);
-               
-               gtk_menu_popup (GTK_MENU(menu), NULL, NULL, NULL, NULL, event->button, event->time);
+       
+               gtk_menu_popup_at_widget(GTK_MENU(menu), widget, GDK_GRAVITY_SOUTH_WEST, GDK_GRAVITY_NORTH_WEST, (GdkEvent *)event);
                //gtk_grab_remove(gtk_grab_get_current());
 
                return TRUE;
index 19d90c7f5b716ed69da5a5643f2380e632154cd4..04fa12868f8b87dba84aab0bf70d5ffa1c183345 100644 (file)
@@ -522,11 +522,11 @@ static gint vg_mouse_mapping_pressed(GtkWidget *wid, GdkEventButton *event, vtt_
                vtt->gui.mouse_mapping_menu=NULL;
        }
        /* gtk+ seems to cleanup the submenus automatically */
-       
+
        vtt->gui.mouse_mapping_menu=gtk_menu_new();
        GtkWidget *x_item;
        GtkWidget *y_item;
-       
+
        x_item=gtk_menu_item_new_with_label("X-axis (Left <-> Right)");
        gtk_menu_shell_append(GTK_MENU_SHELL(vtt->gui.mouse_mapping_menu), x_item);
        gtk_widget_show(x_item);
@@ -534,13 +534,13 @@ static gint vg_mouse_mapping_pressed(GtkWidget *wid, GdkEventButton *event, vtt_
        y_item=gtk_menu_item_new_with_label("Y-axis (Up <-> Down)");
        gtk_menu_shell_append(GTK_MENU_SHELL(vtt->gui.mouse_mapping_menu), y_item);
        gtk_widget_show(y_item);
-       
+
        vtt->gui.mouse_mapping_menu_x=gtk_menu_new();
        vtt->gui.mouse_mapping_menu_y=gtk_menu_new();
-       
+
        GtkWidget *item;
        GtkWidget *item_to_activate=NULL;
-       
+
        /* Filling the X menu */
        item = gtk_check_menu_item_new_with_label("Disable");
        gtk_menu_shell_append(GTK_MENU_SHELL(vtt->gui.mouse_mapping_menu_x), item);
@@ -556,16 +556,16 @@ static gint vg_mouse_mapping_pressed(GtkWidget *wid, GdkEventButton *event, vtt_
                        gtk_menu_shell_append(GTK_MENU_SHELL(vtt->gui.mouse_mapping_menu_x), item);
                        gtk_widget_show(item);
                        g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(vg_xcontrol_set), (void*) (*sp));
-                       
+
                        if (vtt->x_par==(*sp)) item_to_activate=item;
                }
        }
 
        if (item_to_activate) gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item_to_activate), TRUE);
-       
+
        /* Filling the Y menu */
        item_to_activate=NULL;
-       
+
        item = gtk_check_menu_item_new_with_label("Disable");
        gtk_menu_shell_append(GTK_MENU_SHELL(vtt->gui.mouse_mapping_menu_y), item);
        gtk_widget_show(item);
@@ -578,19 +578,19 @@ static gint vg_mouse_mapping_pressed(GtkWidget *wid, GdkEventButton *event, vtt_
                        gtk_menu_shell_append(GTK_MENU_SHELL(vtt->gui.mouse_mapping_menu_y), item);
                        gtk_widget_show(item);
                        g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(vg_ycontrol_set), (void*) (*sp));
-                       
+
                        if (vtt->y_par==(*sp)) item_to_activate=item;
                }
        }
 
        if (item_to_activate) gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item_to_activate), TRUE);
-       
+
        gtk_menu_item_set_submenu(GTK_MENU_ITEM(x_item), vtt->gui.mouse_mapping_menu_x);
        gtk_menu_item_set_submenu(GTK_MENU_ITEM(y_item), vtt->gui.mouse_mapping_menu_y);
-       gtk_menu_popup (GTK_MENU(vtt->gui.mouse_mapping_menu), NULL, NULL, NULL, NULL, 0, 0);
-       
+       gtk_menu_popup_at_widget(GTK_MENU(vtt->gui.mouse_mapping_menu), wid, GDK_GRAVITY_SOUTH_WEST, GDK_GRAVITY_NORTH_WEST, (GdkEvent *)event);
+
        g_signal_emit_by_name(G_OBJECT(wid), "released", vtt);
-       
+
        return TRUE;
 }
 
@@ -618,7 +618,7 @@ static gint vg_file_button_pressed(GtkWidget *wid, GdkEventButton *event, vtt_cl
                g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(reload_vtt_buffer), vtt);
        }
        
-       gtk_menu_popup(GTK_MENU(vtt->gui.file_menu), NULL, NULL, NULL, NULL, 0,0);
+       gtk_menu_popup_at_widget(GTK_MENU(vtt->gui.file_menu), wid, GDK_GRAVITY_SOUTH_WEST, GDK_GRAVITY_NORTH_WEST, (GdkEvent *)event);
        /* gtk+ is really waiting for this.. */
        g_signal_emit_by_name(G_OBJECT(wid), "released", vtt);
        
@@ -638,7 +638,7 @@ static gint fx_button_pressed(GtkWidget *wid, GdkEventButton *event, vtt_class *
 
        if (g->ladspa_menu) gtk_widget_destroy(GTK_WIDGET(g->ladspa_menu));
        g->ladspa_menu=LADSPA_Class::get_ladspa_menu();
-       gtk_menu_popup (GTK_MENU(g->ladspa_menu), NULL, NULL, NULL, NULL, 0, 0);
+       gtk_menu_popup_at_widget(GTK_MENU(g->ladspa_menu), wid, GDK_GRAVITY_SOUTH_WEST, GDK_GRAVITY_NORTH_WEST, (GdkEvent *)event);
 
        /* gtk+ is really waiting for this.. */
        g_signal_emit_by_name(G_OBJECT(wid), "released", vtt);
@@ -654,7 +654,7 @@ static gint stereo_fx_button_pressed(GtkWidget *wid, GdkEventButton *event, vtt_
 
        if (g->ladspa_menu) gtk_widget_destroy(GTK_WIDGET(g->ladspa_menu));
        g->ladspa_menu=LADSPA_Class::get_stereo_ladspa_menu();
-       gtk_menu_popup (GTK_MENU(g->ladspa_menu), NULL, NULL, NULL, NULL, 0, 0);
+       gtk_menu_popup_at_widget(GTK_MENU(g->ladspa_menu), wid, GDK_GRAVITY_SOUTH_WEST, GDK_GRAVITY_NORTH_WEST, (GdkEvent *)event);
 
        /* gtk+ is really waiting for this.. */
        g_signal_emit_by_name(G_OBJECT(wid), "released", vtt);
@@ -669,7 +669,7 @@ void update_vtt_css(vtt_class *vtt, GdkRGBA* rgba) {
        memcpy(&copy, rgba, sizeof(GdkRGBA));
        copy.alpha = globals.title_bar_alpha;
        char *color_str = gdk_rgba_to_string(&copy);
-       snprintf(css, sizeof(css), ".%08x { background-color: %s; }", vtt, color_str);
+       snprintf(css, sizeof(css), ".%08lx { background-color: %s; }", (unsigned long) vtt, color_str);
        g_free(color_str);
         gtk_css_provider_load_from_data(vtt->gui.css_provider, css, -1, NULL);
         gtk_style_context_add_provider_for_screen(gdk_screen_get_default(), GTK_STYLE_PROVIDER(vtt->gui.css_provider), GTK_STYLE_PROVIDER_PRIORITY_USER);
@@ -835,7 +835,7 @@ void build_vtt_gui(vtt_class *vtt)
        g=&vtt->gui;
        vtt->have_gui=1;
 
-       snprintf(g->style_class, sizeof(g->style_class), "%0x", vtt);
+       snprintf(g->style_class, sizeof(g->style_class), "%08lx", (unsigned long) vtt);
 
        g->css_provider = gtk_css_provider_new();       
 
index 71ff5ca08d53cb04b50fee6208954b1af0b194bc..616c426605d4fd98aadf76a828445c77616ef922 100644 (file)
@@ -142,7 +142,7 @@ void gtk_tx_update_colors(GtkTx *tx, GdkRGBA *vtt_color) {
                color->alpha = frac*frac/2;
        }
        tx->render_buffer_fg = NULL;
-       gtk_tx_prepare(tx);
+       gtk_tx_prepare(GTK_WIDGET(tx));
 }