$ git clone http://tcclient.ion.nu/tc_client.git
commit 9c431b752188ec1e6f82a9da5acefe270b61e6f2
Author: Alicia <...>
Date: Sat Sep 17 20:50:19 2016 +0200
tc_client-gtk: added GTK+2 compatibility code for the incompatibilities that have been introduced over time.
diff --git a/ChangeLog b/ChangeLog
index d2ac7b0..255f7f1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -27,6 +27,7 @@ tc_client-gtk: prevent new PM tabs from stopping automatic scrolling.
tc_client-gtk: if the server disconnects, print the notification and stop any outgoing broadcast.
tc_client-gtk: optimized incoming audio/video by checking for "Video:" and "Audio:" first when handling lines from the tc_client core.
tc_client-gtk: added a placeholder animation for cameras, shown for audio-only streams and streams that haven't sent any video data yet.
+tc_client-gtk: added GTK+2 compatibility code for the incompatibilities that have been introduced over time.
tc_client-gtk and camviewer: fixed compatibility with newer libavutil.
tc_client-gtk and camviewer: added compatibility fallbacks for av_image_get_buffer_size() and av_packet_unref()
tc_client-gtk and camviewer: specify a scaling algorithm for libswscale (mandatory for older versions of libswscale)
diff --git a/utilities/gtk/compat.c b/utilities/gtk/compat.c
index 9370036..7b2fbba 100644
--- a/utilities/gtk/compat.c
+++ b/utilities/gtk/compat.c
@@ -68,12 +68,12 @@ SECURITY_ATTRIBUTES sa={
for(i=0; line[i] && line[i]!='\n' && line[i]!='\r'; ++i);
return &line[i];
}
- // Hack to let us load a glade GUI designed for gtk+-3.x
+ // Hack to let us load a glade GUI designed for gtk+-3.x in gtk+-2.x
GtkBuilder* gtk_builder_new_from_file(const char* filename)
{
struct stat st;
if(stat(filename, &st)){return 0;}
- char buf[st.st_size+10];
+ char buf[st.st_size+128];
int f=open(filename, O_RDONLY);
read(f, buf, st.st_size);
close(f);
@@ -99,8 +99,8 @@ SECURITY_ATTRIBUTES sa={
pos[10]=dir;
}
}
- // Convert remaining GtkBoxes and GtkPaneds with the default orientation
- while((pos=strstr(buf, "class=\"GtkBox\"")) || (pos=strstr(buf, "class=\"GtkPaned\"")))
+ // Convert remaining GtkBoxes, GtkPaneds, GtkScales and GtkSeparators with the default orientation
+ while((pos=strstr(buf, "class=\"GtkBox\"")) || (pos=strstr(buf, "class=\"GtkPaned\"")) || (pos=strstr(buf, "class=\"GtkScale\"")) || (pos=strstr(buf, "class=\"GtkSeparator\"")))
{
memmove(&pos[11], &pos[10], strlen(&pos[10])+1);
pos[10]='H'; // Default is horizontal
diff --git a/utilities/gtk/compat.h b/utilities/gtk/compat.h
index 9165de2..ee78e85 100644
--- a/utilities/gtk/compat.h
+++ b/utilities/gtk/compat.h
@@ -53,6 +53,8 @@ extern SECURITY_ATTRIBUTES sa;
#if GTK_MAJOR_VERSION<3
#define GTK_ORIENTATION_HORIZONTAL 0
#define GTK_ORIENTATION_VERTICAL 1
+ #define gtk_widget_set_halign(x,y)
+ #define gtk_widget_get_preferred_size(x,y,z) (y)->height=gtk_widget_get_allocated_height(x)
extern GtkWidget* gtk_box_new(int vertical, int spacing);
extern int gtk_widget_get_allocated_width(GtkWidget* widget);
extern int gtk_widget_get_allocated_height(GtkWidget* widget);