TmpPhoto: gcin-tan-configure.diff

File gcin-tan-configure.diff, 7.7 kB (added by anonymous, 1 year ago)
  • gcin-1.3.5.pre4/Makefile

    old new  
    3333        gcin-icon.o gcin-setup-gtab.o gtab-list.o gcin-exec-script.o 
    3434 
    3535OBJS_gcin_gb_toggle = gcin-gb-toggle.o gcin-conf.o util.o gcin-send.o 
     36OBJS_gcin_tan_toggle = gcin-tan-toggle.o gcin-conf.o util.o gcin-send.o 
    3637OBJS_gcin_message = gcin-message.o gcin-conf.o util.o gcin-send.o 
    3738OBJS_pin_juyin = pin-juyin.o util.o pho-lookup.o locale.o pho-sym.o 
    3839 
     
    7677PROGS_SYM=trad2sim 
    7778PROGS_CV=kbmcv pin-juyin 
    7879 
     80ifeq ($(USE_TAN),Y) 
     81CFLAGS += -DUSE_TAN=1 
     82PROGS += gcin-tan-toggle 
     83endif 
     84 
    7985all:    $(PROGS) trad2sim $(DATA) $(PROGS_CV) gcin.spec 
    8086        $(MAKE) -C data 
    8187        $(MAKE) -C im-client 
     
    138144gcin-gb-toggle: $(OBJS_gcin_gb_toggle) 
    139145        $(CC) -o $@ $(OBJS_gcin_gb_toggle) $(LDFLAGS) 
    140146 
     147gcin-tan-toggle: $(OBJS_gcin_tan_toggle) 
     148        $(CC) -o $@ $(OBJS_gcin_tan_toggle) $(LDFLAGS) 
     149 
    141150gcin-message:   $(OBJS_gcin_message) 
    142151        $(CC) -o $@ $(OBJS_gcin_message) $(LDFLAGS) 
    143152 
  • gcin-1.3.5.pre4/gcin-tan-toggle.c

    old new  
     1#include "gcin.h" 
     2 
     3int main() 
     4{ 
     5  gdk_init(NULL, NULL); 
     6  send_gcin_message(GDK_DISPLAY(), "#gcin_tan_toggle"); 
     7 
     8  return 0; 
     9} 
  • gcin-1.3.5.pre4/win-gtab.c

    old new  
    184184} 
    185185 
    186186void show_win_sym(); 
     187#if USE_TAN 
     188void show_win_tan(); 
     189#endif 
    187190 
    188191void move_win_gtab(int x, int y) 
    189192{ 
     
    204207  win_x = x;  win_y = y; 
    205208 
    206209  show_win_sym(); 
     210#if USE_TAN 
     211  show_win_tan(); 
     212#endif 
    207213} 
    208214 
    209215void set_gtab_input_method_name(char *s) 
     
    228234} 
    229235 
    230236void create_win_sym(); 
     237#if USE_TAN 
     238void create_win_tan(); 
     239#endif 
    231240void exec_gcin_setup(); 
    232241 
    233242static void mouse_button_callback( GtkWidget *widget,GdkEventButton *event, gpointer data) 
     
    541550    gtk_window_present(gwin_gtab); 
    542551 
    543552  show_win_sym(); 
     553#if USE_TAN 
     554  show_win_tan(); 
     555#endif 
    544556} 
    545557 
    546558 
    547559void hide_win_sym(); 
     560#if USE_TAN 
     561void hide_win_tan(); 
     562#endif 
    548563void close_gtab_pho_win(); 
    549564 
    550565void hide_win_gtab() 
     
    557572  close_gtab_pho_win(); 
    558573 
    559574  hide_win_sym(); 
     575#if USE_TAN 
     576  hide_win_tan(); 
     577#endif 
    560578} 
    561579 
    562580void minimize_win_gtab() 
  • gcin-1.3.5.pre4/win-sym.c

    old new  
    55#include "win-sym.h" 
    66 
    77static GtkWidget *gwin_sym = NULL; 
     8#if USE_TAN 
     9static GtkWidget *gwin_tan = NULL; 
     10#endif 
    811static int cur_in_method; 
    912 
    1013typedef struct { 
     
    233236  gtk_window_move(GTK_WINDOW(gwin_sym), wx, wy); 
    234237} 
    235238 
     239#if USE_TAN 
     240void move_win_tan() 
     241{ 
     242  if (!gwin_tan) 
     243    return; 
     244 
     245  int wx, wy; 
     246  { 
     247    update_active_in_win_geom(); 
     248 
     249    wx = win_x; wy = win_y + win_yl; 
     250  } 
     251 
     252  int wintan_xl, wintan_yl; 
     253  get_win_size(gwin_tan, &wintan_xl, &wintan_yl); 
     254 
     255  if (wx + wintan_xl > dpy_xl) 
     256    wx = dpy_xl - wintan_xl; 
     257  if (wx < 0) 
     258    wx = 0; 
     259 
     260  { 
     261    if (wy + wintan_yl > dpy_yl) 
     262      wy = win_y - wintan_yl; 
     263    if (wy < 0) 
     264      wy = 0; 
     265  } 
     266 
     267  gtk_window_move(GTK_WINDOW(gwin_tan), wx, wy); 
     268} 
     269#endif 
     270 
    236271static gboolean win_sym_enabled=0; 
     272#if USE_TAN 
     273static gboolean win_tan_enabled=0; 
     274#endif 
    237275 
    238276void hide_win_sym() 
    239277{ 
     
    243281  gtk_widget_hide(gwin_sym); 
    244282} 
    245283 
     284#if USE_TAN 
     285void hide_win_tan() 
     286{ 
     287  if (!gwin_tan) 
     288    return; 
     289 
     290  gtk_widget_hide(gwin_tan); 
     291} 
     292#endif 
     293 
    246294void show_win_sym() 
    247295{ 
    248296  if (!current_CS) 
     
    257305  move_win_sym(gwin_sym); 
    258306} 
    259307 
     308#if USE_TAN 
     309void show_win_tan() 
     310{ 
     311  if (!current_CS) 
     312    return; 
     313 
     314  if (!gwin_tan || !win_tan_enabled || current_CS->im_state == GCIN_STATE_DISABLED) 
     315    return; 
     316 
     317  gtk_widget_show_all(gwin_tan); 
     318  move_win_tan(gwin_tan); 
     319} 
     320#endif 
    260321 
    261322void lookup_gtab(char *ch, char out[]); 
    262323void str_to_all_phokey_chars(char *b5_str, char *out); 
     
    289350  gwin_sym = NULL; 
    290351} 
    291352 
     353#if USE_TAN 
     354static void destroy_tan() 
     355{ 
     356  if (gwin_tan) 
     357    gtk_widget_destroy(gwin_tan); 
     358  gwin_tan = NULL; 
     359} 
     360#endif 
    292361 
    293362gboolean  button_scroll_event(GtkWidget *widget,GdkEventScroll *event, gpointer user_data) 
    294363{ 
     
    413482  return; 
    414483} 
    415484 
     485#if USE_TAN 
     486void create_win_tan() 
     487{ 
     488  char gcin_dir[512]; 
     489 
     490  if (!current_CS) { 
     491    dbg("create_win_tan, null CS\n"); 
     492    return; 
     493  } 
     494 
     495  if (current_CS->in_method < 0) { 
     496    p_err("bad current_CS %d\n", current_CS->in_method); 
     497  } 
     498 
     499  if (cur_in_method != current_CS->in_method) 
     500    destroy_tan(); 
     501 
     502  win_tan_enabled^=1; 
     503 
     504  if (gwin_tan) { 
     505    if (win_tan_enabled) { 
     506      show_win_tan(gwin_tan); 
     507    } 
     508    else 
     509      hide_win_tan(gwin_tan); 
     510 
     511    return; 
     512  } 
     513 
     514  gwin_tan = gtk_window_new (GTK_WINDOW_TOPLEVEL); 
     515  cur_in_method = current_CS->in_method; 
     516 
     517  GtkWidget *vbox_top = gtk_vbox_new (FALSE, 0); 
     518  gtk_container_add (GTK_CONTAINER (gwin_tan), vbox_top); 
     519 
     520  gtk_container_set_border_width (GTK_CONTAINER (vbox_top), 0); 
     521 
     522  GtkWidget *image = gtk_image_new_from_file(get_gcin_conf_fname("gcin-tan", gcin_dir)); 
     523  gtk_box_pack_start (GTK_BOX (vbox_top), image, FALSE, FALSE, 0); 
     524 
     525  gtk_widget_realize (gwin_tan); 
     526  set_no_focus(gwin_tan); 
     527 
     528  if (win_tan_enabled) 
     529    gtk_widget_show_all(gwin_tan); 
     530 
     531  move_win_tan(gwin_tan); 
     532  return; 
     533} 
     534#endif 
    416535 
    417536void change_win_sym_font_size() 
    418537{