- Timestamp:
- 05/12/11 11:50:35 (6 months ago)
- Location:
- trunk/WINDOW
- Files:
-
- 4 modified
-
AW_nawar.cxx (modified) (1 diff)
-
AW_window.cxx (modified) (7 diffs)
-
aw_nawar.hxx (modified) (1 diff)
-
aw_window_Xm.hxx (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/WINDOW/AW_nawar.cxx
r8103 r8278 619 619 error = GB_push_transaction(gb_main); 620 620 if (!error) { 621 aw_update_a war_window_geometry(this);621 aw_update_all_window_geometry_awars(this); 622 622 error = GB_pop_transaction(gb_main); 623 623 if (!error) error = GB_save_in_arbprop(gb_main, filename, "a"); -
trunk/WINDOW/AW_window.cxx
r8271 r8278 601 601 #define aw_awar_name_height(aww) aw_size_awar_name((aww), "height") 602 602 603 static void aw_calculate_WM_offsets(AW_window *aww) { 604 if (p_aww(aww)->WM_top_offset == AW_FIX_POS_ON_EXPOSE) { // very bad hack continued 605 // get last position stored in properties 606 AW_root *root = aww->get_root(); 607 int oposx = root->awar(aw_awar_name_posx(aww))->read_int(); 608 int oposy = root->awar(aw_awar_name_posy(aww))->read_int(); 609 610 // get current window position 611 short posy, posx; 612 AW_window_Motif *motif = p_aww(aww); 613 XtVaGetValues(motif->shell, XmNx, &posx, XmNy, &posy, NULL); 614 615 // calculate offset 616 motif->WM_top_offset = posy-oposy; 617 motif->WM_left_offset = posx-oposx; 618 619 #if defined(DEBUG) && 0 620 printf("aw_calculate_WM_offsets: WM_left_offset=%i WM_top_offset=%i\n", motif->WM_left_offset, motif->WM_top_offset); 621 #endif // DEBUG 622 } 623 624 #if defined(DEBUG) && 0 625 { 626 short posx, posy; 627 AW_window_Motif *motif = p_aww(aww); 628 XtVaGetValues(motif->shell, XmNx, &posx, XmNy, &posy, NULL); 629 printf("[expose] Position reported by motif: %i/%i\n", posx, posy); 630 } 631 #endif // DEBUG 603 static void aw_onExpose_calc_WM_offsets(AW_window *aww) { 604 if (p_aww(aww)->WM_top_offset != AW_CALC_OFFSET_ON_EXPOSE) return; // @@@ remove me when using called-once-expose-callbacks 605 aw_assert(p_aww(aww)->WM_top_offset == AW_CALC_OFFSET_ON_EXPOSE); 606 607 // get last position stored in properties 608 AW_root *root = aww->get_root(); 609 int oposx = root->awar(aw_awar_name_posx(aww))->read_int(); 610 int oposy = root->awar(aw_awar_name_posy(aww))->read_int(); 611 612 AW_window_Motif *motif = p_aww(aww); 613 614 int posx, posy; 615 aww->get_window_pos(posx, posy); 616 617 if (posx == 0 && posy == 0) { // oops - motif has no idea where the window has been placed 618 // assume positions stored in awars are correct and use them. 619 // This works around problems with unclickable GUI-elements when running on 'Unity' 620 aww->set_window_pos(oposx, oposy); 621 posx = oposx; 622 posy = oposy; 623 } 624 625 // calculate offset 626 motif->WM_top_offset = posy-oposy; 627 motif->WM_left_offset = posx-oposx; 628 } 629 630 static void aw_onExpose_setPosFromAwars(AW_window *aww) { 631 AW_root *root = aww->get_root(); 632 int oposx = root->awar(aw_awar_name_posx(aww))->read_int(); 633 int oposy = root->awar(aw_awar_name_posy(aww))->read_int(); 634 635 aww->set_window_pos(oposx, oposy); 632 636 } 633 637 … … 1681 1685 } 1682 1686 1683 static long aw_loop_get_window_geometry(const char *, long val, void *) { 1684 AW_window *aww = (AW_window *)val; 1685 short posx, posy; 1686 1687 void aw_update_window_geometry_awars(AW_window *aww) { 1687 1688 AW_root *root = aww->get_root(); 1689 1690 short posx, posy; 1688 1691 unsigned short width, height, borderwidth; 1689 1690 1692 XtVaGetValues(p_aww(aww)->shell, // bad hack 1691 1693 XmNborderWidth, &borderwidth, … … 1696 1698 NULL); 1697 1699 1698 if (p_aww(aww)->WM_top_offset != AW_ FIX_POS_ON_EXPOSE) {1700 if (p_aww(aww)->WM_top_offset != AW_CALC_OFFSET_ON_EXPOSE) { 1699 1701 posy -= p_aww(aww)->WM_top_offset; 1700 1702 } 1701 posx -= p_aww(aww)->WM_left_offset; 1703 posx -= p_aww(aww)->WM_left_offset; // why is this not handled like posy? 1702 1704 1703 1705 if (posx<0) posx = 0; … … 1708 1710 root->awar(aw_awar_name_posx (aww))->write_int(posx); 1709 1711 root->awar(aw_awar_name_posy (aww))->write_int(posy); 1710 1712 } 1713 1714 static long aw_loop_get_window_geometry(const char *, long val, void *) { 1715 aw_update_window_geometry_awars((AW_window *)val); 1711 1716 return val; 1712 1717 } 1713 1718 1714 void aw_update_a war_window_geometry(AW_root *awr) {1719 void aw_update_all_window_geometry_awars(AW_root *awr) { 1715 1720 GBS_hash_do_loop(awr->hash_for_windows, aw_loop_get_window_geometry, NULL); 1716 1721 } … … 1952 1957 } 1953 1958 XtRealizeWidget(p_aww(aww)->shell); 1954 p_aww(aww)->WM_top_offset = AW_ FIX_POS_ON_EXPOSE;1959 p_aww(aww)->WM_top_offset = AW_CALC_OFFSET_ON_EXPOSE; 1955 1960 } 1956 1961 … … 3180 3185 } 3181 3186 3182 if (setPos) { 3183 int currx, curry; 3184 get_window_pos(currx, curry); 3185 if (currx != posx || curry != posy) { 3186 #if defined(DEBUG) && 0 3187 printf("force position at show_internal: %i/%i\n", posx, posy); 3188 #endif // DEBUG 3189 set_window_pos(posx, posy); 3190 } 3191 } 3187 if (setPos) set_window_pos(posx, posy); // @@@ try if it's better to set this via aw_onExpose_setPosFromAwars 3192 3188 } 3193 3189 3194 3190 XtPopup(p_w->shell, grab); 3195 if (p_w->WM_top_offset == AW_FIX_POS_ON_EXPOSE) { // very bad hack 3196 set_expose_callback(AW_INFO_AREA, (AW_CB)aw_calculate_WM_offsets, 0, 0); 3191 if (p_w->WM_top_offset == AW_CALC_OFFSET_ON_EXPOSE) { // very bad hack 3192 set_expose_callback(AW_INFO_AREA, (AW_CB)aw_onExpose_calc_WM_offsets, 0, 0); // @@@ should be removed after it was called once 3193 } 3194 else if (recalc_pos_at_show == AW_KEEP_POS) { 3195 set_expose_callback(AW_INFO_AREA, (AW_CB)aw_onExpose_setPosFromAwars, 0, 0); // @@@ should be removed after it was called once 3197 3196 } 3198 3197 } … … 3210 3209 void AW_window::hide() { 3211 3210 if (window_is_shown) { 3211 aw_update_window_geometry_awars(this); 3212 3212 if (hide_cb) hide_cb(this); 3213 3213 get_root()->window_hide(); -
trunk/WINDOW/aw_nawar.hxx
r7623 r8278 92 92 }; 93 93 94 void aw_update_awar_window_geometry(AW_root *awr); 94 void aw_update_window_geometry_awars(AW_window *aww); // one window 95 void aw_update_all_window_geometry_awars(AW_root *awr); // all windows 95 96 96 97 #else -
trunk/WINDOW/aw_window_Xm.hxx
r7669 r8278 272 272 273 273 const int AW_NUMBER_OF_F_KEYS = 20; 274 #define AW_ FIX_POS_ON_EXPOSE -12345274 #define AW_CALC_OFFSET_ON_EXPOSE -12345 275 275 276 276 class AW_window_Motif : virtual Noncopyable {
