Help save net neutrality! Learn more.
Close

(SOLVED) gpsim gui under Ubutuntu 11.04

Help
2011-09-19
2013-04-02
  • Simone Freddio

    Simone Freddio - 2011-09-19

    Hi guys, i was interested in development some software for PIC… i have Ubuntu 11.04 on all my PCs and i found that Ubuntu guys completely remove package for gtk+extras. So i have tried to compile myself but i found that several things changed (gpsim need gtk+extra-2.0 that is quite old).
    I have digged the code to see what changed, and i am really surpised because very few i have to change very few things to get gtk+extra compile correctly.
    After having gtk+extra compiled and installed, i can get gpsim with gui under Ubuntu 11.04.

    So, i want to share my job to get other people using this wonderfull software under Ubuntu.

    i have downloaded gtk+extra from sourceforge, version 2.0.0 (that is what gpsim require), after untarring, only the file gtkextra/gtkitementry.c need to be modified… this is my patch:

    134c134
    < static void         gtk_entry_reset_im_context         (GtkEntry       *entry);
    ---
    > /*static*/ void         gtk_entry_reset_im_context         (GtkEntry       *entry);
    696c696
    <   if (new_text_length + entry->n_bytes + 1 > entry->text_size)
    ---
    >   if (new_text_length + entry->x_n_bytes + 1 > entry->x_text_size)
    698c698
    <       while (new_text_length + entry->n_bytes + 1 > entry->text_size)
    ---
    >       while (new_text_length + entry->x_n_bytes + 1 > entry->x_text_size)
    700,701c700,701
    <     if (entry->text_size == 0)
    <       entry->text_size = MIN_SIZE;
    ---
    >     if (entry->x_text_size == 0)
    >       entry->x_text_size = MIN_SIZE;
    704,706c704,706
    <         if (2 * (guint)entry->text_size < MAX_SIZE &&
    <         2 * (guint)entry->text_size > entry->text_size)
    <       entry->text_size *= 2;
    ---
    >         if (2 * (guint)entry->x_text_size < MAX_SIZE &&
    >         2 * (guint)entry->x_text_size > entry->x_text_size)
    >       entry->x_text_size *= 2;
    709,710c709,710
    <         entry->text_size = MAX_SIZE;
    <         if (new_text_length > (gint)entry->text_size - (gint)entry->n_bytes - 1)
    ---
    >         entry->x_text_size = MAX_SIZE;
    >         if (new_text_length > (gint)entry->x_text_size - (gint)entry->x_n_bytes - 1)
    712c712
    <             new_text_length = (gint)entry->text_size - (gint)entry->n_bytes - 1;
    ---
    >             new_text_length = (gint)entry->x_text_size - (gint)entry->x_n_bytes - 1;
    721c721
    <       entry->text = g_realloc (entry->text, entry->text_size);
    ---
    >       entry->text = g_realloc (entry->text, entry->x_text_size);
    726c726
    <   g_memmove (entry->text + index + new_text_length, entry->text + index, entry->n_bytes - index);
    ---
    >   g_memmove (entry->text + index + new_text_length, entry->text + index, entry->x_n_bytes - index);
    729c729
    <   entry->n_bytes += new_text_length;
    ---
    >   entry->x_n_bytes += new_text_length;
    733c733
    <   entry->text[entry->n_bytes] = '\0';
    ---
    >   entry->text[entry->x_n_bytes] = '\0';
    766c766
    <       g_memmove (entry->text + start_index, entry->text + end_index, entry->n_bytes + 1 - end_index);
    ---
    >       g_memmove (entry->text + start_index, entry->text + end_index, entry->x_n_bytes + 1 - end_index);
    768c768
    <       entry->n_bytes -= (end_index - start_index);
    ---
    >       entry->x_n_bytes -= (end_index - start_index);
    1031c1031
    <                                   entry->n_bytes,
    ---
    >                                   entry->x_n_bytes,
    1232c1232
    <           g_string_prepend_len (tmp_string, entry->text, entry->n_bytes);
    ---
    >           g_string_prepend_len (tmp_string, entry->text, entry->x_n_bytes);
    1241c1241
    <           ch_len = g_utf8_strlen (entry->text, entry->n_bytes);
    ---
    >           ch_len = g_utf8_strlen (entry->text, entry->x_n_bytes);
    1275c1275
    <           pango_layout_set_text (layout, entry->text, entry->n_bytes);
    ---
    >           pango_layout_set_text (layout, entry->text, entry->x_n_bytes);
    1697c1697
    < static void
    ---
    > /*static*/ void
    

    I hope this is canbe usefull for others.

     
  • Simone Freddio

    Simone Freddio - 2011-09-19

    I make a mistake in the thread caption… i wrote Ubutuntu instead of Ubuntu… maybe an admin can correct it? Thank you guys…

     
  • Anonymous - 2011-10-03

    This worked, but I also had to comment the static on the definition of the static void, not just the prototype. Thanks though. This simple fix should get into their cvs.

     

Log in to post a comment.