~ubuntu-branches/ubuntu/wily/scim/wily-proposed

« back to all changes in this revision

Viewing changes to extras/panel/scim_panel_gtk.cpp

  • Committer: Package Import Robot
  • Author(s): Rolf Leggewie, Rolf Leggewie, Tz-Huan Huang
  • Date: 2012-06-30 11:21:42 UTC
  • mfrom: (1.1.7)
  • Revision ID: package-import@ubuntu.com-20120630112142-a4cwzsr16dty8dk7
Tags: 1.4.14-1
[ Rolf Leggewie ]
* new upstream release 1.4.14
  - drop 32_scim-1.4.8-fix-dlopen.patch which has landed upstream
* bump compat level to 9
* debian/control: add Toni Mueller as co-maintainer
  Welcome aboard!

[ Tz-Huan Huang ]
* start shipping a couple of newly introduced im-module packages
* debian/rules:
  - simplify dh_auto_install override where upstream changes allow this
  - drop -fpermissive from CXXFLAGS, fixed upstream
* debian/README.*: update the documentation

Show diffs side-by-side

added added

removed removed

Lines of Context:
170
170
static gboolean   ui_create_tray_icon_when_idle        (gpointer        data);
171
171
#endif
172
172
 
173
 
#if GDK_MULTIHEAD_SAFE
 
173
#if GTK_CHECK_VERSION(2, 2, 0)
174
174
static void       ui_switch_screen                     (GdkScreen      *screen);
175
175
#endif
176
176
 
381
381
/////////////////////////////////////////////////////////////////////////////
382
382
// Declaration of internal variables.
383
383
/////////////////////////////////////////////////////////////////////////////
384
 
#if GDK_MULTIHEAD_SAFE
 
384
#if GTK_CHECK_VERSION(2, 2, 0)
385
385
static GdkScreen         *_current_screen              = 0;
386
386
#endif
387
387
 
718
718
    _tooltips = 0;
719
719
#endif
720
720
 
721
 
#if GDK_MULTIHEAD_SAFE
 
721
#if GTK_CHECK_VERSION(2, 2, 0)
722
722
    // Initialize the Display and Screen.
723
723
    _current_screen  = gdk_screen_get_default ();
724
724
#endif
750
750
        gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_OUT);
751
751
        gtk_container_add (GTK_CONTAINER (_input_window), frame);
752
752
 
 
753
#if GTK_CHECK_VERSION(3, 2, 0)
 
754
        hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
 
755
#else
753
756
        hbox = gtk_hbox_new (FALSE, 0);
 
757
#endif
754
758
        gtk_container_add (GTK_CONTAINER (frame), hbox);
755
759
 
 
760
#if GTK_CHECK_VERSION(3, 2, 0)
 
761
        vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
 
762
#else
756
763
        vbox = gtk_vbox_new (FALSE, 0);
 
764
#endif
757
765
        gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
758
766
        input_window_vbox = vbox;
759
767
 
829
837
        GtkWidget *separator;
830
838
 
831
839
        if (_lookup_table_embedded) {
 
840
#if GTK_CHECK_VERSION(3, 2, 0)
 
841
            _lookup_table_window = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
 
842
#else
832
843
            _lookup_table_window = gtk_vbox_new (FALSE, 0);
 
844
#endif
833
845
            gtk_box_pack_start (GTK_BOX (input_window_vbox), _lookup_table_window, TRUE, TRUE, 0);
834
846
            lookup_table_parent = _lookup_table_window;
 
847
#if GTK_CHECK_VERSION(3, 2, 0)
 
848
            separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
 
849
#else
835
850
            separator = gtk_hseparator_new ();
 
851
#endif
836
852
            gtk_box_pack_start (GTK_BOX (lookup_table_parent), separator, FALSE, FALSE, 0);
837
853
        } else {
838
854
            _lookup_table_window = gtk_window_new (GTK_WINDOW_POPUP);
861
877
 
862
878
        //Vertical lookup table
863
879
        if (_lookup_table_vertical) {
 
880
#if GTK_CHECK_VERSION(3, 2, 0)
 
881
            vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
 
882
#else
864
883
            vbox = gtk_vbox_new (FALSE, 0);
 
884
#endif
865
885
            gtk_container_add (GTK_CONTAINER (lookup_table_parent), vbox);
866
886
 
867
887
            //New table items
897
917
                gtk_box_pack_start (GTK_BOX (vbox), _lookup_table_items [i], TRUE, TRUE, 0);
898
918
            }
899
919
 
 
920
#if GTK_CHECK_VERSION(3, 2, 0)
 
921
            separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
 
922
#else
900
923
            separator = gtk_hseparator_new ();
 
924
#endif
901
925
            gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 0);
902
926
 
 
927
#if GTK_CHECK_VERSION(3, 2, 0)
 
928
            hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
 
929
#else
903
930
            hbox = gtk_hbox_new (FALSE, 0);
 
931
#endif
904
932
            gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
905
933
 
906
934
            //New down button
922
950
                                image);
923
951
 
924
952
        } else {
 
953
#if GTK_CHECK_VERSION(3, 2, 0)
 
954
            hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
 
955
#else
925
956
            hbox = gtk_hbox_new (FALSE, 0);
 
957
#endif
926
958
            gtk_container_add (GTK_CONTAINER (lookup_table_parent), hbox);
927
959
 
928
960
            _lookup_table_items [0] = scim_string_view_new ();
954
986
                            0);
955
987
            gtk_box_pack_start (GTK_BOX (hbox), _lookup_table_items [0], TRUE, TRUE, 0);
956
988
 
 
989
#if GTK_CHECK_VERSION(3, 2, 0)
 
990
            separator = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
 
991
#else
957
992
            separator = gtk_vseparator_new ();
 
993
#endif
958
994
            gtk_box_pack_start (GTK_BOX (hbox), separator, FALSE, FALSE, 0);
959
995
 
960
996
            //New left button
1030
1066
        gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_OUT);
1031
1067
        gtk_container_add (GTK_CONTAINER (_toolbar_window), frame);
1032
1068
 
 
1069
#if GTK_CHECK_VERSION(3, 2, 0)
 
1070
        hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
 
1071
#else
1033
1072
        hbox = gtk_hbox_new (FALSE, 0);
 
1073
#endif
1034
1074
        gtk_container_add (GTK_CONTAINER (frame), hbox);
1035
1075
 
1036
1076
        //New trademark pixmap
1060
1100
        }
1061
1101
 
1062
1102
        // Put all properties here
 
1103
#if GTK_CHECK_VERSION(3, 2, 0)
 
1104
        _client_properties_area = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
 
1105
#else
1063
1106
        _client_properties_area = gtk_hbox_new (FALSE, 0);
 
1107
#endif
1064
1108
        gtk_box_pack_start (GTK_BOX (hbox), _client_properties_area, TRUE, TRUE, 0);
1065
1109
        gtk_widget_show (_client_properties_area);
1066
1110
 
1219
1263
    // Add an event filter function to observe X root window's properties.
1220
1264
    GdkWindow *root_window = gdk_get_default_root_window ();
1221
1265
    GdkEventMask event_mask;
1222
 
#if GDK_MULTIHEAD_SAFE
 
1266
#if GTK_CHECK_VERSION(2, 2, 0)
1223
1267
    if (_current_screen)
1224
1268
        root_window = gdk_screen_get_root_window (_current_screen);
1225
1269
#endif
1245
1289
    GtkRequisition ws;
1246
1290
    gint spot_x, spot_y;
1247
1291
 
 
1292
#if GTK_CHECK_VERSION(3, 0, 0)
 
1293
    gtk_widget_get_preferred_size (_input_window, &ws, NULL);
 
1294
#else
1248
1295
    gtk_widget_size_request (_input_window, &ws);
 
1296
#endif
1249
1297
 
1250
1298
    if (!relative) {
1251
1299
        spot_x = _spot_location_x; 
1289
1337
    GtkRequisition iws;
1290
1338
    GtkRequisition ws;
1291
1339
 
 
1340
#if GTK_CHECK_VERSION(3, 0, 0)
 
1341
    gtk_widget_get_preferred_size (_input_window, &iws, NULL);
 
1342
    gtk_widget_get_preferred_size (_lookup_table_window, &ws, NULL);
 
1343
#else
1292
1344
    gtk_widget_size_request (_input_window, &iws);
1293
1345
    gtk_widget_size_request (_lookup_table_window, &ws);
 
1346
#endif
1294
1347
 
1295
1348
    pos_x = _input_window_x;
1296
1349
    pos_y = _input_window_y + iws.height + 8;
1332
1385
    GtkRequisition ws;
1333
1386
    gint pos_x, pos_y;
1334
1387
 
 
1388
#if GTK_CHECK_VERSION(3, 0, 0)
 
1389
    gtk_widget_get_preferred_size (_toolbar_window, &ws, NULL);
 
1390
#else
1335
1391
    gtk_widget_size_request (_toolbar_window, &ws);
 
1392
#endif
1336
1393
 
1337
1394
    pos_x = _config->read (String (SCIM_CONFIG_PANEL_GTK_TOOLBAR_POS_X),
1338
1395
                           workarea_x + workarea_width - ws.width);
1373
1430
static bool
1374
1431
ui_get_screen_rect (GdkRectangle &rect)
1375
1432
{
1376
 
#if GDK_MULTIHEAD_SAFE
 
1433
#if GTK_CHECK_VERSION(2, 2, 0)
1377
1434
        GdkWindow * active_window;
1378
1435
    int index;
1379
1436
 
1395
1452
static int
1396
1453
ui_multi_monitor_width ()
1397
1454
{
1398
 
#if GDK_MULTIHEAD_SAFE
 
1455
#if GTK_CHECK_VERSION(2, 2, 0)
1399
1456
        GdkRectangle rect;
1400
1457
    
1401
1458
    if (_current_screen)
1414
1471
static int
1415
1472
ui_multi_monitor_height ()
1416
1473
{
1417
 
#if GDK_MULTIHEAD_SAFE
 
1474
#if GTK_CHECK_VERSION(2, 2, 0)
1418
1475
        GdkRectangle rect;
1419
1476
    
1420
1477
    if (_current_screen)
1433
1490
static int
1434
1491
ui_screen_width (void)
1435
1492
{
1436
 
#if GDK_MULTIHEAD_SAFE
 
1493
#if GTK_CHECK_VERSION(2, 2, 0)
1437
1494
    if (_current_screen)
1438
1495
        return ui_multi_monitor_width ();
1439
1496
#endif
1443
1500
static int
1444
1501
ui_screen_height (void)
1445
1502
{
1446
 
#if GDK_MULTIHEAD_SAFE
 
1503
#if GTK_CHECK_VERSION(2, 2, 0)
1447
1504
    if (_current_screen)
1448
1505
        return ui_multi_monitor_height ();
1449
1506
#endif
1460
1517
    gint format, length, current_desktop = 0;
1461
1518
    guchar *data;
1462
1519
 
1463
 
#if GDK_MULTIHEAD_SAFE
 
1520
#if GTK_CHECK_VERSION(2, 2, 0)
1464
1521
    if (_current_screen)
1465
1522
        root_window = gdk_screen_get_root_window (_current_screen);
1466
1523
#endif
1495
1552
    }
1496
1553
}
1497
1554
 
1498
 
#if GDK_MULTIHEAD_SAFE
 
1555
#if GTK_CHECK_VERSION(2, 2, 0)
1499
1556
static void
1500
1557
ui_switch_screen (GdkScreen *screen)
1501
1558
{
1652
1709
                 bool            show_icon_only,
1653
1710
                 bool            force_icon)
1654
1711
{
 
1712
#if GTK_CHECK_VERSION(3, 2, 0)
 
1713
    GtkWidget * hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
 
1714
#else
1655
1715
    GtkWidget * hbox = gtk_hbox_new (FALSE, 0);
 
1716
#endif
1656
1717
    GtkWidget * label = gtk_label_new (name.c_str ());
1657
1718
 
1658
1719
    gint width, height;
2406
2467
 
2407
2468
    gtk_label_set_text (GTK_LABEL (_help_area), help.c_str ());
2408
2469
 
 
2470
#if GTK_CHECK_VERSION(3, 0, 0)
 
2471
    gtk_widget_get_preferred_size (_help_area, &size, NULL);
 
2472
#else
2409
2473
    gtk_widget_size_request (_help_area, &size);
 
2474
#endif
2410
2475
 
2411
2476
    if (size.width > ui_screen_width ()/2) {
2412
2477
        size.width = ui_screen_width ()/2;
2588
2653
    GtkWidget *submenu = (GtkWidget *) g_object_get_data (G_OBJECT (widget), "property_submenu");
2589
2654
 
2590
2655
    if (submenu) {
2591
 
#if GDK_MULTIHEAD_SAFE
 
2656
#if GTK_CHECK_VERSION(2, 2, 0)
2592
2657
        if (_current_screen)
2593
2658
            gtk_menu_set_screen (GTK_MENU (submenu), _current_screen);
2594
2659
#endif
2665
2730
 
2666
2731
    _command_menu = gtk_menu_new ();
2667
2732
 
2668
 
#if GDK_MULTIHEAD_SAFE
 
2733
#if GTK_CHECK_VERSION(2, 2, 0)
2669
2734
    if (_current_screen)
2670
2735
        gtk_menu_set_screen (GTK_MENU (_command_menu), _current_screen);
2671
2736
#endif
2963
3028
static void
2964
3029
slot_update_screen (int num)
2965
3030
{
2966
 
#if GDK_MULTIHEAD_SAFE
 
3031
#if GTK_CHECK_VERSION(2, 2, 0)
2967
3032
    if (gdk_display_get_n_screens (gdk_display_get_default ()) > num) {
2968
3033
 
2969
3034
        GdkScreen *screen = gdk_display_get_screen (gdk_display_get_default (), num);
3102
3167
 
3103
3168
        _factory_menu = gtk_menu_new ();
3104
3169
 
3105
 
#if GDK_MULTIHEAD_SAFE
 
3170
#if GTK_CHECK_VERSION(2, 2, 0)
3106
3171
    if (_current_screen)
3107
3172
        gtk_menu_set_screen (GTK_MENU (_factory_menu), _current_screen);
3108
3173
#endif
3399
3464
                scim_string_view_set_text (SCIM_STRING_VIEW (_lookup_table_items [0]),
3400
3465
                                           mbs.c_str ());
3401
3466
 
 
3467
#if GTK_CHECK_VERSION(3, 0, 0)
 
3468
                gtk_widget_get_preferred_size (_lookup_table_window, &size, NULL);
 
3469
#else
3402
3470
                gtk_widget_size_request (_lookup_table_window, &size);
 
3471
#endif
3403
3472
 
3404
3473
                if (size.width >= ui_screen_width () / 3 && !table.is_page_size_fixed ()) {
3405
3474
                    item_num = i+1;
3634
3703
 
3635
3704
    if (begin == end) return;
3636
3705
 
 
3706
#if GTK_CHECK_VERSION(3, 2, 0)
 
3707
    root = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
 
3708
#else
3637
3709
    root = gtk_hbox_new (FALSE, 0);
 
3710
#endif
3638
3711
 
3639
3712
    it = begin;
3640
3713
    next = begin + 1;
3698
3771
        _frontend_property_repository.clear ();
3699
3772
 
3700
3773
        if (properties.size ()) {
 
3774
#if GTK_CHECK_VERSION(3, 2, 0)
 
3775
            _frontend_properties_area = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
 
3776
#else
3701
3777
            _frontend_properties_area = gtk_hbox_new (FALSE, 0);
 
3778
#endif
3702
3779
 
3703
3780
            create_properties (_frontend_properties_area,
3704
3781
                               _frontend_property_repository,
3737
3814
    it->second.holder = 0;
3738
3815
 
3739
3816
    if (properties.size ()) {
 
3817
#if GTK_CHECK_VERSION(3, 2, 0)
 
3818
        it->second.holder = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
 
3819
#else
3740
3820
        it->second.holder = gtk_hbox_new (FALSE, 0);
 
3821
#endif
3741
3822
 
3742
3823
        create_properties (it->second.holder,
3743
3824
                           it->second.repository,
4070
4151
 
4071
4152
    // get current display.
4072
4153
    {
4073
 
#if GDK_MULTIHEAD_SAFE
 
4154
#if GTK_CHECK_VERSION(2, 2, 0)
4074
4155
        const char *p = gdk_display_get_name (gdk_display_get_default ());
4075
4156
#else
4076
4157
        const char *p = getenv ("DISPLAY");