linphone-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Linphone-developers] Small patch


From: Yannack
Subject: Re: [Linphone-developers] Small patch
Date: Thu, 21 Mar 2013 09:38:26 +0100

OK, so I agree to the contributor agreement.
Here is the patch. I wrote it because on my system, a dual-monitor Ubuntu with Cinammon, when I click the icon in the systray and click it again, it restores the application to coordinates (0,0). This was really annoying me. My patch simply saves the position to memory when hiding the window with the click, and moves it back there when it is shown by clicking on that icon. I have tested it, it works great here. It was applied against master yesterday so should work fine.

--- a/gtk/main.c
+++ b/gtk/main.c
@@ -63,12 +63,15 @@ static void linphone_gtk_call_log_updated(LinphoneCore *lc, LinphoneCallLog *cl)
 static void linphone_gtk_call_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cs, const char *msg);
 static void linphone_gtk_call_encryption_changed(LinphoneCore *lc, LinphoneCall *call, bool_t enabled, const char *token);
 static void linphone_gtk_transfer_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate);
+void linphone_gtk_save_main_window_position(GtkWindow* mw, GdkEvent *event, gpointer data);
 static gboolean linphone_gtk_auto_answer(LinphoneCall *call);
 void linphone_gtk_status_icon_set_blinking(gboolean val);
 void _linphone_gtk_enable_video(gboolean val);
 
 
 
+static gint main_window_x=0;
+static gint main_window_y=0;
 static gboolean verbose=0;
 static gboolean auto_answer = 0;
 static gchar * addr_to_call = NULL;
@@ -1371,11 +1374,20 @@ static GtkWidget *create_icon_menu(){
        return menu;
 }
 
+
+void linphone_gtk_save_main_window_position(GtkWindow* mw, GdkEvent *event, gpointer data){
+       gtk_window_get_position(GTK_WINDOW(mw), &main_window_x, &main_window_y);
+}
+
 static void handle_icon_click() {
        GtkWidget *mw=linphone_gtk_get_main_window();
        if (!gtk_window_is_active((GtkWindow*)mw)) {
+               if(!gtk_widget_is_drawable(mw)){ //we only move if window was hidden. If it was simply behind the window stack, ie, drawable, we keep it as it was
+                       gtk_window_move (GTK_WINDOW(mw), main_window_x, main_window_y);
+               }
                linphone_gtk_show_main_window();
        } else {
+               linphone_gtk_save_main_window_position((GtkWindow*)mw, NULL, NULL);
                gtk_widget_hide(mw);
        }
 }


Hope this gets accepted,
Yannack



On Thu, Mar 21, 2013 at 9:07 AM, Guillaume Beraudo <address@hidden> wrote:
Hi,

For very small patches you can just state by email that you agree with
the agreement.

Note that in order to enter mainstream, the patch should apply on the
master git branch.


Cheers,

Guillaume Beraudo

_______________________________________________
Linphone-developers mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/linphone-developers


reply via email to

[Prev in Thread] Current Thread [Next in Thread]