aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llwindow
diff options
context:
space:
mode:
authorJacek Antonelli2009-08-29 17:44:38 -0500
committerJacek Antonelli2009-08-29 22:49:51 -0500
commit6a5aab98892df74f60743f5b789959c9593d6647 (patch)
tree62da18f8540879ed01e12eeb0ce49375474272e4 /linden/indra/llwindow
parentMerge branch 'mac-openal-url' into next (diff)
parentConverted 1.23 XUI files to unix line endings. (diff)
downloadmeta-impy-6a5aab98892df74f60743f5b789959c9593d6647.zip
meta-impy-6a5aab98892df74f60743f5b789959c9593d6647.tar.gz
meta-impy-6a5aab98892df74f60743f5b789959c9593d6647.tar.bz2
meta-impy-6a5aab98892df74f60743f5b789959c9593d6647.tar.xz
Merged SL 1.23.4 into Imprudence.
Conflicts: linden/doc/contributions.txt linden/indra/CMakeLists.txt linden/indra/cmake/APR.cmake linden/indra/cmake/CopyWinLibs.cmake linden/indra/cmake/OPENAL.cmake linden/indra/develop.py linden/indra/llaudio/audioengine.cpp linden/indra/llcommon/indra_constants.h linden/indra/llcommon/llversionviewer.h linden/indra/llcrashlogger/llcrashlogger.cpp linden/indra/llmedia/llmediaimplgstreamer.cpp linden/indra/llmedia/llmediaimplgstreamer.h linden/indra/llmedia/llmediaimplgstreamer_syms.cpp linden/indra/llmedia/llmediaimplgstreamer_syms.h linden/indra/llmedia/llmediaimplgstreamer_syms_raw.inc linden/indra/llmedia/llmediamanager.cpp linden/indra/llmessage/llassetstorage.cpp linden/indra/llui/lltexteditor.cpp linden/indra/llvfs/lldir.cpp linden/indra/newview/CMakeLists.txt linden/indra/newview/English.lproj/InfoPlist.strings linden/indra/newview/Info-Imprudence.plist linden/indra/newview/app_settings/logcontrol.xml linden/indra/newview/app_settings/settings.xml linden/indra/newview/installers/windows/installer_template.nsi linden/indra/newview/llagent.cpp linden/indra/newview/llappviewer.cpp linden/indra/newview/llcallingcard.cpp linden/indra/newview/llfilepicker.cpp linden/indra/newview/llfloateractivespeakers.cpp linden/indra/newview/llfloateravatarpicker.cpp linden/indra/newview/llfloaterbulkpermission.cpp linden/indra/newview/llfloaterbulkpermission.h linden/indra/newview/llfloaterchat.cpp linden/indra/newview/llfloatergodtools.cpp linden/indra/newview/llfloaterhtmlhelp.cpp linden/indra/newview/llfloatertools.cpp linden/indra/newview/llfloatertools.h linden/indra/newview/llfloatertopobjects.cpp linden/indra/newview/llinventorybridge.cpp linden/indra/newview/llinventoryview.cpp linden/indra/newview/llnetmap.cpp linden/indra/newview/llnetmap.h linden/indra/newview/llpanelland.cpp linden/indra/newview/llpanellogin.cpp linden/indra/newview/llpanelobject.cpp linden/indra/newview/llprefsim.cpp linden/indra/newview/lltexturecache.cpp linden/indra/newview/lltoolbrush.cpp linden/indra/newview/llvieweraudio.cpp linden/indra/newview/llviewermenu.cpp linden/indra/newview/llviewermessage.cpp linden/indra/newview/llviewerparcelmedia.cpp linden/indra/newview/llvoavatar.cpp linden/indra/newview/llwebbrowserctrl.cpp linden/indra/newview/llworldmapview.cpp linden/indra/newview/pipeline.cpp linden/indra/newview/res/viewerRes.rc linden/indra/newview/skins/default/colors_base.xml linden/indra/newview/skins/default/xui/de/floater_active_speakers.xml linden/indra/newview/skins/default/xui/de/floater_instant_message_ad_hoc.xml linden/indra/newview/skins/default/xui/de/floater_instant_message_group.xml linden/indra/newview/skins/default/xui/de/floater_joystick.xml linden/indra/newview/skins/default/xui/de/floater_mute_object.xml linden/indra/newview/skins/default/xui/de/floater_sim_release_message.xml linden/indra/newview/skins/default/xui/de/panel_media_controls.xml linden/indra/newview/skins/default/xui/de/panel_preferences_voice.xml linden/indra/newview/skins/default/xui/de/strings.xml linden/indra/newview/skins/default/xui/de/teleport_strings.xml linden/indra/newview/skins/default/xui/en-us/alerts.xml linden/indra/newview/skins/default/xui/en-us/floater_about_land.xml linden/indra/newview/skins/default/xui/en-us/floater_avatar_picker.xml linden/indra/newview/skins/default/xui/en-us/floater_beacons.xml linden/indra/newview/skins/default/xui/en-us/floater_bulk_perms.xml linden/indra/newview/skins/default/xui/en-us/floater_buy_land.xml linden/indra/newview/skins/default/xui/en-us/floater_chatterbox.xml linden/indra/newview/skins/default/xui/en-us/floater_inventory_view_finder.xml linden/indra/newview/skins/default/xui/en-us/floater_media_browser.xml linden/indra/newview/skins/default/xui/en-us/floater_mini_map.xml linden/indra/newview/skins/default/xui/en-us/floater_tools.xml linden/indra/newview/skins/default/xui/en-us/menu_login.xml linden/indra/newview/skins/default/xui/en-us/menu_mini_map.xml linden/indra/newview/skins/default/xui/en-us/menu_pie_attachment.xml linden/indra/newview/skins/default/xui/en-us/menu_pie_avatar.xml linden/indra/newview/skins/default/xui/en-us/menu_pie_object.xml linden/indra/newview/skins/default/xui/en-us/menu_pie_self.xml linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml linden/indra/newview/skins/default/xui/en-us/notify.xml linden/indra/newview/skins/default/xui/en-us/panel_bars.xml linden/indra/newview/skins/default/xui/en-us/panel_groups.xml linden/indra/newview/skins/default/xui/en-us/panel_media_controls.xml linden/indra/newview/skins/default/xui/en-us/panel_mini_map.xml linden/indra/newview/skins/default/xui/en-us/panel_preferences_im.xml linden/indra/newview/skins/default/xui/en-us/panel_preferences_input.xml linden/indra/newview/skins/default/xui/en-us/panel_preferences_voice.xml linden/indra/newview/skins/default/xui/en-us/strings.xml linden/indra/newview/skins/default/xui/es/alerts.xml linden/indra/newview/skins/default/xui/es/floater_about.xml linden/indra/newview/skins/default/xui/es/floater_about_land.xml linden/indra/newview/skins/default/xui/es/floater_animation_preview.xml linden/indra/newview/skins/default/xui/es/floater_auction.xml linden/indra/newview/skins/default/xui/es/floater_avatar_picker.xml linden/indra/newview/skins/default/xui/es/floater_avatar_textures.xml linden/indra/newview/skins/default/xui/es/floater_build_options.xml linden/indra/newview/skins/default/xui/es/floater_bumps.xml linden/indra/newview/skins/default/xui/es/floater_buy_contents.xml linden/indra/newview/skins/default/xui/es/floater_buy_currency.xml linden/indra/newview/skins/default/xui/es/floater_buy_land.xml linden/indra/newview/skins/default/xui/es/floater_buy_object.xml linden/indra/newview/skins/default/xui/es/floater_chat_history.xml linden/indra/newview/skins/default/xui/es/floater_choose_group.xml linden/indra/newview/skins/default/xui/es/floater_clothing.xml linden/indra/newview/skins/default/xui/es/floater_color_picker.xml linden/indra/newview/skins/default/xui/es/floater_critical.xml linden/indra/newview/skins/default/xui/es/floater_customize.xml linden/indra/newview/skins/default/xui/es/floater_directory.xml linden/indra/newview/skins/default/xui/es/floater_gesture.xml linden/indra/newview/skins/default/xui/es/floater_group_info.xml linden/indra/newview/skins/default/xui/es/floater_html.xml linden/indra/newview/skins/default/xui/es/floater_im.xml linden/indra/newview/skins/default/xui/es/floater_image_preview.xml linden/indra/newview/skins/default/xui/es/floater_import.xml linden/indra/newview/skins/default/xui/es/floater_instant_message.xml linden/indra/newview/skins/default/xui/es/floater_inventory.xml linden/indra/newview/skins/default/xui/es/floater_inventory_item_properties.xml linden/indra/newview/skins/default/xui/es/floater_inventory_view_finder.xml linden/indra/newview/skins/default/xui/es/floater_land_holdings.xml linden/indra/newview/skins/default/xui/es/floater_live_lsleditor.xml linden/indra/newview/skins/default/xui/es/floater_moveview.xml linden/indra/newview/skins/default/xui/es/floater_mute.xml linden/indra/newview/skins/default/xui/es/floater_name_description.xml linden/indra/newview/skins/default/xui/es/floater_new_im.xml linden/indra/newview/skins/default/xui/es/floater_new_outfit_dialog.xml linden/indra/newview/skins/default/xui/es/floater_openobject.xml linden/indra/newview/skins/default/xui/es/floater_pay.xml linden/indra/newview/skins/default/xui/es/floater_pay_object.xml linden/indra/newview/skins/default/xui/es/floater_postcard.xml linden/indra/newview/skins/default/xui/es/floater_preferences.xml linden/indra/newview/skins/default/xui/es/floater_preview_animation.xml linden/indra/newview/skins/default/xui/es/floater_preview_embedded_texture.xml linden/indra/newview/skins/default/xui/es/floater_preview_gesture.xml linden/indra/newview/skins/default/xui/es/floater_preview_notecard.xml linden/indra/newview/skins/default/xui/es/floater_preview_notecard_keep_discard.xml linden/indra/newview/skins/default/xui/es/floater_preview_sound.xml linden/indra/newview/skins/default/xui/es/floater_preview_texture.xml linden/indra/newview/skins/default/xui/es/floater_preview_texture_keep_discard.xml linden/indra/newview/skins/default/xui/es/floater_price_for_listing.xml linden/indra/newview/skins/default/xui/es/floater_profile.xml linden/indra/newview/skins/default/xui/es/floater_report_abuse.xml linden/indra/newview/skins/default/xui/es/floater_script_debug.xml linden/indra/newview/skins/default/xui/es/floater_script_ed_panel.xml linden/indra/newview/skins/default/xui/es/floater_script_preview.xml linden/indra/newview/skins/default/xui/es/floater_script_queue.xml linden/indra/newview/skins/default/xui/es/floater_script_search.xml linden/indra/newview/skins/default/xui/es/floater_sell_land.xml linden/indra/newview/skins/default/xui/es/floater_settings_debug.xml linden/indra/newview/skins/default/xui/es/floater_snapshot.xml linden/indra/newview/skins/default/xui/es/floater_sound_preview.xml linden/indra/newview/skins/default/xui/es/floater_telehub.xml linden/indra/newview/skins/default/xui/es/floater_texture_ctrl.xml linden/indra/newview/skins/default/xui/es/floater_tools.xml linden/indra/newview/skins/default/xui/es/floater_top_objects.xml linden/indra/newview/skins/default/xui/es/floater_tos.xml linden/indra/newview/skins/default/xui/es/floater_wearable_save_as.xml linden/indra/newview/skins/default/xui/es/floater_world_map.xml linden/indra/newview/skins/default/xui/es/menu_inventory.xml linden/indra/newview/skins/default/xui/es/menu_pie_attachment.xml linden/indra/newview/skins/default/xui/es/menu_pie_avatar.xml linden/indra/newview/skins/default/xui/es/menu_pie_land.xml linden/indra/newview/skins/default/xui/es/menu_pie_object.xml linden/indra/newview/skins/default/xui/es/menu_pie_self.xml linden/indra/newview/skins/default/xui/es/menu_viewer.xml linden/indra/newview/skins/default/xui/es/notify.xml linden/indra/newview/skins/default/xui/es/panel_avatar.xml linden/indra/newview/skins/default/xui/es/panel_avatar_classified.xml linden/indra/newview/skins/default/xui/es/panel_avatar_pick.xml linden/indra/newview/skins/default/xui/es/panel_chat_bar.xml linden/indra/newview/skins/default/xui/es/panel_classified.xml linden/indra/newview/skins/default/xui/es/panel_event.xml linden/indra/newview/skins/default/xui/es/panel_group.xml linden/indra/newview/skins/default/xui/es/panel_group_finder.xml linden/indra/newview/skins/default/xui/es/panel_group_general.xml linden/indra/newview/skins/default/xui/es/panel_group_invite.xml linden/indra/newview/skins/default/xui/es/panel_group_land_money.xml linden/indra/newview/skins/default/xui/es/panel_group_notices.xml linden/indra/newview/skins/default/xui/es/panel_group_roles.xml linden/indra/newview/skins/default/xui/es/panel_group_voting.xml linden/indra/newview/skins/default/xui/es/panel_land_covenant.xml linden/indra/newview/skins/default/xui/es/panel_login.xml linden/indra/newview/skins/default/xui/es/panel_overlaybar.xml linden/indra/newview/skins/default/xui/es/panel_place.xml linden/indra/newview/skins/default/xui/es/panel_place_small.xml linden/indra/newview/skins/default/xui/es/panel_preferences_audio.xml linden/indra/newview/skins/default/xui/es/panel_preferences_chat.xml linden/indra/newview/skins/default/xui/es/panel_preferences_general.xml linden/indra/newview/skins/default/xui/es/panel_preferences_graphics1.xml linden/indra/newview/skins/default/xui/es/panel_preferences_im.xml linden/indra/newview/skins/default/xui/es/panel_preferences_input.xml linden/indra/newview/skins/default/xui/es/panel_preferences_network.xml linden/indra/newview/skins/default/xui/es/panel_preferences_popups.xml linden/indra/newview/skins/default/xui/es/panel_region_covenant.xml linden/indra/newview/skins/default/xui/es/panel_region_debug.xml linden/indra/newview/skins/default/xui/es/panel_region_estate.xml linden/indra/newview/skins/default/xui/es/panel_region_general.xml linden/indra/newview/skins/default/xui/es/panel_region_terrain.xml linden/indra/newview/skins/default/xui/es/panel_region_texture.xml linden/indra/newview/skins/default/xui/es/panel_scrolling_param.xml linden/indra/newview/skins/default/xui/es/panel_status_bar.xml linden/indra/newview/skins/default/xui/es/panel_toolbar.xml linden/indra/newview/skins/default/xui/es/panel_top_pick.xml linden/indra/newview/skins/default/xui/fr/alerts.xml linden/indra/newview/skins/default/xui/fr/floater_about.xml linden/indra/newview/skins/default/xui/fr/floater_about_land.xml linden/indra/newview/skins/default/xui/fr/floater_avatar_picker.xml linden/indra/newview/skins/default/xui/fr/floater_avatar_textures.xml linden/indra/newview/skins/default/xui/fr/floater_beacons.xml linden/indra/newview/skins/default/xui/fr/floater_buy_contents.xml linden/indra/newview/skins/default/xui/fr/floater_buy_currency.xml linden/indra/newview/skins/default/xui/fr/floater_buy_land.xml linden/indra/newview/skins/default/xui/fr/floater_chat_history.xml linden/indra/newview/skins/default/xui/fr/floater_clothing.xml linden/indra/newview/skins/default/xui/fr/floater_customize.xml linden/indra/newview/skins/default/xui/fr/floater_directory.xml linden/indra/newview/skins/default/xui/fr/floater_god_tools.xml linden/indra/newview/skins/default/xui/fr/floater_group_info.xml linden/indra/newview/skins/default/xui/fr/floater_html.xml linden/indra/newview/skins/default/xui/fr/floater_im.xml linden/indra/newview/skins/default/xui/fr/floater_instant_message.xml linden/indra/newview/skins/default/xui/fr/floater_instant_message_group.xml linden/indra/newview/skins/default/xui/fr/floater_inventory.xml linden/indra/newview/skins/default/xui/fr/floater_inventory_view_finder.xml linden/indra/newview/skins/default/xui/fr/floater_joystick.xml linden/indra/newview/skins/default/xui/fr/floater_land_holdings.xml linden/indra/newview/skins/default/xui/fr/floater_live_lsleditor.xml linden/indra/newview/skins/default/xui/fr/floater_media_browser.xml linden/indra/newview/skins/default/xui/fr/floater_mem_leaking.xml linden/indra/newview/skins/default/xui/fr/floater_name_description.xml linden/indra/newview/skins/default/xui/fr/floater_preview_gesture.xml linden/indra/newview/skins/default/xui/fr/floater_profile.xml linden/indra/newview/skins/default/xui/fr/floater_report_abuse.xml linden/indra/newview/skins/default/xui/fr/floater_script_search.xml linden/indra/newview/skins/default/xui/fr/floater_sell_land.xml linden/indra/newview/skins/default/xui/fr/floater_snapshot.xml linden/indra/newview/skins/default/xui/fr/floater_sound_preview.xml linden/indra/newview/skins/default/xui/fr/floater_tools.xml linden/indra/newview/skins/default/xui/fr/floater_top_objects.xml linden/indra/newview/skins/default/xui/fr/floater_world_map.xml linden/indra/newview/skins/default/xui/fr/menu_inventory.xml linden/indra/newview/skins/default/xui/fr/menu_login.xml linden/indra/newview/skins/default/xui/fr/menu_pie_attachment.xml linden/indra/newview/skins/default/xui/fr/menu_pie_avatar.xml linden/indra/newview/skins/default/xui/fr/menu_pie_object.xml linden/indra/newview/skins/default/xui/fr/menu_viewer.xml linden/indra/newview/skins/default/xui/fr/notify.xml linden/indra/newview/skins/default/xui/fr/panel_audio.xml linden/indra/newview/skins/default/xui/fr/panel_avatar.xml linden/indra/newview/skins/default/xui/fr/panel_avatar_classified.xml linden/indra/newview/skins/default/xui/fr/panel_classified.xml linden/indra/newview/skins/default/xui/fr/panel_event.xml linden/indra/newview/skins/default/xui/fr/panel_friends.xml linden/indra/newview/skins/default/xui/fr/panel_group_general.xml linden/indra/newview/skins/default/xui/fr/panel_group_invite.xml linden/indra/newview/skins/default/xui/fr/panel_group_land_money.xml linden/indra/newview/skins/default/xui/fr/panel_group_roles.xml linden/indra/newview/skins/default/xui/fr/panel_login.xml linden/indra/newview/skins/default/xui/fr/panel_media_controls.xml linden/indra/newview/skins/default/xui/fr/panel_media_remote_expanded.xml linden/indra/newview/skins/default/xui/fr/panel_overlaybar.xml linden/indra/newview/skins/default/xui/fr/panel_place.xml linden/indra/newview/skins/default/xui/fr/panel_place_small.xml linden/indra/newview/skins/default/xui/fr/panel_preferences_audio.xml linden/indra/newview/skins/default/xui/fr/panel_preferences_general.xml linden/indra/newview/skins/default/xui/fr/panel_preferences_im.xml linden/indra/newview/skins/default/xui/fr/panel_preferences_input.xml linden/indra/newview/skins/default/xui/fr/panel_preferences_network.xml linden/indra/newview/skins/default/xui/fr/panel_preferences_voice.xml linden/indra/newview/skins/default/xui/fr/panel_region_covenant.xml linden/indra/newview/skins/default/xui/fr/panel_region_debug.xml linden/indra/newview/skins/default/xui/fr/panel_region_general.xml linden/indra/newview/skins/default/xui/fr/panel_voice_controls.xml linden/indra/newview/skins/default/xui/fr/role_actions.xml linden/indra/newview/skins/default/xui/fr/strings.xml linden/indra/newview/skins/default/xui/fr/teleport_strings.xml linden/indra/newview/skins/default/xui/ja/floater_active_speakers.xml linden/indra/newview/skins/default/xui/ja/floater_html.xml linden/indra/newview/skins/default/xui/ja/floater_instant_message_ad_hoc.xml linden/indra/newview/skins/default/xui/ja/floater_instant_message_group.xml linden/indra/newview/skins/default/xui/ja/floater_joystick.xml linden/indra/newview/skins/default/xui/ja/floater_media_browser.xml linden/indra/newview/skins/default/xui/ja/floater_windlight_options.xml linden/indra/newview/skins/default/xui/ja/menu_login.xml linden/indra/newview/skins/default/xui/ja/panel_friends.xml linden/indra/newview/skins/default/xui/ja/panel_media_controls.xml linden/indra/newview/skins/default/xui/ja/panel_media_remote_expanded.xml linden/indra/newview/skins/default/xui/ja/panel_preferences_voice.xml linden/indra/newview/skins/default/xui/ja/panel_speaker_controls.xml linden/indra/newview/skins/default/xui/ja/strings.xml linden/indra/newview/skins/default/xui/ja/teleport_strings.xml linden/indra/newview/skins/default/xui/ko/panel_media_controls.xml linden/indra/newview/skins/default/xui/pt/alerts.xml linden/indra/newview/skins/default/xui/pt/floater_about.xml linden/indra/newview/skins/default/xui/pt/floater_about_land.xml linden/indra/newview/skins/default/xui/pt/floater_active_speakers.xml linden/indra/newview/skins/default/xui/pt/floater_animation_preview.xml linden/indra/newview/skins/default/xui/pt/floater_auction.xml linden/indra/newview/skins/default/xui/pt/floater_avatar_picker.xml linden/indra/newview/skins/default/xui/pt/floater_avatar_textures.xml linden/indra/newview/skins/default/xui/pt/floater_beacons.xml linden/indra/newview/skins/default/xui/pt/floater_build_options.xml linden/indra/newview/skins/default/xui/pt/floater_bumps.xml linden/indra/newview/skins/default/xui/pt/floater_buy_contents.xml linden/indra/newview/skins/default/xui/pt/floater_buy_currency.xml linden/indra/newview/skins/default/xui/pt/floater_buy_land.xml linden/indra/newview/skins/default/xui/pt/floater_buy_object.xml linden/indra/newview/skins/default/xui/pt/floater_chat_history.xml linden/indra/newview/skins/default/xui/pt/floater_clothing.xml linden/indra/newview/skins/default/xui/pt/floater_color_picker.xml linden/indra/newview/skins/default/xui/pt/floater_critical.xml linden/indra/newview/skins/default/xui/pt/floater_customize.xml linden/indra/newview/skins/default/xui/pt/floater_day_cycle_options.xml linden/indra/newview/skins/default/xui/pt/floater_directory.xml linden/indra/newview/skins/default/xui/pt/floater_env_settings.xml linden/indra/newview/skins/default/xui/pt/floater_gesture.xml linden/indra/newview/skins/default/xui/pt/floater_god_tools.xml linden/indra/newview/skins/default/xui/pt/floater_group_info.xml linden/indra/newview/skins/default/xui/pt/floater_im.xml linden/indra/newview/skins/default/xui/pt/floater_image_preview.xml linden/indra/newview/skins/default/xui/pt/floater_inspect.xml linden/indra/newview/skins/default/xui/pt/floater_instant_message.xml linden/indra/newview/skins/default/xui/pt/floater_instant_message_ad_hoc.xml linden/indra/newview/skins/default/xui/pt/floater_instant_message_group.xml linden/indra/newview/skins/default/xui/pt/floater_inventory.xml linden/indra/newview/skins/default/xui/pt/floater_inventory_item_properties.xml linden/indra/newview/skins/default/xui/pt/floater_inventory_view_finder.xml linden/indra/newview/skins/default/xui/pt/floater_joystick.xml linden/indra/newview/skins/default/xui/pt/floater_lagmeter.xml linden/indra/newview/skins/default/xui/pt/floater_land_holdings.xml linden/indra/newview/skins/default/xui/pt/floater_landmark_ctrl.xml linden/indra/newview/skins/default/xui/pt/floater_live_lsleditor.xml linden/indra/newview/skins/default/xui/pt/floater_lsl_guide.xml linden/indra/newview/skins/default/xui/pt/floater_media_browser.xml linden/indra/newview/skins/default/xui/pt/floater_moveview.xml linden/indra/newview/skins/default/xui/pt/floater_mute.xml linden/indra/newview/skins/default/xui/pt/floater_mute_object.xml linden/indra/newview/skins/default/xui/pt/floater_name_description.xml linden/indra/newview/skins/default/xui/pt/floater_new_outfit_dialog.xml linden/indra/newview/skins/default/xui/pt/floater_openobject.xml linden/indra/newview/skins/default/xui/pt/floater_pay.xml linden/indra/newview/skins/default/xui/pt/floater_postcard.xml linden/indra/newview/skins/default/xui/pt/floater_preferences.xml linden/indra/newview/skins/default/xui/pt/floater_preview_animation.xml linden/indra/newview/skins/default/xui/pt/floater_preview_classified.xml linden/indra/newview/skins/default/xui/pt/floater_preview_event.xml linden/indra/newview/skins/default/xui/pt/floater_preview_gesture.xml linden/indra/newview/skins/default/xui/pt/floater_preview_notecard_keep_discard.xml linden/indra/newview/skins/default/xui/pt/floater_preview_sound.xml linden/indra/newview/skins/default/xui/pt/floater_preview_url.xml linden/indra/newview/skins/default/xui/pt/floater_price_for_listing.xml linden/indra/newview/skins/default/xui/pt/floater_profile.xml linden/indra/newview/skins/default/xui/pt/floater_report_abuse.xml linden/indra/newview/skins/default/xui/pt/floater_script_debug.xml linden/indra/newview/skins/default/xui/pt/floater_script_queue.xml linden/indra/newview/skins/default/xui/pt/floater_script_search.xml linden/indra/newview/skins/default/xui/pt/floater_sell_land.xml linden/indra/newview/skins/default/xui/pt/floater_settings_debug.xml linden/indra/newview/skins/default/xui/pt/floater_sim_release_message.xml linden/indra/newview/skins/default/xui/pt/floater_snapshot.xml linden/indra/newview/skins/default/xui/pt/floater_sound_preview.xml linden/indra/newview/skins/default/xui/pt/floater_telehub.xml linden/indra/newview/skins/default/xui/pt/floater_texture_ctrl.xml linden/indra/newview/skins/default/xui/pt/floater_tools.xml linden/indra/newview/skins/default/xui/pt/floater_top_objects.xml linden/indra/newview/skins/default/xui/pt/floater_tos.xml linden/indra/newview/skins/default/xui/pt/floater_url_entry.xml linden/indra/newview/skins/default/xui/pt/floater_water.xml linden/indra/newview/skins/default/xui/pt/floater_wearable_save_as.xml linden/indra/newview/skins/default/xui/pt/floater_windlight_options.xml linden/indra/newview/skins/default/xui/pt/floater_world_map.xml linden/indra/newview/skins/default/xui/pt/menu_inventory.xml linden/indra/newview/skins/default/xui/pt/menu_pie_attachment.xml linden/indra/newview/skins/default/xui/pt/menu_pie_avatar.xml linden/indra/newview/skins/default/xui/pt/menu_pie_land.xml linden/indra/newview/skins/default/xui/pt/menu_pie_object.xml linden/indra/newview/skins/default/xui/pt/menu_viewer.xml linden/indra/newview/skins/default/xui/pt/notify.xml linden/indra/newview/skins/default/xui/pt/panel_account_details.xml linden/indra/newview/skins/default/xui/pt/panel_account_planning.xml linden/indra/newview/skins/default/xui/pt/panel_account_transactions.xml linden/indra/newview/skins/default/xui/pt/panel_audio_device.xml linden/indra/newview/skins/default/xui/pt/panel_avatar.xml linden/indra/newview/skins/default/xui/pt/panel_avatar_classified.xml linden/indra/newview/skins/default/xui/pt/panel_avatar_pick.xml linden/indra/newview/skins/default/xui/pt/panel_chat_bar.xml linden/indra/newview/skins/default/xui/pt/panel_classified.xml linden/indra/newview/skins/default/xui/pt/panel_event.xml linden/indra/newview/skins/default/xui/pt/panel_friends.xml linden/indra/newview/skins/default/xui/pt/panel_group.xml linden/indra/newview/skins/default/xui/pt/panel_group_finder.xml linden/indra/newview/skins/default/xui/pt/panel_group_general.xml linden/indra/newview/skins/default/xui/pt/panel_group_invite.xml linden/indra/newview/skins/default/xui/pt/panel_group_land_money.xml linden/indra/newview/skins/default/xui/pt/panel_group_notices.xml linden/indra/newview/skins/default/xui/pt/panel_group_roles.xml linden/indra/newview/skins/default/xui/pt/panel_group_voting.xml linden/indra/newview/skins/default/xui/pt/panel_land_covenant.xml linden/indra/newview/skins/default/xui/pt/panel_login.xml linden/indra/newview/skins/default/xui/pt/panel_overlaybar.xml linden/indra/newview/skins/default/xui/pt/panel_place.xml linden/indra/newview/skins/default/xui/pt/panel_place_small.xml linden/indra/newview/skins/default/xui/pt/panel_preferences_audio.xml linden/indra/newview/skins/default/xui/pt/panel_preferences_chat.xml linden/indra/newview/skins/default/xui/pt/panel_preferences_general.xml linden/indra/newview/skins/default/xui/pt/panel_preferences_graphics1.xml linden/indra/newview/skins/default/xui/pt/panel_preferences_im.xml linden/indra/newview/skins/default/xui/pt/panel_preferences_input.xml linden/indra/newview/skins/default/xui/pt/panel_preferences_network.xml linden/indra/newview/skins/default/xui/pt/panel_preferences_popups.xml linden/indra/newview/skins/default/xui/pt/panel_preferences_voice.xml linden/indra/newview/skins/default/xui/pt/panel_preferences_web.xml linden/indra/newview/skins/default/xui/pt/panel_region_covenant.xml linden/indra/newview/skins/default/xui/pt/panel_region_debug.xml linden/indra/newview/skins/default/xui/pt/panel_region_estate.xml linden/indra/newview/skins/default/xui/pt/panel_region_general.xml linden/indra/newview/skins/default/xui/pt/panel_region_terrain.xml linden/indra/newview/skins/default/xui/pt/panel_region_texture.xml linden/indra/newview/skins/default/xui/pt/panel_scrolling_param.xml linden/indra/newview/skins/default/xui/pt/panel_speaker_controls.xml linden/indra/newview/skins/default/xui/pt/panel_status_bar.xml linden/indra/newview/skins/default/xui/pt/panel_toolbar.xml linden/indra/newview/skins/default/xui/pt/panel_top_pick.xml linden/indra/newview/skins/default/xui/pt/panel_voice_controls.xml linden/indra/newview/skins/default/xui/pt/panel_voice_enable.xml linden/indra/newview/skins/default/xui/pt/panel_voice_options.xml linden/indra/newview/skins/default/xui/pt/strings.xml linden/indra/newview/skins/default/xui/pt/teleport_strings.xml linden/indra/newview/skins/default/xui/zh/floater_env_settings.xml linden/indra/newview/skins/default/xui/zh/floater_instant_message_ad_hoc.xml linden/indra/newview/skins/default/xui/zh/floater_lagmeter.xml linden/indra/newview/skins/default/xui/zh/floater_landmark_ctrl.xml linden/indra/newview/skins/default/xui/zh/floater_post_process.xml linden/indra/newview/skins/default/xui/zh/floater_settings_debug.xml linden/indra/newview/skins/default/xui/zh/floater_windlight_options.xml linden/indra/newview/skins/default/xui/zh/menu_pie_attachment.xml linden/indra/newview/skins/default/xui/zh/menu_pie_avatar.xml linden/indra/newview/skins/default/xui/zh/menu_pie_land.xml linden/indra/newview/skins/default/xui/zh/menu_pie_object.xml linden/indra/newview/skins/default/xui/zh/menu_viewer.xml linden/indra/newview/skins/default/xui/zh/panel_avatar.xml linden/indra/newview/skins/default/xui/zh/panel_friends.xml linden/indra/newview/skins/default/xui/zh/panel_group_general.xml linden/indra/newview/skins/default/xui/zh/panel_group_invite.xml linden/indra/newview/skins/default/xui/zh/panel_group_land_money.xml linden/indra/newview/skins/default/xui/zh/panel_group_notices.xml linden/indra/newview/skins/default/xui/zh/panel_group_roles.xml linden/indra/newview/skins/default/xui/zh/panel_preferences_audio.xml linden/indra/newview/skins/default/xui/zh/panel_preferences_im.xml linden/indra/newview/skins/default/xui/zh/panel_region_covenant.xml linden/indra/newview/skins/default/xui/zh/panel_speaker_controls.xml linden/indra/newview/skins/default/xui/zh/panel_voice_options.xml linden/indra/newview/skins/default/xui/zh/strings.xml linden/indra/newview/skins/silver/colors_base.xml linden/indra/newview/skins/silver/xui/en-us/floater_about_land.xml linden/indra/newview/skins/silver/xui/en-us/floater_directory.xml linden/indra/newview/skins/silver/xui/en-us/floater_tools.xml linden/indra/newview/skins/silver/xui/en-us/panel_media_controls.xml linden/indra/newview/viewer_manifest.py linden/install.xml
Diffstat (limited to 'linden/indra/llwindow')
-rwxr-xr-xlinden/indra/llwindow/glh/glh_linear.h1621
-rw-r--r--linden/indra/llwindow/lldxhardware.cpp35
-rw-r--r--linden/indra/llwindow/lldxhardware.h3
-rw-r--r--linden/indra/llwindow/llkeyboard.cpp3
-rw-r--r--linden/indra/llwindow/llkeyboard.h3
-rw-r--r--linden/indra/llwindow/llkeyboardmacosx.cpp3
-rw-r--r--linden/indra/llwindow/llkeyboardmacosx.h3
-rw-r--r--linden/indra/llwindow/llkeyboardsdl.cpp3
-rw-r--r--linden/indra/llwindow/llkeyboardsdl.h3
-rw-r--r--linden/indra/llwindow/llkeyboardwin32.cpp3
-rw-r--r--linden/indra/llwindow/llkeyboardwin32.h3
-rw-r--r--linden/indra/llwindow/llmousehandler.h3
-rw-r--r--linden/indra/llwindow/llpreeditor.h3
-rw-r--r--linden/indra/llwindow/llwindow.cpp13
-rw-r--r--linden/indra/llwindow/llwindow.h48
-rw-r--r--linden/indra/llwindow/llwindowheadless.cpp3
-rw-r--r--linden/indra/llwindow/llwindowheadless.h3
-rw-r--r--linden/indra/llwindow/llwindowmacosx-objc.h3
-rw-r--r--linden/indra/llwindow/llwindowmacosx-objc.mm3
-rw-r--r--linden/indra/llwindow/llwindowmacosx.cpp14
-rw-r--r--linden/indra/llwindow/llwindowmacosx.h5
-rw-r--r--linden/indra/llwindow/llwindowmesaheadless.cpp3
-rw-r--r--linden/indra/llwindow/llwindowmesaheadless.h3
-rw-r--r--linden/indra/llwindow/llwindowsdl.cpp767
-rw-r--r--linden/indra/llwindow/llwindowsdl.h17
-rw-r--r--linden/indra/llwindow/llwindowwin32.cpp60
-rw-r--r--linden/indra/llwindow/llwindowwin32.h5
27 files changed, 1924 insertions, 712 deletions
diff --git a/linden/indra/llwindow/glh/glh_linear.h b/linden/indra/llwindow/glh/glh_linear.h
new file mode 100755
index 0000000..04ae1bd
--- /dev/null
+++ b/linden/indra/llwindow/glh/glh_linear.h
@@ -0,0 +1,1621 @@
1/*
2 glh - is a platform-indepenedent C++ OpenGL helper library
3
4
5 Copyright (c) 2000 Cass Everitt
6 Copyright (c) 2000 NVIDIA Corporation
7 All rights reserved.
8
9 Redistribution and use in source and binary forms, with or
10 without modification, are permitted provided that the following
11 conditions are met:
12
13 * Redistributions of source code must retain the above
14 copyright notice, this list of conditions and the following
15 disclaimer.
16
17 * Redistributions in binary form must reproduce the above
18 copyright notice, this list of conditions and the following
19 disclaimer in the documentation and/or other materials
20 provided with the distribution.
21
22 * The names of contributors to this software may not be used
23 to endorse or promote products derived from this software
24 without specific prior written permission.
25
26 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
29 FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
30 REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
31 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
32 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
33 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
34 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
36 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 POSSIBILITY OF SUCH DAMAGE.
38
39
40 Cass Everitt - cass@r3.nu
41*/
42
43/*
44glh_linear.h
45*/
46
47// Author: Cass W. Everitt
48
49#ifndef GLH_LINEAR_H
50#define GLH_LINEAR_H
51
52#include <memory.h>
53#include <math.h>
54#include <assert.h>
55
56// only supports float for now...
57#define GLH_REAL_IS_FLOAT
58
59#ifdef GLH_REAL_IS_FLOAT
60# define GLH_REAL float
61# define GLH_REAL_NAMESPACE ns_float
62#endif
63
64#define GLH_QUATERNION_NORMALIZATION_THRESHOLD 64
65
66#define GLH_RAD_TO_DEG GLH_REAL(57.2957795130823208767981548141052)
67#define GLH_DEG_TO_RAD GLH_REAL(0.0174532925199432957692369076848861)
68#define GLH_ZERO GLH_REAL(0.0)
69#define GLH_ONE GLH_REAL(1.0)
70#define GLH_TWO GLH_REAL(2.0)
71#define GLH_EPSILON GLH_REAL(10e-6)
72#define GLH_PI GLH_REAL(3.1415926535897932384626433832795)
73
74#define equivalent(a,b) (((a < b + GLH_EPSILON) && (a > b - GLH_EPSILON)) ? true : false)
75
76namespace glh
77{
78
79 inline GLH_REAL to_degrees(GLH_REAL radians) { return radians*GLH_RAD_TO_DEG; }
80 inline GLH_REAL to_radians(GLH_REAL degrees) { return degrees*GLH_DEG_TO_RAD; }
81
82 // forward declarations for friend template functions.
83 template <int N, class T> class vec;
84
85 // forward declarations for friend template functions.
86 template <int N, class T>
87 bool operator == ( const vec<N,T> & v1, const vec<N,T> & v2 );
88
89 // forward declarations for friend template functions.
90 template <int N, class T>
91 bool operator != ( const vec<N,T> & v1, const vec<N,T> & v2 );
92
93 template <int N, class T>
94 class vec
95 {
96 public:
97 int size() const { return N; }
98
99 vec(const T & t = T())
100 { for(int i = 0; i < N; i++) v[i] = t; }
101 vec(const T * tp)
102 { for(int i = 0; i < N; i++) v[i] = tp[i]; }
103
104 const T * get_value() const
105 { return v; }
106
107
108 T dot( const vec<N,T> & rhs ) const
109 {
110 T r = 0;
111 for(int i = 0; i < N; i++) r += v[i]*rhs.v[i];
112 return r;
113 }
114
115 T length() const
116 {
117 T r = 0;
118 for(int i = 0; i < N; i++) r += v[i]*v[i];
119 return T(sqrt(r));
120 }
121
122 T square_norm() const
123 {
124 T r = 0;
125 for(int i = 0; i < N; i++) r += v[i]*v[i];
126 return r;
127 }
128
129 void negate()
130 { for(int i = 0; i < N; i++) v[i] = -v[i]; }
131
132
133 T normalize()
134 {
135 T sum(0);
136 for(int i = 0; i < N; i++)
137 sum += v[i]*v[i];
138 sum = T(sqrt(sum));
139 if (sum > GLH_EPSILON)
140 for(int i = 0; i < N; i++)
141 v[i] /= sum;
142 return sum;
143 }
144
145
146 vec<N,T> & set_value( const T * rhs )
147 { for(int i = 0; i < N; i++) v[i] = rhs[i]; return *this; }
148
149 T & operator [] ( int i )
150 { return v[i]; }
151
152 const T & operator [] ( int i ) const
153 { return v[i]; }
154
155 vec<N,T> & operator *= ( T d )
156 { for(int i = 0; i < N; i++) v[i] *= d; return *this;}
157
158 vec<N,T> & operator *= ( const vec<N,T> & u )
159 { for(int i = 0; i < N; i++) v[i] *= u[i]; return *this;}
160
161 vec<N,T> & operator /= ( T d )
162 { if(d == 0) return *this; for(int i = 0; i < N; i++) v[i] /= d; return *this;}
163
164 vec<N,T> & operator += ( const vec<N,T> & u )
165 { for(int i = 0; i < N; i++) v[i] += u.v[i]; return *this;}
166
167 vec<N,T> & operator -= ( const vec<N,T> & u )
168 { for(int i = 0; i < N; i++) v[i] -= u.v[i]; return *this;}
169
170
171 vec<N,T> operator - () const
172 { vec<N,T> rv = v; rv.negate(); return rv; }
173
174 vec<N,T> operator + ( const vec<N,T> &v) const
175 { vec<N,T> rt(*this); return rt += v; }
176
177 vec<N,T> operator - ( const vec<N,T> &v) const
178 { vec<N,T> rt(*this); return rt -= v; }
179
180 vec<N,T> operator * ( T d) const
181 { vec<N,T> rt(*this); return rt *= d; }
182
183 friend bool operator == <> ( const vec<N,T> &v1, const vec<N,T> &v2 );
184 friend bool operator != <> ( const vec<N,T> &v1, const vec<N,T> &v2 );
185
186
187 //protected:
188 T v[N];
189 };
190
191
192
193 // vector friend operators
194
195 template <int N, class T> inline
196 vec<N,T> operator * ( const vec<N,T> & b, T d )
197 {
198 vec<N,T> rt(b);
199 return rt *= d;
200 }
201
202 template <int N, class T> inline
203 vec<N,T> operator * ( T d, const vec<N,T> & b )
204 { return b*d; }
205
206 template <int N, class T> inline
207 vec<N,T> operator * ( const vec<N,T> & b, const vec<N,T> & d )
208 {
209 vec<N,T> rt(b);
210 return rt *= d;
211 }
212
213 template <int N, class T> inline
214 vec<N,T> operator / ( const vec<N,T> & b, T d )
215 { vec<N,T> rt(b); return rt /= d; }
216
217 template <int N, class T> inline
218 vec<N,T> operator + ( const vec<N,T> & v1, const vec<N,T> & v2 )
219 { vec<N,T> rt(v1); return rt += v2; }
220
221 template <int N, class T> inline
222 vec<N,T> operator - ( const vec<N,T> & v1, const vec<N,T> & v2 )
223 { vec<N,T> rt(v1); return rt -= v2; }
224
225
226 template <int N, class T> inline
227 bool operator == ( const vec<N,T> & v1, const vec<N,T> & v2 )
228 {
229 for(int i = 0; i < N; i++)
230 if(v1.v[i] != v2.v[i])
231 return false;
232 return true;
233 }
234
235 template <int N, class T> inline
236 bool operator != ( const vec<N,T> & v1, const vec<N,T> & v2 )
237 { return !(v1 == v2); }
238
239
240 typedef vec<3,unsigned char> vec3ub;
241 typedef vec<4,unsigned char> vec4ub;
242
243
244
245
246
247 namespace GLH_REAL_NAMESPACE
248 {
249 typedef GLH_REAL real;
250
251 class line;
252 class plane;
253 class matrix4;
254 class quaternion;
255 typedef quaternion rotation;
256
257 class vec2 : public vec<2,real>
258 {
259 public:
260 vec2(const real & t = real()) : vec<2,real>(t)
261 {}
262 vec2(const vec<2,real> & t) : vec<2,real>(t)
263 {}
264 vec2(const real * tp) : vec<2,real>(tp)
265 {}
266
267 vec2(real x, real y )
268 { v[0] = x; v[1] = y; }
269
270 void get_value(real & x, real & y) const
271 { x = v[0]; y = v[1]; }
272
273 vec2 & set_value( const real & x, const real & y)
274 { v[0] = x; v[1] = y; return *this; }
275
276 };
277
278
279 class vec3 : public vec<3,real>
280 {
281 public:
282 vec3(const real & t = real()) : vec<3,real>(t)
283 {}
284 vec3(const vec<3,real> & t) : vec<3,real>(t)
285 {}
286 vec3(const real * tp) : vec<3,real>(tp)
287 {}
288
289 vec3(real x, real y, real z)
290 { v[0] = x; v[1] = y; v[2] = z; }
291
292 void get_value(real & x, real & y, real & z) const
293 { x = v[0]; y = v[1]; z = v[2]; }
294
295 vec3 cross( const vec3 &rhs ) const
296 {
297 vec3 rt;
298 rt.v[0] = v[1]*rhs.v[2]-v[2]*rhs.v[1];
299 rt.v[1] = v[2]*rhs.v[0]-v[0]*rhs.v[2];
300 rt.v[2] = v[0]*rhs.v[1]-v[1]*rhs.v[0];
301 return rt;
302 }
303
304 vec3 & set_value( const real & x, const real & y, const real & z)
305 { v[0] = x; v[1] = y; v[2] = z; return *this; }
306
307 };
308
309
310 class vec4 : public vec<4,real>
311 {
312 public:
313 vec4(const real & t = real()) : vec<4,real>(t)
314 {}
315 vec4(const vec<4,real> & t) : vec<4,real>(t)
316 {}
317
318 vec4(const vec<3,real> & t, real fourth)
319
320 { v[0] = t.v[0]; v[1] = t.v[1]; v[2] = t.v[2]; v[3] = fourth; }
321 vec4(const real * tp) : vec<4,real>(tp)
322 {}
323 vec4(real x, real y, real z, real w)
324 { v[0] = x; v[1] = y; v[2] = z; v[3] = w; }
325
326 void get_value(real & x, real & y, real & z, real & w) const
327 { x = v[0]; y = v[1]; z = v[2]; w = v[3]; }
328
329 vec4 & set_value( const real & x, const real & y, const real & z, const real & w)
330 { v[0] = x; v[1] = y; v[2] = z; v[3] = w; return *this; }
331 };
332
333 inline
334 vec3 homogenize(const vec4 & v)
335 {
336 vec3 rt;
337 assert(v.v[3] != GLH_ZERO);
338 rt.v[0] = v.v[0]/v.v[3];
339 rt.v[1] = v.v[1]/v.v[3];
340 rt.v[2] = v.v[2]/v.v[3];
341 return rt;
342 }
343
344
345
346 class line
347 {
348 public:
349
350 line()
351 { set_value(vec3(0,0,0),vec3(0,0,1)); }
352
353 line( const vec3 & p0, const vec3 &p1)
354 { set_value(p0,p1); }
355
356 void set_value( const vec3 &p0, const vec3 &p1)
357 {
358 position = p0;
359 direction = p1-p0;
360 direction.normalize();
361 }
362
363 bool get_closest_points(const line &line2,
364 vec3 &pointOnThis,
365 vec3 &pointOnThat)
366 {
367
368 // quick check to see if parallel -- if so, quit.
369 if(fabs(direction.dot(line2.direction)) == 1.0)
370 return 0;
371 line l2 = line2;
372
373 // Algorithm: Brian Jean
374 //
375 register real u;
376 register real v;
377 vec3 Vr = direction;
378 vec3 Vs = l2.direction;
379 register real Vr_Dot_Vs = Vr.dot(Vs);
380 register real detA = real(1.0 - (Vr_Dot_Vs * Vr_Dot_Vs));
381 vec3 C = l2.position - position;
382 register real C_Dot_Vr = C.dot(Vr);
383 register real C_Dot_Vs = C.dot(Vs);
384
385 u = (C_Dot_Vr - Vr_Dot_Vs * C_Dot_Vs)/detA;
386 v = (C_Dot_Vr * Vr_Dot_Vs - C_Dot_Vs)/detA;
387
388 pointOnThis = position;
389 pointOnThis += direction * u;
390 pointOnThat = l2.position;
391 pointOnThat += l2.direction * v;
392
393 return 1;
394 }
395
396 vec3 get_closest_point(const vec3 &point)
397 {
398 vec3 np = point - position;
399 vec3 rp = direction*direction.dot(np)+position;
400 return rp;
401 }
402
403 const vec3 & get_position() const {return position;}
404
405 const vec3 & get_direction() const {return direction;}
406
407 //protected:
408 vec3 position;
409 vec3 direction;
410 };
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440 // matrix
441
442
443 class matrix4
444 {
445
446 public:
447
448 matrix4() { make_identity(); }
449
450 matrix4( real r )
451 { set_value(r); }
452
453 matrix4( real * m )
454 { set_value(m); }
455
456 matrix4( real a00, real a01, real a02, real a03,
457 real a10, real a11, real a12, real a13,
458 real a20, real a21, real a22, real a23,
459 real a30, real a31, real a32, real a33 )
460 {
461 element(0,0) = a00;
462 element(0,1) = a01;
463 element(0,2) = a02;
464 element(0,3) = a03;
465
466 element(1,0) = a10;
467 element(1,1) = a11;
468 element(1,2) = a12;
469 element(1,3) = a13;
470
471 element(2,0) = a20;
472 element(2,1) = a21;
473 element(2,2) = a22;
474 element(2,3) = a23;
475
476 element(3,0) = a30;
477 element(3,1) = a31;
478 element(3,2) = a32;
479 element(3,3) = a33;
480 }
481
482
483 void get_value( real * mp ) const
484 {
485 int c = 0;
486 for(int j=0; j < 4; j++)
487 for(int i=0; i < 4; i++)
488 mp[c++] = element(i,j);
489 }
490
491
492 const real * get_value() const
493 { return m; }
494
495 void set_value( real * mp)
496 {
497 int c = 0;
498 for(int j=0; j < 4; j++)
499 for(int i=0; i < 4; i++)
500 element(i,j) = mp[c++];
501 }
502
503 void set_value( real r )
504 {
505 for(int i=0; i < 4; i++)
506 for(int j=0; j < 4; j++)
507 element(i,j) = r;
508 }
509
510 void make_identity()
511 {
512 element(0,0) = 1.0;
513 element(0,1) = 0.0;
514 element(0,2) = 0.0;
515 element(0,3) = 0.0;
516
517 element(1,0) = 0.0;
518 element(1,1) = 1.0;
519 element(1,2) = 0.0;
520 element(1,3) = 0.0;
521
522 element(2,0) = 0.0;
523 element(2,1) = 0.0;
524 element(2,2) = 1.0;
525 element(2,3) = 0.0;
526
527 element(3,0) = 0.0;
528 element(3,1) = 0.0;
529 element(3,2) = 0.0;
530 element(3,3) = 1.0;
531 }
532
533
534 static matrix4 identity()
535 {
536 static matrix4 mident (
537 1.0, 0.0, 0.0, 0.0,
538 0.0, 1.0, 0.0, 0.0,
539 0.0, 0.0, 1.0, 0.0,
540 0.0, 0.0, 0.0, 1.0 );
541 return mident;
542 }
543
544
545 void set_scale( real s )
546 {
547 element(0,0) = s;
548 element(1,1) = s;
549 element(2,2) = s;
550 }
551
552 void set_scale( const vec3 & s )
553 {
554 element(0,0) = s.v[0];
555 element(1,1) = s.v[1];
556 element(2,2) = s.v[2];
557 }
558
559
560 void set_translate( const vec3 & t )
561 {
562 element(0,3) = t.v[0];
563 element(1,3) = t.v[1];
564 element(2,3) = t.v[2];
565 }
566
567 void set_row(int r, const vec4 & t)
568 {
569 element(r,0) = t.v[0];
570 element(r,1) = t.v[1];
571 element(r,2) = t.v[2];
572 element(r,3) = t.v[3];
573 }
574
575 void set_column(int c, const vec4 & t)
576 {
577 element(0,c) = t.v[0];
578 element(1,c) = t.v[1];
579 element(2,c) = t.v[2];
580 element(3,c) = t.v[3];
581 }
582
583
584 void get_row(int r, vec4 & t) const
585 {
586 t.v[0] = element(r,0);
587 t.v[1] = element(r,1);
588 t.v[2] = element(r,2);
589 t.v[3] = element(r,3);
590 }
591
592 vec4 get_row(int r) const
593 {
594 vec4 v; get_row(r, v);
595 return v;
596 }
597
598 void get_column(int c, vec4 & t) const
599 {
600 t.v[0] = element(0,c);
601 t.v[1] = element(1,c);
602 t.v[2] = element(2,c);
603 t.v[3] = element(3,c);
604 }
605
606 vec4 get_column(int c) const
607 {
608 vec4 v; get_column(c, v);
609 return v;
610 }
611
612 matrix4 inverse() const
613 {
614 matrix4 minv;
615
616 real r1[8], r2[8], r3[8], r4[8];
617 real *s[4], *tmprow;
618
619 s[0] = &r1[0];
620 s[1] = &r2[0];
621 s[2] = &r3[0];
622 s[3] = &r4[0];
623
624 register int i,j,p,jj;
625 for(i=0;i<4;i++)
626 {
627 for(j=0;j<4;j++)
628 {
629 s[i][j] = element(i,j);
630 if(i==j) s[i][j+4] = 1.0;
631 else s[i][j+4] = 0.0;
632 }
633 }
634 real scp[4];
635 for(i=0;i<4;i++)
636 {
637 scp[i] = real(fabs(s[i][0]));
638 for(j=1;j<4;j++)
639 if(real(fabs(s[i][j])) > scp[i]) scp[i] = real(fabs(s[i][j]));
640 if(scp[i] == 0.0) return minv; // singular matrix!
641 }
642
643 int pivot_to;
644 real scp_max;
645 for(i=0;i<4;i++)
646 {
647 // select pivot row
648 pivot_to = i;
649 scp_max = real(fabs(s[i][i]/scp[i]));
650 // find out which row should be on top
651 for(p=i+1;p<4;p++)
652 if(real(fabs(s[p][i]/scp[p])) > scp_max)
653 { scp_max = real(fabs(s[p][i]/scp[p])); pivot_to = p; }
654 // Pivot if necessary
655 if(pivot_to != i)
656 {
657 tmprow = s[i];
658 s[i] = s[pivot_to];
659 s[pivot_to] = tmprow;
660 real tmpscp;
661 tmpscp = scp[i];
662 scp[i] = scp[pivot_to];
663 scp[pivot_to] = tmpscp;
664 }
665
666 real mji;
667 // perform gaussian elimination
668 for(j=i+1;j<4;j++)
669 {
670 mji = s[j][i]/s[i][i];
671 s[j][i] = 0.0;
672 for(jj=i+1;jj<8;jj++)
673 s[j][jj] -= mji*s[i][jj];
674 }
675 }
676 if(s[3][3] == 0.0) return minv; // singular matrix!
677
678 //
679 // Now we have an upper triangular matrix.
680 //
681 // x x x x | y y y y
682 // 0 x x x | y y y y
683 // 0 0 x x | y y y y
684 // 0 0 0 x | y y y y
685 //
686 // we'll back substitute to get the inverse
687 //
688 // 1 0 0 0 | z z z z
689 // 0 1 0 0 | z z z z
690 // 0 0 1 0 | z z z z
691 // 0 0 0 1 | z z z z
692 //
693
694 real mij;
695 for(i=3;i>0;i--)
696 {
697 for(j=i-1;j > -1; j--)
698 {
699 mij = s[j][i]/s[i][i];
700 for(jj=j+1;jj<8;jj++)
701 s[j][jj] -= mij*s[i][jj];
702 }
703 }
704
705 for(i=0;i<4;i++)
706 for(j=0;j<4;j++)
707 minv(i,j) = s[i][j+4] / s[i][i];
708
709 return minv;
710 }
711
712
713 matrix4 transpose() const
714 {
715 matrix4 mtrans;
716
717 for(int i=0;i<4;i++)
718 for(int j=0;j<4;j++)
719 mtrans(i,j) = element(j,i);
720 return mtrans;
721 }
722
723 matrix4 & mult_right( const matrix4 & b )
724 {
725 matrix4 mt(*this);
726 set_value(real(0));
727
728 for(int i=0; i < 4; i++)
729 for(int j=0; j < 4; j++)
730 for(int c=0; c < 4; c++)
731 element(i,j) += mt(i,c) * b(c,j);
732 return *this;
733 }
734
735 matrix4 & mult_left( const matrix4 & b )
736 {
737 matrix4 mt(*this);
738 set_value(real(0));
739
740 for(int i=0; i < 4; i++)
741 for(int j=0; j < 4; j++)
742 for(int c=0; c < 4; c++)
743 element(i,j) += b(i,c) * mt(c,j);
744 return *this;
745 }
746
747 // dst = M * src
748 void mult_matrix_vec( const vec3 &src, vec3 &dst ) const
749 {
750 real w = (
751 src.v[0] * element(3,0) +
752 src.v[1] * element(3,1) +
753 src.v[2] * element(3,2) +
754 element(3,3) );
755
756 assert(w != GLH_ZERO);
757
758 dst.v[0] = (
759 src.v[0] * element(0,0) +
760 src.v[1] * element(0,1) +
761 src.v[2] * element(0,2) +
762 element(0,3) ) / w;
763 dst.v[1] = (
764 src.v[0] * element(1,0) +
765 src.v[1] * element(1,1) +
766 src.v[2] * element(1,2) +
767 element(1,3) ) / w;
768 dst.v[2] = (
769 src.v[0] * element(2,0) +
770 src.v[1] * element(2,1) +
771 src.v[2] * element(2,2) +
772 element(2,3) ) / w;
773 }
774
775 void mult_matrix_vec( vec3 & src_and_dst) const
776 { mult_matrix_vec(vec3(src_and_dst), src_and_dst); }
777
778
779 // dst = src * M
780 void mult_vec_matrix( const vec3 &src, vec3 &dst ) const
781 {
782 real w = (
783 src.v[0] * element(0,3) +
784 src.v[1] * element(1,3) +
785 src.v[2] * element(2,3) +
786 element(3,3) );
787
788 assert(w != GLH_ZERO);
789
790 dst.v[0] = (
791 src.v[0] * element(0,0) +
792 src.v[1] * element(1,0) +
793 src.v[2] * element(2,0) +
794 element(3,0) ) / w;
795 dst.v[1] = (
796 src.v[0] * element(0,1) +
797 src.v[1] * element(1,1) +
798 src.v[2] * element(2,1) +
799 element(3,1) ) / w;
800 dst.v[2] = (
801 src.v[0] * element(0,2) +
802 src.v[1] * element(1,2) +
803 src.v[2] * element(2,2) +
804 element(3,2) ) / w;
805 }
806
807
808 void mult_vec_matrix( vec3 & src_and_dst) const
809 { mult_vec_matrix(vec3(src_and_dst), src_and_dst); }
810
811 // dst = M * src
812 void mult_matrix_vec( const vec4 &src, vec4 &dst ) const
813 {
814 dst.v[0] = (
815 src.v[0] * element(0,0) +
816 src.v[1] * element(0,1) +
817 src.v[2] * element(0,2) +
818 src.v[3] * element(0,3));
819 dst.v[1] = (
820 src.v[0] * element(1,0) +
821 src.v[1] * element(1,1) +
822 src.v[2] * element(1,2) +
823 src.v[3] * element(1,3));
824 dst.v[2] = (
825 src.v[0] * element(2,0) +
826 src.v[1] * element(2,1) +
827 src.v[2] * element(2,2) +
828 src.v[3] * element(2,3));
829 dst.v[3] = (
830 src.v[0] * element(3,0) +
831 src.v[1] * element(3,1) +
832 src.v[2] * element(3,2) +
833 src.v[3] * element(3,3));
834 }
835
836 void mult_matrix_vec( vec4 & src_and_dst) const
837 { mult_matrix_vec(vec4(src_and_dst), src_and_dst); }
838
839
840 // dst = src * M
841 void mult_vec_matrix( const vec4 &src, vec4 &dst ) const
842 {
843 dst.v[0] = (
844 src.v[0] * element(0,0) +
845 src.v[1] * element(1,0) +
846 src.v[2] * element(2,0) +
847 src.v[3] * element(3,0));
848 dst.v[1] = (
849 src.v[0] * element(0,1) +
850 src.v[1] * element(1,1) +
851 src.v[2] * element(2,1) +
852 src.v[3] * element(3,1));
853 dst.v[2] = (
854 src.v[0] * element(0,2) +
855 src.v[1] * element(1,2) +
856 src.v[2] * element(2,2) +
857 src.v[3] * element(3,2));
858 dst.v[3] = (
859 src.v[0] * element(0,3) +
860 src.v[1] * element(1,3) +
861 src.v[2] * element(2,3) +
862 src.v[3] * element(3,3));
863 }
864
865
866 void mult_vec_matrix( vec4 & src_and_dst) const
867 { mult_vec_matrix(vec4(src_and_dst), src_and_dst); }
868
869
870 // dst = M * src
871 void mult_matrix_dir( const vec3 &src, vec3 &dst ) const
872 {
873 dst.v[0] = (
874 src.v[0] * element(0,0) +
875 src.v[1] * element(0,1) +
876 src.v[2] * element(0,2) ) ;
877 dst.v[1] = (
878 src.v[0] * element(1,0) +
879 src.v[1] * element(1,1) +
880 src.v[2] * element(1,2) ) ;
881 dst.v[2] = (
882 src.v[0] * element(2,0) +
883 src.v[1] * element(2,1) +
884 src.v[2] * element(2,2) ) ;
885 }
886
887
888 void mult_matrix_dir( vec3 & src_and_dst) const
889 { mult_matrix_dir(vec3(src_and_dst), src_and_dst); }
890
891
892 // dst = src * M
893 void mult_dir_matrix( const vec3 &src, vec3 &dst ) const
894 {
895 dst.v[0] = (
896 src.v[0] * element(0,0) +
897 src.v[1] * element(1,0) +
898 src.v[2] * element(2,0) ) ;
899 dst.v[1] = (
900 src.v[0] * element(0,1) +
901 src.v[1] * element(1,1) +
902 src.v[2] * element(2,1) ) ;
903 dst.v[2] = (
904 src.v[0] * element(0,2) +
905 src.v[1] * element(1,2) +
906 src.v[2] * element(2,2) ) ;
907 }
908
909
910 void mult_dir_matrix( vec3 & src_and_dst) const
911 { mult_dir_matrix(vec3(src_and_dst), src_and_dst); }
912
913
914 real & operator () (int row, int col)
915 { return element(row,col); }
916
917 const real & operator () (int row, int col) const
918 { return element(row,col); }
919
920 real & element (int row, int col)
921 { return m[row | (col<<2)]; }
922
923 const real & element (int row, int col) const
924 { return m[row | (col<<2)]; }
925
926 matrix4 & operator *= ( const matrix4 & mat )
927 {
928 mult_right( mat );
929 return *this;
930 }
931
932 matrix4 & operator *= ( const real & r )
933 {
934 for (int i = 0; i < 4; ++i)
935 {
936 element(0,i) *= r;
937 element(1,i) *= r;
938 element(2,i) *= r;
939 element(3,i) *= r;
940 }
941 return *this;
942 }
943
944 matrix4 & operator += ( const matrix4 & mat )
945 {
946 for (int i = 0; i < 4; ++i)
947 {
948 element(0,i) += mat.element(0,i);
949 element(1,i) += mat.element(1,i);
950 element(2,i) += mat.element(2,i);
951 element(3,i) += mat.element(3,i);
952 }
953 return *this;
954 }
955
956 friend matrix4 operator * ( const matrix4 & m1, const matrix4 & m2 );
957 friend bool operator == ( const matrix4 & m1, const matrix4 & m2 );
958 friend bool operator != ( const matrix4 & m1, const matrix4 & m2 );
959
960 //protected:
961 real m[16];
962 };
963
964 inline
965 matrix4 operator * ( const matrix4 & m1, const matrix4 & m2 )
966 {
967 matrix4 product;
968
969 product = m1;
970 product.mult_right(m2);
971
972 return product;
973 }
974
975 inline
976 bool operator ==( const matrix4 &m1, const matrix4 &m2 )
977 {
978 return (
979 m1(0,0) == m2(0,0) &&
980 m1(0,1) == m2(0,1) &&
981 m1(0,2) == m2(0,2) &&
982 m1(0,3) == m2(0,3) &&
983 m1(1,0) == m2(1,0) &&
984 m1(1,1) == m2(1,1) &&
985 m1(1,2) == m2(1,2) &&
986 m1(1,3) == m2(1,3) &&
987 m1(2,0) == m2(2,0) &&
988 m1(2,1) == m2(2,1) &&
989 m1(2,2) == m2(2,2) &&
990 m1(2,3) == m2(2,3) &&
991 m1(3,0) == m2(3,0) &&
992 m1(3,1) == m2(3,1) &&
993 m1(3,2) == m2(3,2) &&
994 m1(3,3) == m2(3,3) );
995 }
996
997 inline
998 bool operator != ( const matrix4 & m1, const matrix4 & m2 )
999 { return !( m1 == m2 ); }
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013 class quaternion
1014 {
1015 public:
1016
1017 quaternion()
1018 {
1019 *this = identity();
1020 }
1021
1022 quaternion( const real v[4] )
1023 {
1024 set_value( v );
1025 }
1026
1027
1028 quaternion( real q0, real q1, real q2, real q3 )
1029 {
1030 set_value( q0, q1, q2, q3 );
1031 }
1032
1033
1034 quaternion( const matrix4 & m )
1035 {
1036 set_value( m );
1037 }
1038
1039
1040 quaternion( const vec3 &axis, real radians )
1041 {
1042 set_value( axis, radians );
1043 }
1044
1045
1046 quaternion( const vec3 &rotateFrom, const vec3 &rotateTo )
1047 {
1048 set_value( rotateFrom, rotateTo );
1049 }
1050
1051 quaternion( const vec3 & from_look, const vec3 & from_up,
1052 const vec3 & to_look, const vec3& to_up)
1053 {
1054 set_value(from_look, from_up, to_look, to_up);
1055 }
1056
1057 const real * get_value() const
1058 {
1059 return &q[0];
1060 }
1061
1062 void get_value( real &q0, real &q1, real &q2, real &q3 ) const
1063 {
1064 q0 = q[0];
1065 q1 = q[1];
1066 q2 = q[2];
1067 q3 = q[3];
1068 }
1069
1070 quaternion & set_value( real q0, real q1, real q2, real q3 )
1071 {
1072 q[0] = q0;
1073 q[1] = q1;
1074 q[2] = q2;
1075 q[3] = q3;
1076 counter = 0;
1077 return *this;
1078 }
1079
1080 void get_value( vec3 &axis, real &radians ) const
1081 {
1082 radians = real(acos( q[3] ) * GLH_TWO);
1083 if ( radians == GLH_ZERO )
1084 axis = vec3( 0.0, 0.0, 1.0 );
1085 else
1086 {
1087 axis.v[0] = q[0];
1088 axis.v[1] = q[1];
1089 axis.v[2] = q[2];
1090 axis.normalize();
1091 }
1092 }
1093
1094 void get_value( matrix4 & m ) const
1095 {
1096 real s, xs, ys, zs, wx, wy, wz, xx, xy, xz, yy, yz, zz;
1097
1098 real norm = q[0] * q[0] + q[1] * q[1] + q[2] * q[2] + q[3] * q[3];
1099
1100 s = (equivalent(norm,GLH_ZERO)) ? GLH_ZERO : ( GLH_TWO / norm );
1101
1102 xs = q[0] * s;
1103 ys = q[1] * s;
1104 zs = q[2] * s;
1105
1106 wx = q[3] * xs;
1107 wy = q[3] * ys;
1108 wz = q[3] * zs;
1109
1110 xx = q[0] * xs;
1111 xy = q[0] * ys;
1112 xz = q[0] * zs;
1113
1114 yy = q[1] * ys;
1115 yz = q[1] * zs;
1116 zz = q[2] * zs;
1117
1118 m(0,0) = real( GLH_ONE - ( yy + zz ));
1119 m(1,0) = real ( xy + wz );
1120 m(2,0) = real ( xz - wy );
1121
1122 m(0,1) = real ( xy - wz );
1123 m(1,1) = real ( GLH_ONE - ( xx + zz ));
1124 m(2,1) = real ( yz + wx );
1125
1126 m(0,2) = real ( xz + wy );
1127 m(1,2) = real ( yz - wx );
1128 m(2,2) = real ( GLH_ONE - ( xx + yy ));
1129
1130 m(3,0) = m(3,1) = m(3,2) = m(0,3) = m(1,3) = m(2,3) = GLH_ZERO;
1131 m(3,3) = GLH_ONE;
1132 }
1133
1134 quaternion & set_value( const real * qp )
1135 {
1136 memcpy(q,qp,sizeof(real) * 4);
1137
1138 counter = 0;
1139 return *this;
1140 }
1141
1142 quaternion & set_value( const matrix4 & m )
1143 {
1144 real tr, s;
1145 int i, j, k;
1146 const int nxt[3] = { 1, 2, 0 };
1147
1148 tr = m(0,0) + m(1,1) + m(2,2);
1149
1150 if ( tr > GLH_ZERO )
1151 {
1152 s = real(sqrt( tr + m(3,3) ));
1153 q[3] = real ( s * 0.5 );
1154 s = real(0.5) / s;
1155
1156 q[0] = real ( ( m(1,2) - m(2,1) ) * s );
1157 q[1] = real ( ( m(2,0) - m(0,2) ) * s );
1158 q[2] = real ( ( m(0,1) - m(1,0) ) * s );
1159 }
1160 else
1161 {
1162 i = 0;
1163 if ( m(1,1) > m(0,0) )
1164 i = 1;
1165
1166 if ( m(2,2) > m(i,i) )
1167 i = 2;
1168
1169 j = nxt[i];
1170 k = nxt[j];
1171
1172 s = real(sqrt( ( m(i,j) - ( m(j,j) + m(k,k) )) + GLH_ONE ));
1173
1174 q[i] = real ( s * 0.5 );
1175 s = real(0.5 / s);
1176
1177 q[3] = real ( ( m(j,k) - m(k,j) ) * s );
1178 q[j] = real ( ( m(i,j) + m(j,i) ) * s );
1179 q[k] = real ( ( m(i,k) + m(k,i) ) * s );
1180 }
1181
1182 counter = 0;
1183 return *this;
1184 }
1185
1186 quaternion & set_value( const vec3 &axis, real theta )
1187 {
1188 real sqnorm = axis.square_norm();
1189
1190 if (sqnorm <= GLH_EPSILON)
1191 {
1192 // axis too small.
1193 x = y = z = 0.0;
1194 w = 1.0;
1195 }
1196 else
1197 {
1198 theta *= real(0.5);
1199 real sin_theta = real(sin(theta));
1200
1201 if (!equivalent(sqnorm,GLH_ONE))
1202 sin_theta /= real(sqrt(sqnorm));
1203 x = sin_theta * axis.v[0];
1204 y = sin_theta * axis.v[1];
1205 z = sin_theta * axis.v[2];
1206 w = real(cos(theta));
1207 }
1208 return *this;
1209 }
1210
1211 quaternion & set_value( const vec3 & rotateFrom, const vec3 & rotateTo )
1212 {
1213 vec3 p1, p2;
1214 real alpha;
1215
1216 p1 = rotateFrom;
1217 p1.normalize();
1218 p2 = rotateTo;
1219 p2.normalize();
1220
1221 alpha = p1.dot(p2);
1222
1223 if(equivalent(alpha,GLH_ONE))
1224 {
1225 *this = identity();
1226 return *this;
1227 }
1228
1229 // ensures that the anti-parallel case leads to a positive dot
1230 if(equivalent(alpha,-GLH_ONE))
1231 {
1232 vec3 v;
1233
1234 if(p1.v[0] != p1.v[1] || p1.v[0] != p1.v[2])
1235 v = vec3(p1.v[1], p1.v[2], p1.v[0]);
1236 else
1237 v = vec3(-p1.v[0], p1.v[1], p1.v[2]);
1238
1239 v -= p1 * p1.dot(v);
1240 v.normalize();
1241
1242 set_value(v, GLH_PI);
1243 return *this;
1244 }
1245
1246 p1 = p1.cross(p2);
1247 p1.normalize();
1248 set_value(p1,real(acos(alpha)));
1249
1250 counter = 0;
1251 return *this;
1252 }
1253
1254 quaternion & set_value( const vec3 & from_look, const vec3 & from_up,
1255 const vec3 & to_look, const vec3 & to_up)
1256 {
1257 quaternion r_look = quaternion(from_look, to_look);
1258
1259 vec3 rotated_from_up(from_up);
1260 r_look.mult_vec(rotated_from_up);
1261
1262 quaternion r_twist = quaternion(rotated_from_up, to_up);
1263
1264 *this = r_twist;
1265 *this *= r_look;
1266 return *this;
1267 }
1268
1269 quaternion & operator *= ( const quaternion & qr )
1270 {
1271 quaternion ql(*this);
1272
1273 w = ql.w * qr.w - ql.x * qr.x - ql.y * qr.y - ql.z * qr.z;
1274 x = ql.w * qr.x + ql.x * qr.w + ql.y * qr.z - ql.z * qr.y;
1275 y = ql.w * qr.y + ql.y * qr.w + ql.z * qr.x - ql.x * qr.z;
1276 z = ql.w * qr.z + ql.z * qr.w + ql.x * qr.y - ql.y * qr.x;
1277
1278 counter += qr.counter;
1279 counter++;
1280 counter_normalize();
1281 return *this;
1282 }
1283
1284 void normalize()
1285 {
1286 real rnorm = GLH_ONE / real(sqrt(w * w + x * x + y * y + z * z));
1287 if (equivalent(rnorm, GLH_ZERO))
1288 return;
1289 x *= rnorm;
1290 y *= rnorm;
1291 z *= rnorm;
1292 w *= rnorm;
1293 counter = 0;
1294 }
1295
1296 friend bool operator == ( const quaternion & q1, const quaternion & q2 );
1297
1298 friend bool operator != ( const quaternion & q1, const quaternion & q2 );
1299
1300 friend quaternion operator * ( const quaternion & q1, const quaternion & q2 );
1301
1302 bool equals( const quaternion & r, real tolerance ) const
1303 {
1304 real t;
1305
1306 t = (
1307 (q[0]-r.q[0])*(q[0]-r.q[0]) +
1308 (q[1]-r.q[1])*(q[1]-r.q[1]) +
1309 (q[2]-r.q[2])*(q[2]-r.q[2]) +
1310 (q[3]-r.q[3])*(q[3]-r.q[3]) );
1311 if(t > GLH_EPSILON)
1312 return false;
1313 return 1;
1314 }
1315
1316 quaternion & conjugate()
1317 {
1318 q[0] *= -GLH_ONE;
1319 q[1] *= -GLH_ONE;
1320 q[2] *= -GLH_ONE;
1321 return *this;
1322 }
1323
1324 quaternion & invert()
1325 {
1326 return conjugate();
1327 }
1328
1329 quaternion inverse() const
1330 {
1331 quaternion r = *this;
1332 return r.invert();
1333 }
1334
1335 //
1336 // Quaternion multiplication with cartesian vector
1337 // v' = q*v*q(star)
1338 //
1339 void mult_vec( const vec3 &src, vec3 &dst ) const
1340 {
1341 real v_coef = w * w - x * x - y * y - z * z;
1342 real u_coef = GLH_TWO * (src.v[0] * x + src.v[1] * y + src.v[2] * z);
1343 real c_coef = GLH_TWO * w;
1344
1345 dst.v[0] = v_coef * src.v[0] + u_coef * x + c_coef * (y * src.v[2] - z * src.v[1]);
1346 dst.v[1] = v_coef * src.v[1] + u_coef * y + c_coef * (z * src.v[0] - x * src.v[2]);
1347 dst.v[2] = v_coef * src.v[2] + u_coef * z + c_coef * (x * src.v[1] - y * src.v[0]);
1348 }
1349
1350 void mult_vec( vec3 & src_and_dst) const
1351 {
1352 mult_vec(vec3(src_and_dst), src_and_dst);
1353 }
1354
1355 void scale_angle( real scaleFactor )
1356 {
1357 vec3 axis;
1358 real radians;
1359
1360 get_value(axis, radians);
1361 radians *= scaleFactor;
1362 set_value(axis, radians);
1363 }
1364
1365 static quaternion slerp( const quaternion & p, const quaternion & q, real alpha )
1366 {
1367 quaternion r;
1368
1369 real cos_omega = p.x * q.x + p.y * q.y + p.z * q.z + p.w * q.w;
1370 // if B is on opposite hemisphere from A, use -B instead
1371
1372 int bflip;
1373 if ( ( bflip = (cos_omega < GLH_ZERO)) )
1374 cos_omega = -cos_omega;
1375
1376 // complementary interpolation parameter
1377 real beta = GLH_ONE - alpha;
1378
1379 if(cos_omega <= GLH_ONE - GLH_EPSILON)
1380 return p;
1381
1382 real omega = real(acos(cos_omega));
1383 real one_over_sin_omega = GLH_ONE / real(sin(omega));
1384
1385 beta = real(sin(omega*beta) * one_over_sin_omega);
1386 alpha = real(sin(omega*alpha) * one_over_sin_omega);
1387
1388 if (bflip)
1389 alpha = -alpha;
1390
1391 r.x = beta * p.q[0]+ alpha * q.q[0];
1392 r.y = beta * p.q[1]+ alpha * q.q[1];
1393 r.z = beta * p.q[2]+ alpha * q.q[2];
1394 r.w = beta * p.q[3]+ alpha * q.q[3];
1395 return r;
1396 }
1397
1398 static quaternion identity()
1399 {
1400 static quaternion ident( vec3( 0.0, 0.0, 0.0 ), GLH_ONE );
1401 return ident;
1402 }
1403
1404 real & operator []( int i )
1405 {
1406 assert(i < 4);
1407 return q[i];
1408 }
1409
1410 const real & operator []( int i ) const
1411 {
1412 assert(i < 4);
1413 return q[i];
1414 }
1415
1416 protected:
1417
1418 void counter_normalize()
1419 {
1420 if (counter > GLH_QUATERNION_NORMALIZATION_THRESHOLD)
1421 normalize();
1422 }
1423
1424 union
1425 {
1426 struct
1427 {
1428 real q[4];
1429 };
1430 struct
1431 {
1432 real x;
1433 real y;
1434 real z;
1435 real w;
1436 };
1437 };
1438
1439 // renormalization counter
1440 unsigned char counter;
1441 };
1442
1443 inline
1444 bool operator == ( const quaternion & q1, const quaternion & q2 )
1445 {
1446 return (equivalent(q1.x, q2.x) &&
1447 equivalent(q1.y, q2.y) &&
1448 equivalent(q1.z, q2.z) &&
1449 equivalent(q1.w, q2.w) );
1450 }
1451
1452 inline
1453 bool operator != ( const quaternion & q1, const quaternion & q2 )
1454 {
1455 return ! ( q1 == q2 );
1456 }
1457
1458 inline
1459 quaternion operator * ( const quaternion & q1, const quaternion & q2 )
1460 {
1461 quaternion r(q1);
1462 r *= q2;
1463 return r;
1464 }
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475 class plane
1476 {
1477 public:
1478
1479 plane()
1480 {
1481 planedistance = 0.0;
1482 planenormal.set_value( 0.0, 0.0, 1.0 );
1483 }
1484
1485
1486 plane( const vec3 &p0, const vec3 &p1, const vec3 &p2 )
1487 {
1488 vec3 v0 = p1 - p0;
1489 vec3 v1 = p2 - p0;
1490 planenormal = v0.cross(v1);
1491 planenormal.normalize();
1492 planedistance = p0.dot(planenormal);
1493 }
1494
1495 plane( const vec3 &normal, real distance )
1496 {
1497 planedistance = distance;
1498 planenormal = normal;
1499 planenormal.normalize();
1500 }
1501
1502 plane( const vec3 &normal, const vec3 &point )
1503 {
1504 planenormal = normal;
1505 planenormal.normalize();
1506 planedistance = point.dot(planenormal);
1507 }
1508
1509 void offset( real d )
1510 {
1511 planedistance += d;
1512 }
1513
1514 bool intersect( const line &l, vec3 &intersection ) const
1515 {
1516 vec3 pos, dir;
1517 vec3 pn = planenormal;
1518 real pd = planedistance;
1519
1520 pos = l.get_position();
1521 dir = l.get_direction();
1522
1523 if(dir.dot(pn) == 0.0) return 0;
1524 pos -= pn*pd;
1525 // now we're talking about a plane passing through the origin
1526 if(pos.dot(pn) < 0.0) pn.negate();
1527 if(dir.dot(pn) > 0.0) dir.negate();
1528 vec3 ppos = pn * pos.dot(pn);
1529 pos = (ppos.length()/dir.dot(-pn))*dir;
1530 intersection = l.get_position();
1531 intersection += pos;
1532 return 1;
1533 }
1534 void transform( const matrix4 &matrix )
1535 {
1536 matrix4 invtr = matrix.inverse();
1537 invtr = invtr.transpose();
1538
1539 vec3 pntOnplane = planenormal * planedistance;
1540 vec3 newPntOnplane;
1541 vec3 newnormal;
1542
1543 invtr.mult_dir_matrix(planenormal, newnormal);
1544 matrix.mult_vec_matrix(pntOnplane, newPntOnplane);
1545
1546 newnormal.normalize();
1547 planenormal = newnormal;
1548 planedistance = newPntOnplane.dot(planenormal);
1549 }
1550
1551 bool is_in_half_space( const vec3 &point ) const
1552 {
1553
1554 if(( point.dot(planenormal) - planedistance) < 0.0)
1555 return 0;
1556 return 1;
1557 }
1558
1559
1560 real distance( const vec3 & point ) const
1561 {
1562 return planenormal.dot(point - planenormal*planedistance);
1563 }
1564
1565 const vec3 &get_normal() const
1566 {
1567 return planenormal;
1568 }
1569
1570
1571 real get_distance_from_origin() const
1572 {
1573 return planedistance;
1574 }
1575
1576
1577 friend bool operator == ( const plane & p1, const plane & p2 );
1578
1579
1580 friend bool operator != ( const plane & p1, const plane & p2 );
1581
1582 //protected:
1583 vec3 planenormal;
1584 real planedistance;
1585 };
1586
1587 inline
1588 bool operator == (const plane & p1, const plane & p2 )
1589 {
1590 return ( p1.planedistance == p2.planedistance && p1.planenormal == p2.planenormal);
1591 }
1592
1593 inline
1594 bool operator != ( const plane & p1, const plane & p2 )
1595 { return ! (p1 == p2); }
1596
1597
1598
1599 } // "ns_##GLH_REAL"
1600
1601 // make common typedefs...
1602#ifdef GLH_REAL_IS_FLOAT
1603 typedef GLH_REAL_NAMESPACE::vec2 vec2f;
1604 typedef GLH_REAL_NAMESPACE::vec3 vec3f;
1605 typedef GLH_REAL_NAMESPACE::vec4 vec4f;
1606 typedef GLH_REAL_NAMESPACE::quaternion quaternionf;
1607 typedef GLH_REAL_NAMESPACE::quaternion rotationf;
1608 typedef GLH_REAL_NAMESPACE::line linef;
1609 typedef GLH_REAL_NAMESPACE::plane planef;
1610 typedef GLH_REAL_NAMESPACE::matrix4 matrix4f;
1611#endif
1612
1613
1614
1615
1616} // namespace glh
1617
1618
1619
1620#endif
1621
diff --git a/linden/indra/llwindow/lldxhardware.cpp b/linden/indra/llwindow/lldxhardware.cpp
index deb7901..e0cb82d 100644
--- a/linden/indra/llwindow/lldxhardware.cpp
+++ b/linden/indra/llwindow/lldxhardware.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -623,7 +624,37 @@ LLSD LLDXHardware::getDisplayInfo()
623 ret["DeviceName"] = device_name; 624 ret["DeviceName"] = device_name;
624 std::string device_driver= get_string(device_containerp, L"szDriverVersion"); 625 std::string device_driver= get_string(device_containerp, L"szDriverVersion");
625 ret["DriverVersion"] = device_driver; 626 ret["DriverVersion"] = device_driver;
626 } 627
628 // ATI has a slightly different version string
629 if(device_name.length() >= 4 && device_name.substr(0,4) == "ATI ")
630 {
631 // get the key
632 HKEY hKey;
633 const DWORD RV_SIZE = 100;
634 WCHAR release_version[RV_SIZE];
635
636 // Hard coded registry entry. Using this since it's simpler for now.
637 // And using EnumDisplayDevices to get a registry key also requires
638 // a hard coded Query value.
639 if(ERROR_SUCCESS == RegOpenKey(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\ATI Technologies\\CBT"), &hKey))
640 {
641 // get the value
642 DWORD dwType = REG_SZ;
643 DWORD dwSize = sizeof(WCHAR) * RV_SIZE;
644 if(ERROR_SUCCESS == RegQueryValueEx(hKey, TEXT("ReleaseVersion"),
645 NULL, &dwType, (LPBYTE)release_version, &dwSize))
646 {
647 // print the value
648 // windows doesn't guarantee to be null terminated
649 release_version[RV_SIZE - 1] = NULL;
650 ret["DriverVersion"] = utf16str_to_utf8str(release_version);
651
652 }
653 RegCloseKey(hKey);
654 }
655 }
656 }
657
627LCleanup: 658LCleanup:
628 SAFE_RELEASE(file_containerp); 659 SAFE_RELEASE(file_containerp);
629 SAFE_RELEASE(driver_containerp); 660 SAFE_RELEASE(driver_containerp);
diff --git a/linden/indra/llwindow/lldxhardware.h b/linden/indra/llwindow/lldxhardware.h
index 449a06f..0ce218b 100644
--- a/linden/indra/llwindow/lldxhardware.h
+++ b/linden/indra/llwindow/lldxhardware.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llwindow/llkeyboard.cpp b/linden/indra/llwindow/llkeyboard.cpp
index 16c89ca..02b4ed1 100644
--- a/linden/indra/llwindow/llkeyboard.cpp
+++ b/linden/indra/llwindow/llkeyboard.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llwindow/llkeyboard.h b/linden/indra/llwindow/llkeyboard.h
index 4556dfd..0261bcb 100644
--- a/linden/indra/llwindow/llkeyboard.h
+++ b/linden/indra/llwindow/llkeyboard.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llwindow/llkeyboardmacosx.cpp b/linden/indra/llwindow/llkeyboardmacosx.cpp
index 4038f17..ec82032 100644
--- a/linden/indra/llwindow/llkeyboardmacosx.cpp
+++ b/linden/indra/llwindow/llkeyboardmacosx.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llwindow/llkeyboardmacosx.h b/linden/indra/llwindow/llkeyboardmacosx.h
index 8cde53b..47159af 100644
--- a/linden/indra/llwindow/llkeyboardmacosx.h
+++ b/linden/indra/llwindow/llkeyboardmacosx.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llwindow/llkeyboardsdl.cpp b/linden/indra/llwindow/llkeyboardsdl.cpp
index 86894b1..8a6b6d6 100644
--- a/linden/indra/llwindow/llkeyboardsdl.cpp
+++ b/linden/indra/llwindow/llkeyboardsdl.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llwindow/llkeyboardsdl.h b/linden/indra/llwindow/llkeyboardsdl.h
index e8c6961..e597788 100644
--- a/linden/indra/llwindow/llkeyboardsdl.h
+++ b/linden/indra/llwindow/llkeyboardsdl.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llwindow/llkeyboardwin32.cpp b/linden/indra/llwindow/llkeyboardwin32.cpp
index 8d45dcb..a06f191 100644
--- a/linden/indra/llwindow/llkeyboardwin32.cpp
+++ b/linden/indra/llwindow/llkeyboardwin32.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llwindow/llkeyboardwin32.h b/linden/indra/llwindow/llkeyboardwin32.h
index c709f71..a213875 100644
--- a/linden/indra/llwindow/llkeyboardwin32.h
+++ b/linden/indra/llwindow/llkeyboardwin32.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llwindow/llmousehandler.h b/linden/indra/llwindow/llmousehandler.h
index dba1fc1..f3a2edd 100644
--- a/linden/indra/llwindow/llmousehandler.h
+++ b/linden/indra/llwindow/llmousehandler.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llwindow/llpreeditor.h b/linden/indra/llwindow/llpreeditor.h
index 2180654..370f76c 100644
--- a/linden/indra/llwindow/llpreeditor.h
+++ b/linden/indra/llwindow/llpreeditor.h
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llwindow/llwindow.cpp b/linden/indra/llwindow/llwindow.cpp
index 44908fb..fb4770e 100644
--- a/linden/indra/llwindow/llwindow.cpp
+++ b/linden/indra/llwindow/llwindow.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -308,16 +309,16 @@ void *LLWindow::getMediaWindow()
308} 309}
309 310
310// static 311// static
311std::string LLWindow::getFontListSans() 312std::vector<std::string> LLWindow::getDynamicFallbackFontList()
312{ 313{
313#if LL_WINDOWS 314#if LL_WINDOWS
314 return LLWindowWin32::getFontListSans(); 315 return LLWindowWin32::getDynamicFallbackFontList();
315#elif LL_DARWIN 316#elif LL_DARWIN
316 return LLWindowMacOSX::getFontListSans(); 317 return LLWindowMacOSX::getDynamicFallbackFontList();
317#elif LL_SDL 318#elif LL_SDL
318 return LLWindowSDL::getFontListSans(); 319 return LLWindowSDL::getDynamicFallbackFontList();
319#else 320#else
320 return ""; 321 return std::vector<std::string>();
321#endif 322#endif
322} 323}
323 324
diff --git a/linden/indra/llwindow/llwindow.h b/linden/indra/llwindow/llwindow.h
index ffc117f..9e01596 100644
--- a/linden/indra/llwindow/llwindow.h
+++ b/linden/indra/llwindow/llwindow.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -35,48 +36,7 @@
35#include "llrect.h" 36#include "llrect.h"
36#include "llcoord.h" 37#include "llcoord.h"
37#include "llstring.h" 38#include "llstring.h"
38 39#include "llcursortypes.h"
39
40enum ECursorType {
41 UI_CURSOR_ARROW,
42 UI_CURSOR_WAIT,
43 UI_CURSOR_HAND,
44 UI_CURSOR_IBEAM,
45 UI_CURSOR_CROSS,
46 UI_CURSOR_SIZENWSE,
47 UI_CURSOR_SIZENESW,
48 UI_CURSOR_SIZEWE,
49 UI_CURSOR_SIZENS,
50 UI_CURSOR_NO,
51 UI_CURSOR_WORKING,
52 UI_CURSOR_TOOLGRAB,
53 UI_CURSOR_TOOLLAND,
54 UI_CURSOR_TOOLFOCUS,
55 UI_CURSOR_TOOLCREATE,
56 UI_CURSOR_ARROWDRAG,
57 UI_CURSOR_ARROWCOPY, // drag with copy
58 UI_CURSOR_ARROWDRAGMULTI,
59 UI_CURSOR_ARROWCOPYMULTI, // drag with copy
60 UI_CURSOR_NOLOCKED,
61 UI_CURSOR_ARROWLOCKED,
62 UI_CURSOR_GRABLOCKED,
63 UI_CURSOR_TOOLTRANSLATE,
64 UI_CURSOR_TOOLROTATE,
65 UI_CURSOR_TOOLSCALE,
66 UI_CURSOR_TOOLCAMERA,
67 UI_CURSOR_TOOLPAN,
68 UI_CURSOR_TOOLZOOMIN,
69 UI_CURSOR_TOOLPICKOBJECT3,
70 UI_CURSOR_TOOLSIT,
71 UI_CURSOR_TOOLBUY,
72 UI_CURSOR_TOOLPAY,
73 UI_CURSOR_TOOLOPEN,
74 UI_CURSOR_TOOLPLAY,
75 UI_CURSOR_TOOLPAUSE,
76 UI_CURSOR_TOOLMEDIAOPEN,
77 UI_CURSOR_PIPETTE,
78 UI_CURSOR_COUNT // Number of elements in this enum (NOT a cursor)
79};
80 40
81class LLSplashScreen; 41class LLSplashScreen;
82 42
@@ -238,7 +198,7 @@ public:
238 virtual void interruptLanguageTextInput() {} 198 virtual void interruptLanguageTextInput() {}
239 virtual void spawnWebBrowser(const std::string& escaped_url) {}; 199 virtual void spawnWebBrowser(const std::string& escaped_url) {};
240 200
241 static std::string getFontListSans(); 201 static std::vector<std::string> getDynamicFallbackFontList();
242 202
243protected: 203protected:
244 LLWindow(BOOL fullscreen, U32 flags); 204 LLWindow(BOOL fullscreen, U32 flags);
diff --git a/linden/indra/llwindow/llwindowheadless.cpp b/linden/indra/llwindow/llwindowheadless.cpp
index 7f671cc..3742846 100644
--- a/linden/indra/llwindow/llwindowheadless.cpp
+++ b/linden/indra/llwindow/llwindowheadless.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llwindow/llwindowheadless.h b/linden/indra/llwindow/llwindowheadless.h
index 8153e67..4353d15 100644
--- a/linden/indra/llwindow/llwindowheadless.h
+++ b/linden/indra/llwindow/llwindowheadless.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llwindow/llwindowmacosx-objc.h b/linden/indra/llwindow/llwindowmacosx-objc.h
index 9a552e2..ed5d7b1 100644
--- a/linden/indra/llwindow/llwindowmacosx-objc.h
+++ b/linden/indra/llwindow/llwindowmacosx-objc.h
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llwindow/llwindowmacosx-objc.mm b/linden/indra/llwindow/llwindowmacosx-objc.mm
index 7315072..da01c2a 100644
--- a/linden/indra/llwindow/llwindowmacosx-objc.mm
+++ b/linden/indra/llwindow/llwindowmacosx-objc.mm
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llwindow/llwindowmacosx.cpp b/linden/indra/llwindow/llwindowmacosx.cpp
index 3ddf5e6..4f6df0f 100644
--- a/linden/indra/llwindow/llwindowmacosx.cpp
+++ b/linden/indra/llwindow/llwindowmacosx.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -701,7 +702,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
701 "Radeon DDR", 702 "Radeon DDR",
702 "Radeon VE", 703 "Radeon VE",
703 "GDI Generic" }; 704 "GDI Generic" };
704 const S32 CARD_COUNT = sizeof(CARD_LIST)/sizeof(char*); 705 const S32 CARD_COUNT = LL_ARRAY_SIZE(CARD_LIST);
705 706
706 // Future candidates: 707 // Future candidates:
707 // ProSavage/Twister 708 // ProSavage/Twister
@@ -3357,10 +3358,9 @@ void LLWindowMacOSX::interruptLanguageTextInput()
3357} 3358}
3358 3359
3359//static 3360//static
3360std::string LLWindowMacOSX::getFontListSans() 3361std::vector<std::string> LLWindowMacOSX::getDynamicFallbackFontList()
3361{ 3362{
3362 // This is a fairly complete Japanese font that ships with Mac OS X. 3363 // Fonts previously in getFontListSans() have moved to fonts.xml.
3363 // The first filename is in UTF8, but it shows up in the font menu as "Hiragino Kaku Gothic Pro W3". 3364 return std::vector<std::string>();
3364 // The third filename is in UTF8, but it shows up in the font menu as "STHeiti Light"
3365 return "\xE3\x83\x92\xE3\x83\xA9\xE3\x82\xAD\xE3\x82\x99\xE3\x83\x8E\xE8\xA7\x92\xE3\x82\xB3\xE3\x82\x99 Pro W3.otf;\xE3\x83\x92\xE3\x83\xA9\xE3\x82\xAD\xE3\x82\x99\xE3\x83\x8E\xE8\xA7\x92\xE3\x82\xB3\xE3\x82\x99 ProN W3.otf;AppleGothic.dfont;AppleGothic.ttf;\xe5\x8d\x8e\xe6\x96\x87\xe7\xbb\x86\xe9\xbb\x91.ttf";
3366} 3365}
3366
diff --git a/linden/indra/llwindow/llwindowmacosx.h b/linden/indra/llwindow/llwindowmacosx.h
index 246151c..3886782 100644
--- a/linden/indra/llwindow/llwindowmacosx.h
+++ b/linden/indra/llwindow/llwindowmacosx.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -112,7 +113,7 @@ public:
112 /*virtual*/ void interruptLanguageTextInput(); 113 /*virtual*/ void interruptLanguageTextInput();
113 /*virtual*/ void spawnWebBrowser(const std::string& escaped_url); 114 /*virtual*/ void spawnWebBrowser(const std::string& escaped_url);
114 115
115 static std::string getFontListSans(); 116 static std::vector<std::string> getDynamicFallbackFontList();
116 117
117protected: 118protected:
118 LLWindowMacOSX( 119 LLWindowMacOSX(
diff --git a/linden/indra/llwindow/llwindowmesaheadless.cpp b/linden/indra/llwindow/llwindowmesaheadless.cpp
index 993bd7b..c1f9d20 100644
--- a/linden/indra/llwindow/llwindowmesaheadless.cpp
+++ b/linden/indra/llwindow/llwindowmesaheadless.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llwindow/llwindowmesaheadless.h b/linden/indra/llwindow/llwindowmesaheadless.h
index ce05216..ab562d9 100644
--- a/linden/indra/llwindow/llwindowmesaheadless.h
+++ b/linden/indra/llwindow/llwindowmesaheadless.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/llwindow/llwindowsdl.cpp b/linden/indra/llwindow/llwindowsdl.cpp
index 8111aaf..f9c170e 100644
--- a/linden/indra/llwindow/llwindowsdl.cpp
+++ b/linden/indra/llwindow/llwindowsdl.cpp
@@ -1,6 +1,7 @@
1/** 1/**
2 * @file llwindowsdl.cpp 2 * @file llwindowsdl.cpp
3 * @brief SDL implementation of LLWindow class 3 * @brief SDL implementation of LLWindow class
4 * @author This module has many fathers, and it shows.
4 * 5 *
5 * $LicenseInfo:firstyear=2001&license=viewergpl$ 6 * $LicenseInfo:firstyear=2001&license=viewergpl$
6 * 7 *
@@ -17,7 +18,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 23 *
22 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
@@ -83,8 +85,6 @@ static bool ATIbug = false;
83// be only one object of this class at any time. Currently this is true. 85// be only one object of this class at any time. Currently this is true.
84static LLWindowSDL *gWindowImplementation = NULL; 86static LLWindowSDL *gWindowImplementation = NULL;
85 87
86static BOOL was_fullscreen = FALSE;
87
88 88
89void maybe_lock_display(void) 89void maybe_lock_display(void)
90{ 90{
@@ -156,6 +156,8 @@ bool LLWindowSDL::ll_try_gtk_init(void)
156 llwarns << "- GTK COMPATIBILITY WARNING: " << 156 llwarns << "- GTK COMPATIBILITY WARNING: " <<
157 gtk_warning << llendl; 157 gtk_warning << llendl;
158 gtk_is_good = FALSE; 158 gtk_is_good = FALSE;
159 } else {
160 llinfos << "- GTK version is good." << llendl;
159 } 161 }
160 162
161 done_gtk_diag = TRUE; 163 done_gtk_diag = TRUE;
@@ -188,11 +190,12 @@ Display* LLWindowSDL::get_SDL_Display(void)
188 190
189 191
190LLWindowSDL::LLWindowSDL(const std::string& title, S32 x, S32 y, S32 width, 192LLWindowSDL::LLWindowSDL(const std::string& title, S32 x, S32 y, S32 width,
191 S32 height, U32 flags, 193 S32 height, U32 flags,
192 BOOL fullscreen, BOOL clearBg, 194 BOOL fullscreen, BOOL clearBg,
193 BOOL disable_vsync, BOOL use_gl, 195 BOOL disable_vsync, BOOL use_gl,
194 BOOL ignore_pixel_depth, U32 fsaa_samples) 196 BOOL ignore_pixel_depth, U32 fsaa_samples)
195 : LLWindow(fullscreen, flags), mGamma(1.0f) 197 : LLWindow(fullscreen, flags), Lock_Display(NULL),
198 Unlock_Display(NULL), mGamma(1.0f)
196{ 199{
197 // Initialize the keyboard 200 // Initialize the keyboard
198 gKeyboard = new LLKeyboardSDL(); 201 gKeyboard = new LLKeyboardSDL();
@@ -200,10 +203,6 @@ LLWindowSDL::LLWindowSDL(const std::string& title, S32 x, S32 y, S32 width,
200 203
201 // Ignore use_gl for now, only used for drones on PC 204 // Ignore use_gl for now, only used for drones on PC
202 mWindow = NULL; 205 mWindow = NULL;
203 mCursorDecoupled = FALSE;
204 mCursorLastEventDeltaX = 0;
205 mCursorLastEventDeltaY = 0;
206 mCursorIgnoreNextDelta = FALSE;
207 mNeedsResize = FALSE; 206 mNeedsResize = FALSE;
208 mOverrideAspectRatio = 0.f; 207 mOverrideAspectRatio = 0.f;
209 mGrabbyKeyFlags = 0; 208 mGrabbyKeyFlags = 0;
@@ -272,7 +271,7 @@ static SDL_Surface *Load_BMP_Resource(const char *basename)
272#if LL_X11 271#if LL_X11
273// This is an XFree86/XOrg-specific hack for detecting the amount of Video RAM 272// This is an XFree86/XOrg-specific hack for detecting the amount of Video RAM
274// on this machine. It works by searching /var/log/var/log/Xorg.?.log or 273// on this machine. It works by searching /var/log/var/log/Xorg.?.log or
275// /var/log/XFree86.?.log for a ': (VideoRAM|Memory): (%d+) kB' regex, where 274// /var/log/XFree86.?.log for a ': (VideoRAM ?|Memory): (%d+) kB' regex, where
276// '?' is the X11 display number derived from $DISPLAY 275// '?' is the X11 display number derived from $DISPLAY
277static int x11_detect_VRAM_kb_fp(FILE *fp, const char *prefix_str) 276static int x11_detect_VRAM_kb_fp(FILE *fp, const char *prefix_str)
278{ 277{
@@ -286,6 +285,8 @@ static int x11_detect_VRAM_kb_fp(FILE *fp, const char *prefix_str)
286 // favourite regex implementation - libboost_regex - is 285 // favourite regex implementation - libboost_regex - is
287 // quite a heavy and troublesome dependency for the client, so 286 // quite a heavy and troublesome dependency for the client, so
288 // it seems a shame to introduce it for such a simple task. 287 // it seems a shame to introduce it for such a simple task.
288 // *FIXME: libboost_regex is a dependency now anyway, so we may
289 // as well use it instead of this hand-rolled nonsense.
289 const char *part1_template = prefix_str; 290 const char *part1_template = prefix_str;
290 const char part2_template[] = " kB"; 291 const char part2_template[] = " kB";
291 char *part1 = strstr(line_buf, part1_template); 292 char *part1 = strstr(line_buf, part1_template);
@@ -323,8 +324,7 @@ static int x11_detect_VRAM_kb_fp(FILE *fp, const char *prefix_str)
323 324
324static int x11_detect_VRAM_kb() 325static int x11_detect_VRAM_kb()
325{ 326{
326#if LL_SOLARIS 327#if LL_SOLARIS && defined(__sparc)
327#error Can this be done without an explicit architecture test, ie a test FOR xorg? Was followed by: && defined(__sparc)
328 // NOTE: there's no Xorg server on SPARC so just return 0 328 // NOTE: there's no Xorg server on SPARC so just return 0
329 // and allow SDL to attempt to get the amount of VRAM 329 // and allow SDL to attempt to get the amount of VRAM
330 return(0); 330 return(0);
@@ -363,8 +363,17 @@ static int x11_detect_VRAM_kb()
363 fp = fopen(fname.c_str(), "r"); 363 fp = fopen(fname.c_str(), "r");
364 if (fp) 364 if (fp)
365 { 365 {
366 rtn = x11_detect_VRAM_kb_fp(fp, ": Memory: "); 366 rtn = x11_detect_VRAM_kb_fp(fp, ": Video RAM: ");
367 fclose(fp); 367 fclose(fp);
368 if (0 == rtn)
369 {
370 fp = fopen(fname.c_str(), "r");
371 if (fp)
372 {
373 rtn = x11_detect_VRAM_kb_fp(fp, ": Memory: ");
374 fclose(fp);
375 }
376 }
368 } 377 }
369 } 378 }
370 } 379 }
@@ -420,7 +429,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
420 if (SDL_Init(SDL_INIT_VIDEO) < 0) 429 if (SDL_Init(SDL_INIT_VIDEO) < 0)
421 { 430 {
422 llinfos << "sdl_init() failed! " << SDL_GetError() << llendl; 431 llinfos << "sdl_init() failed! " << SDL_GetError() << llendl;
423 setupFailure("window creation error", "error", OSMB_OK); 432 setupFailure("sdl_init() failure, window creation error", "error", OSMB_OK);
424 return false; 433 return false;
425 } 434 }
426 435
@@ -441,7 +450,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
441 if (!videoInfo) 450 if (!videoInfo)
442 { 451 {
443 llinfos << "SDL_GetVideoInfo() failed! " << SDL_GetError() << llendl; 452 llinfos << "SDL_GetVideoInfo() failed! " << SDL_GetError() << llendl;
444 setupFailure("Window creation error", "Error", OSMB_OK); 453 setupFailure("SDL_GetVideoInfo() failed, Window creation error", "Error", OSMB_OK);
445 return FALSE; 454 return FALSE;
446 } 455 }
447 456
@@ -497,7 +506,6 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
497 // *FIX: try to toggle vsync here? 506 // *FIX: try to toggle vsync here?
498 507
499 mFullscreen = fullscreen; 508 mFullscreen = fullscreen;
500 was_fullscreen = fullscreen;
501 509
502 int sdlflags = SDL_OPENGL | SDL_RESIZABLE | SDL_ANYFORMAT; 510 int sdlflags = SDL_OPENGL | SDL_RESIZABLE | SDL_ANYFORMAT;
503 511
@@ -573,7 +581,6 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
573 if (mWindow) 581 if (mWindow)
574 { 582 {
575 mFullscreen = TRUE; 583 mFullscreen = TRUE;
576 was_fullscreen = TRUE;
577 mFullscreenWidth = mWindow->w; 584 mFullscreenWidth = mWindow->w;
578 mFullscreenHeight = mWindow->h; 585 mFullscreenHeight = mWindow->h;
579 mFullscreenBits = mWindow->format->BitsPerPixel; 586 mFullscreenBits = mWindow->format->BitsPerPixel;
@@ -590,7 +597,6 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
590 llwarns << "createContext: fullscreen creation failure. SDL: " << SDL_GetError() << llendl; 597 llwarns << "createContext: fullscreen creation failure. SDL: " << SDL_GetError() << llendl;
591 // No fullscreen support 598 // No fullscreen support
592 mFullscreen = FALSE; 599 mFullscreen = FALSE;
593 was_fullscreen = FALSE;
594 mFullscreenWidth = -1; 600 mFullscreenWidth = -1;
595 mFullscreenHeight = -1; 601 mFullscreenHeight = -1;
596 mFullscreenBits = -1; 602 mFullscreenBits = -1;
@@ -672,8 +678,8 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
672 // fixme: actually, it's REALLY important for picking that we get at 678 // fixme: actually, it's REALLY important for picking that we get at
673 // least 8 bits each of red,green,blue. Alpha we can be a bit more 679 // least 8 bits each of red,green,blue. Alpha we can be a bit more
674 // relaxed about if we have to. 680 // relaxed about if we have to.
675#if LL_SOLARIS 681#if LL_SOLARIS && defined(__sparc)
676#error && defined(__sparc) 682// again the __sparc required because Xsun support, 32bit are very pricey on SPARC
677 if(colorBits < 24) //HACK: on SPARC allow 24-bit color 683 if(colorBits < 24) //HACK: on SPARC allow 24-bit color
678#else 684#else
679 if (colorBits < 32) 685 if (colorBits < 32)
@@ -681,8 +687,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
681 { 687 {
682 close(); 688 close();
683 setupFailure( 689 setupFailure(
684#if LL_SOLARIS 690#if LL_SOLARIS && defined(__sparc)
685#error && defined(__sparc)
686 "Second Life requires at least 24-bit color on SPARC to run in a window.\n" 691 "Second Life requires at least 24-bit color on SPARC to run in a window.\n"
687 "Please use fbconfig to set your default color depth to 24 bits.\n" 692 "Please use fbconfig to set your default color depth to 24 bits.\n"
688 "You may also need to adjust the X11 setting in SMF. To do so use\n" 693 "You may also need to adjust the X11 setting in SMF. To do so use\n"
@@ -717,9 +722,33 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
717#endif 722#endif
718 723
719#if LL_X11 724#if LL_X11
720 init_x11clipboard(); 725 /* Grab the window manager specific information */
726 SDL_SysWMinfo info;
727 SDL_VERSION(&info.version);
728 if ( SDL_GetWMInfo(&info) )
729 {
730 /* Save the information for later use */
731 if ( info.subsystem == SDL_SYSWM_X11 )
732 {
733 mSDL_Display = info.info.x11.display;
734 mSDL_XWindowID = info.info.x11.wmwindow;
735 Lock_Display = info.info.x11.lock_func;
736 Unlock_Display = info.info.x11.unlock_func;
737 }
738 else
739 {
740 llwarns << "We're not running under X11? Wild."
741 << llendl;
742 }
743 }
744 else
745 {
746 llwarns << "We're not running under any known WM. Wild."
747 << llendl;
748 }
721#endif // LL_X11 749#endif // LL_X11
722 750
751
723 //make sure multisampling is disabled by default 752 //make sure multisampling is disabled by default
724 glDisable(GL_MULTISAMPLE_ARB); 753 glDisable(GL_MULTISAMPLE_ARB);
725 754
@@ -763,8 +792,12 @@ BOOL LLWindowSDL::switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL
763void LLWindowSDL::destroyContext() 792void LLWindowSDL::destroyContext()
764{ 793{
765 llinfos << "destroyContext begins" << llendl; 794 llinfos << "destroyContext begins" << llendl;
795
766#if LL_X11 796#if LL_X11
767 quit_x11clipboard(); 797 mSDL_Display = NULL;
798 mSDL_XWindowID = None;
799 Lock_Display = NULL;
800 Unlock_Display = NULL;
768#endif // LL_X11 801#endif // LL_X11
769 802
770 // Clean up remaining GL state before blowing away window 803 // Clean up remaining GL state before blowing away window
@@ -898,7 +931,6 @@ BOOL LLWindowSDL::getSize(LLCoordScreen *size)
898 return (TRUE); 931 return (TRUE);
899 } 932 }
900 933
901 llwarns << "LLWindowSDL::getPosition(): no window and not fullscreen!" << llendl;
902 return (FALSE); 934 return (FALSE);
903} 935}
904 936
@@ -911,7 +943,6 @@ BOOL LLWindowSDL::getSize(LLCoordWindow *size)
911 return (TRUE); 943 return (TRUE);
912 } 944 }
913 945
914 llwarns << "LLWindowSDL::getPosition(): no window and not fullscreen!" << llendl;
915 return (FALSE); 946 return (FALSE);
916} 947}
917 948
@@ -930,11 +961,18 @@ BOOL LLWindowSDL::setSize(const LLCoordScreen size)
930{ 961{
931 if(mWindow) 962 if(mWindow)
932 { 963 {
933 // *FIX: (???) 964 // Push a resize event onto SDL's queue - we'll handle it
934 //SizeWindow(mWindow, size.mX, size.mY, true); 965 // when it comes out again.
935 } 966 SDL_Event event;
967 event.type = SDL_VIDEORESIZE;
968 event.resize.w = size.mX;
969 event.resize.h = size.mY;
970 SDL_PushEvent(&event); // copied into queue
936 971
937 return TRUE; 972 return TRUE;
973 }
974
975 return FALSE;
938} 976}
939 977
940void LLWindowSDL::swapBuffers() 978void LLWindowSDL::swapBuffers()
@@ -984,11 +1022,7 @@ BOOL LLWindowSDL::isCursorHidden()
984// Constrains the mouse to the window. 1022// Constrains the mouse to the window.
985void LLWindowSDL::setMouseClipping( BOOL b ) 1023void LLWindowSDL::setMouseClipping( BOOL b )
986{ 1024{
987 //llinfos << "LLWindowSDL::setMouseClipping " << b << llendl;
988 // Just stash the requested state. We'll simulate this when the cursor is hidden by decoupling.
989 mIsMouseClipping = b;
990 //SDL_WM_GrabInput(b ? SDL_GRAB_ON : SDL_GRAB_OFF); 1025 //SDL_WM_GrabInput(b ? SDL_GRAB_ON : SDL_GRAB_OFF);
991 adjustCursorDecouple();
992} 1026}
993 1027
994BOOL LLWindowSDL::setCursorPosition(const LLCoordWindow position) 1028BOOL LLWindowSDL::setCursorPosition(const LLCoordWindow position)
@@ -1003,10 +1037,10 @@ BOOL LLWindowSDL::setCursorPosition(const LLCoordWindow position)
1003 1037
1004 //llinfos << "setCursorPosition(" << screen_pos.mX << ", " << screen_pos.mY << ")" << llendl; 1038 //llinfos << "setCursorPosition(" << screen_pos.mX << ", " << screen_pos.mY << ")" << llendl;
1005 1039
1006 SDL_WarpMouse(screen_pos.mX, screen_pos.mY); 1040 // do the actual forced cursor move.
1007 1041 SDL_WarpMouse(screen_pos.mX, screen_pos.mY);
1008 // Under certain circumstances, this will trigger us to decouple the cursor. 1042
1009 adjustCursorDecouple(true); 1043 //llinfos << llformat("llcw %d,%d -> scr %d,%d", position.mX, position.mY, screen_pos.mX, screen_pos.mY) << llendl;
1010 1044
1011 return result; 1045 return result;
1012} 1046}
@@ -1026,33 +1060,6 @@ BOOL LLWindowSDL::getCursorPosition(LLCoordWindow *position)
1026 return convertCoords(screen_pos, position); 1060 return convertCoords(screen_pos, position);
1027} 1061}
1028 1062
1029void LLWindowSDL::adjustCursorDecouple(bool warpingMouse)
1030{
1031 if(mIsMouseClipping && mCursorHidden)
1032 {
1033 if(warpingMouse)
1034 {
1035 // The cursor should be decoupled. Make sure it is.
1036 if(!mCursorDecoupled)
1037 {
1038 // llinfos << "adjustCursorDecouple: decoupling cursor" << llendl;
1039 //CGAssociateMouseAndMouseCursorPosition(false);
1040 mCursorDecoupled = true;
1041 mCursorIgnoreNextDelta = TRUE;
1042 }
1043 }
1044 }
1045 else
1046 {
1047 // The cursor should not be decoupled. Make sure it isn't.
1048 if(mCursorDecoupled)
1049 {
1050 // llinfos << "adjustCursorDecouple: recoupling cursor" << llendl;
1051 //CGAssociateMouseAndMouseCursorPosition(true);
1052 mCursorDecoupled = false;
1053 }
1054 }
1055}
1056 1063
1057F32 LLWindowSDL::getNativeAspectRatio() 1064F32 LLWindowSDL::getNativeAspectRatio()
1058{ 1065{
@@ -1109,24 +1116,28 @@ F32 LLWindowSDL::getPixelAspectRatio()
1109} 1116}
1110 1117
1111 1118
1112// some of this stuff is to support 'temporarily windowed' mode so that 1119// This is to support 'temporarily windowed' mode so that
1113// dialogs are still usable in fullscreen. HOWEVER! - it's not enabled/working 1120// dialogs are still usable in fullscreen.
1114// yet.
1115static LLCoordScreen old_size;
1116static BOOL old_fullscreen;
1117void LLWindowSDL::beforeDialog() 1121void LLWindowSDL::beforeDialog()
1118{ 1122{
1123 bool running_x11 = false;
1124#if LL_X11
1125 running_x11 = (mSDL_XWindowID != None);
1126#endif //LL_X11
1127
1119 llinfos << "LLWindowSDL::beforeDialog()" << llendl; 1128 llinfos << "LLWindowSDL::beforeDialog()" << llendl;
1120 1129
1121 if (SDLReallyCaptureInput(FALSE) // must ungrab input so popup works! 1130 if (SDLReallyCaptureInput(FALSE)) // must ungrab input so popup works!
1122 && getSize(&old_size))
1123 { 1131 {
1124 old_fullscreen = was_fullscreen; 1132 if (mFullscreen)
1125
1126 if (old_fullscreen)
1127 { 1133 {
1128 // NOT YET WORKING 1134 // need to temporarily go non-fullscreen; bless SDL
1129 //switchContext(FALSE, old_size, TRUE); 1135 // for providing a SDL_WM_ToggleFullScreen() - though
1136 // it only works in X11
1137 if (running_x11 && mWindow)
1138 {
1139 SDL_WM_ToggleFullScreen(mWindow);
1140 }
1130 } 1141 }
1131 } 1142 }
1132 1143
@@ -1152,17 +1163,24 @@ void LLWindowSDL::beforeDialog()
1152 1163
1153void LLWindowSDL::afterDialog() 1164void LLWindowSDL::afterDialog()
1154{ 1165{
1166 bool running_x11 = false;
1167#if LL_X11
1168 running_x11 = (mSDL_XWindowID != None);
1169#endif //LL_X11
1170
1155 llinfos << "LLWindowSDL::afterDialog()" << llendl; 1171 llinfos << "LLWindowSDL::afterDialog()" << llendl;
1156 1172
1157 maybe_unlock_display(); 1173 maybe_unlock_display();
1158 1174
1159 if (old_fullscreen && !was_fullscreen) 1175 if (mFullscreen)
1160 { 1176 {
1161 // *FIX: NOT YET WORKING (see below) 1177 // need to restore fullscreen mode after dialog - only works
1162 //switchContext(TRUE, old_size, TRUE); 1178 // in X11
1179 if (running_x11 && mWindow)
1180 {
1181 SDL_WM_ToggleFullScreen(mWindow);
1182 }
1163 } 1183 }
1164 // *FIX: we need to restore the GL context using
1165 // LLViewerWindow::restoreGL() - but how??
1166} 1184}
1167 1185
1168 1186
@@ -1212,506 +1230,50 @@ void LLWindowSDL::flashIcon(F32 seconds)
1212#endif // LL_X11 1230#endif // LL_X11
1213} 1231}
1214 1232
1215#if LL_X11
1216/* Lots of low-level X11 stuff to handle X11 copy-and-paste */
1217
1218/* Our X11 clipboard support is a bit bizarre in various
1219 organically-grown ways. Ideally it should be fixed to do
1220 real string-type negotiation (this would make pasting to
1221 xterm faster and pasting to UTF-8 emacs work properly), but
1222 right now it has the rare and desirable trait of being
1223 generally stable and working. */
1224
1225typedef Atom x11clipboard_type;
1226
1227/* PRIMARY and CLIPBOARD are the two main kinds of
1228 X11 clipboard. A third are the CUT_BUFFERs which an
1229 obsolete holdover from X10 days and use a quite orthogonal
1230 mechanism. CLIPBOARD is the type whose design most
1231 closely matches SL's own win32-alike explicit copy-and-paste
1232 paradigm.
1233
1234 Pragmatically we support all three to varying degrees. When
1235 we paste into SL, it is strictly from CLIPBOARD. When we copy,
1236 we support (to as full an extent as the clipboard content type
1237 allows) CLIPBOARD, PRIMARY, and CUT_BUFFER0.
1238 */
1239static x11clipboard_type get_x11_readwrite_clipboard_type(void)
1240{
1241 return XInternAtom(LLWindowSDL::get_SDL_Display(), "CLIPBOARD", False);
1242}
1243
1244static x11clipboard_type get_x11_write_clipboard_type(void)
1245{
1246 return XA_PRIMARY;
1247}
1248
1249/* This is where our own private cutbuffer goes - we don't use
1250 a regular cutbuffer (XA_CUT_BUFFER0 etc) for intermediate
1251 storage because their use isn't really defined for holding UTF8. */
1252static x11clipboard_type get_x11_cutbuffer_clipboard_type(void)
1253{
1254 return XInternAtom(LLWindowSDL::get_SDL_Display(), "SECONDLIFE_CUTBUFFER", False);
1255}
1256
1257/* Some X11 atom-generators */
1258static Atom get_x11_targets_atom(void)
1259{
1260 return XInternAtom(LLWindowSDL::get_SDL_Display(), "TARGETS", False);
1261}
1262
1263static Atom get_x11_text_atom(void)
1264{
1265 return XInternAtom(LLWindowSDL::get_SDL_Display(), "TEXT", False);
1266}
1267
1268/* These defines, and convert_data/convert_x11clipboard,
1269 mostly exist to support non-text or unusually-encoded
1270 clipboard data, which we don't really have a need for at
1271 the moment. */
1272#define SDLCLIPTYPE(A, B, C, D) (int)(((A)<<24)|((B)<<16)|((C)<<8)|((D)<<0))
1273#define FORMAT_PREFIX "SECONDLIFE_x11clipboard_0x"
1274
1275static
1276x11clipboard_type convert_format(int type)
1277{
1278 if (!gWindowImplementation)
1279 {
1280 llwarns << "!gWindowImplementation in convert_format()"
1281 << llendl;
1282 return XA_STRING;
1283 }
1284
1285 switch (type)
1286 {
1287 case SDLCLIPTYPE('T', 'E', 'X', 'T'):
1288 // old-style X11 clipboard, strictly only ISO 8859-1 encoding
1289 return XA_STRING;
1290 case SDLCLIPTYPE('U', 'T', 'F', '8'):
1291 // newer de-facto UTF8 clipboard atom
1292 return XInternAtom(gWindowImplementation->mSDL_Display,
1293 "UTF8_STRING", False);
1294 default:
1295 {
1296 /* completely arbitrary clipboard types... we don't actually use
1297 these right now, and support is skeletal. */
1298 char format[sizeof(FORMAT_PREFIX)+8+1]; /* Flawfinder: ignore */
1299
1300 snprintf(format, sizeof(format), "%s%08lx", FORMAT_PREFIX, (unsigned long)type);
1301 return XInternAtom(gWindowImplementation->mSDL_Display,
1302 format, False);
1303 }
1304 }
1305}
1306
1307/* convert platform string to x11 clipboard format. for our
1308 purposes this is pretty trivial right now. */
1309static int
1310convert_data(int type, char *dst, const char *src, int srclen)
1311{
1312 int dstlen;
1313
1314 dstlen = 0;
1315 switch (type)
1316 {
1317 case SDLCLIPTYPE('T', 'E', 'X', 'T'):
1318 case SDLCLIPTYPE('U', 'T', 'F', '8'):
1319 if (src == NULL)
1320 {
1321 break;
1322 }
1323 if ( srclen == 0 )
1324 srclen = strlen(src); /* Flawfinder: ignore */
1325
1326 dstlen = srclen + 1;
1327
1328 if ( dst ) // assume caller made it big enough by asking us
1329 {
1330 memcpy(dst, src, srclen); /* Flawfinder: ignore */
1331 dst[srclen] = '\0';
1332 }
1333 break;
1334
1335 default:
1336 llwarns << "convert_data: Unknown medium type" << llendl;
1337 break;
1338 }
1339 return(dstlen);
1340}
1341
1342/* Convert x11clipboard data to platform string. This too is
1343 pretty trivial for our needs right now, and just about identical
1344 to above. */
1345static int
1346convert_x11clipboard(int type, char *dst, const char *src, int srclen)
1347{
1348 int dstlen;
1349
1350 dstlen = 0;
1351 switch (type)
1352 {
1353 case SDLCLIPTYPE('U', 'T', 'F', '8'):
1354 case SDLCLIPTYPE('T', 'E', 'X', 'T'):
1355 if (src == NULL)
1356 {
1357 break;
1358 }
1359 if ( srclen == 0 )
1360 srclen = strlen(src); /* Flawfinder: ignore */
1361
1362 dstlen = srclen + 1;
1363
1364 if ( dst ) // assume caller made it big enough by asking us
1365 {
1366 memcpy(dst, src, srclen); /* Flawfinder: ignore */
1367 dst[srclen] = '\0';
1368 }
1369 break;
1370
1371 default:
1372 llwarns << "convert_x11clipboard: Unknown medium type" << llendl;
1373 break;
1374 }
1375 return dstlen;
1376}
1377
1378int
1379LLWindowSDL::is_empty_x11clipboard(void)
1380{
1381 int retval;
1382
1383 maybe_lock_display();
1384 retval = ( XGetSelectionOwner(mSDL_Display, get_x11_readwrite_clipboard_type()) == None );
1385 maybe_unlock_display();
1386
1387 return(retval);
1388}
1389 1233
1390void 1234#if LL_GTK
1391LLWindowSDL::put_x11clipboard(int type, int srclen, const char *src) 1235BOOL LLWindowSDL::isClipboardTextAvailable()
1392{ 1236{
1393 x11clipboard_type format; 1237 if (ll_try_gtk_init())
1394 int dstlen;
1395 char *dst;
1396
1397 format = convert_format(type);
1398 dstlen = convert_data(type, NULL, src, srclen);
1399
1400 dst = (char *)malloc(dstlen);
1401 if ( dst != NULL )
1402 { 1238 {
1403 maybe_lock_display(); 1239 GtkClipboard * const clipboard =
1404 Window root = DefaultRootWindow(mSDL_Display); 1240 gtk_clipboard_get(GDK_NONE);
1405 convert_data(type, dst, src, srclen); 1241 return gtk_clipboard_wait_is_text_available(clipboard) ?
1406 // Cutbuffers are only allowed to have STRING atom types, 1242 TRUE : FALSE;
1407 // but Emacs puts UTF8 inside them anyway. We cautiously
1408 // don't.
1409 if (type == SDLCLIPTYPE('T','E','X','T'))
1410 {
1411 // dstlen-1 so we don't include the trailing \0
1412 llinfos << "X11: Populating cutbuffer." <<llendl;
1413 XChangeProperty(mSDL_Display, root,
1414 XA_CUT_BUFFER0, XA_STRING, 8, PropModeReplace,
1415 (unsigned char*)dst, dstlen-1);
1416 } else {
1417 // Should we clear the cutbuffer if we can't put the selection in
1418 // it because it's a UTF8 selection? Eh, no great reason I think.
1419 //XDeleteProperty(SDL_Display, root, XA_CUT_BUFFER0);
1420 }
1421 // Private cutbuffer of an appropriate type.
1422 XChangeProperty(mSDL_Display, root,
1423 get_x11_cutbuffer_clipboard_type(), format, 8, PropModeReplace,
1424 (unsigned char*)dst, dstlen-1);
1425 free(dst);
1426
1427 /* Claim ownership of both PRIMARY and CLIPBOARD */
1428 XSetSelectionOwner(mSDL_Display, get_x11_readwrite_clipboard_type(),
1429 mSDL_XWindowID, CurrentTime);
1430 XSetSelectionOwner(mSDL_Display, get_x11_write_clipboard_type(),
1431 mSDL_XWindowID, CurrentTime);
1432
1433 maybe_unlock_display();
1434 } 1243 }
1244 return FALSE; // failure
1435} 1245}
1436 1246
1437void 1247BOOL LLWindowSDL::pasteTextFromClipboard(LLWString &text)
1438LLWindowSDL::get_x11clipboard(int type, int *dstlen, char **dst)
1439{ 1248{
1440 x11clipboard_type format; 1249 if (ll_try_gtk_init())
1441
1442 *dstlen = 0;
1443 format = convert_format(type);
1444
1445 Window owner;
1446 Atom selection;
1447 Atom seln_type;
1448 int seln_format;
1449 unsigned long nbytes;
1450 unsigned long overflow;
1451 char *src;
1452
1453 maybe_lock_display();
1454 owner = XGetSelectionOwner(mSDL_Display, get_x11_readwrite_clipboard_type());
1455 maybe_unlock_display();
1456 if (owner == None)
1457 { 1250 {
1458 // Fall right back to ancient X10 cut-buffers 1251 GtkClipboard * const clipboard =
1459 owner = DefaultRootWindow(mSDL_Display); 1252 gtk_clipboard_get(GDK_NONE);
1460 selection = XA_CUT_BUFFER0; 1253 gchar * const data = gtk_clipboard_wait_for_text(clipboard);
1461 } else if (owner == mSDL_XWindowID) 1254 if (data)
1462 {
1463 // Use our own uncooked opaque string property
1464 owner = DefaultRootWindow(mSDL_Display);
1465 selection = get_x11_cutbuffer_clipboard_type();
1466 }
1467 else
1468 {
1469 // Use full-on X11-style clipboard negotiation with the owning app
1470 int selection_response = 0;
1471 SDL_Event event;
1472
1473 owner = mSDL_XWindowID;
1474 maybe_lock_display();
1475 selection = XInternAtom(mSDL_Display, "SDL_SELECTION", False);
1476 XConvertSelection(mSDL_Display, get_x11_readwrite_clipboard_type(), format,
1477 selection, owner, CurrentTime);
1478 maybe_unlock_display();
1479 llinfos << "X11: Waiting for clipboard to arrive." <<llendl;
1480 while ( ! selection_response )
1481 { 1255 {
1482 // Only look for SYSWMEVENTs, or we may lose keypresses 1256 text = LLWString(utf8str_to_wstring(data));
1483 // etc. 1257 g_free(data);
1484 SDL_PumpEvents(); 1258 return TRUE;
1485 if (1 == SDL_PeepEvents(&event, 1, SDL_GETEVENT,
1486 SDL_SYSWMEVENTMASK) )
1487 {
1488 if ( event.type == SDL_SYSWMEVENT )
1489 {
1490 XEvent xevent =
1491 event.syswm.msg->event.xevent;
1492
1493 if ( (xevent.type == SelectionNotify)&&
1494 (xevent.xselection.requestor == owner) )
1495 selection_response = 1;
1496 }
1497 } else {
1498 llinfos << "X11: Waiting for SYSWM event..." << llendl;
1499 }
1500 }
1501 llinfos << "X11: Clipboard arrived." <<llendl;
1502 }
1503
1504 maybe_lock_display();
1505 if ( XGetWindowProperty(mSDL_Display, owner, selection, 0, INT_MAX/4,
1506 False, format, &seln_type, &seln_format,
1507 &nbytes, &overflow, (unsigned char **)&src) == Success )
1508 {
1509 if ( seln_type == format )
1510 {
1511 *dstlen = convert_x11clipboard(type, NULL, src, nbytes);
1512 *dst = (char *)realloc(*dst, *dstlen);
1513 if ( *dst == NULL )
1514 *dstlen = 0;
1515 else
1516 convert_x11clipboard(type, *dst, src, nbytes);
1517 }
1518 XFree(src);
1519 }
1520 maybe_unlock_display();
1521}
1522
1523int clipboard_filter_callback(const SDL_Event *event)
1524{
1525 /* Post all non-window manager specific events */
1526 if ( event->type != SDL_SYSWMEVENT )
1527 {
1528 return(1);
1529 }
1530
1531 /* Handle window-manager specific clipboard events */
1532 switch (event->syswm.msg->event.xevent.type) {
1533 /* Copy the selection from SECONDLIFE_CUTBUFFER to the requested property */
1534 case SelectionRequest: {
1535 XSelectionRequestEvent *req;
1536 XEvent sevent;
1537 int seln_format;
1538 unsigned long nbytes;
1539 unsigned long overflow;
1540 unsigned char *seln_data;
1541
1542 req = &event->syswm.msg->event.xevent.xselectionrequest;
1543 sevent.xselection.type = SelectionNotify;
1544 sevent.xselection.display = req->display;
1545 sevent.xselection.selection = req->selection;
1546 sevent.xselection.target = None;
1547 sevent.xselection.property = None;
1548 sevent.xselection.requestor = req->requestor;
1549 sevent.xselection.time = req->time;
1550 if ( XGetWindowProperty(LLWindowSDL::get_SDL_Display(), DefaultRootWindow(LLWindowSDL::get_SDL_Display()),
1551 get_x11_cutbuffer_clipboard_type(), 0, INT_MAX/4, False, req->target,
1552 &sevent.xselection.target, &seln_format,
1553 &nbytes, &overflow, &seln_data) == Success )
1554 {
1555 if ( sevent.xselection.target == req->target)
1556 {
1557 if ( sevent.xselection.target == XA_STRING ||
1558 sevent.xselection.target ==
1559 convert_format(SDLCLIPTYPE('U','T','F','8')) )
1560 {
1561 if ( seln_data[nbytes-1] == '\0' )
1562 --nbytes;
1563 }
1564 XChangeProperty(LLWindowSDL::get_SDL_Display(), req->requestor, req->property,
1565 req->target, seln_format, PropModeReplace,
1566 seln_data, nbytes);
1567 sevent.xselection.property = req->property;
1568 } else if (get_x11_targets_atom() == req->target) {
1569 /* only advertise what we currently support */
1570 const int num_supported = 3;
1571 Atom supported[num_supported] = {
1572 XA_STRING, // will be over-written below
1573 get_x11_text_atom(),
1574 get_x11_targets_atom()
1575 };
1576 supported[0] = sevent.xselection.target;
1577 XChangeProperty(LLWindowSDL::get_SDL_Display(), req->requestor,
1578 req->property, XA_ATOM, 32, PropModeReplace,
1579 (unsigned char*)supported,
1580 num_supported);
1581 sevent.xselection.property = req->property;
1582 llinfos << "Clipboard: An app asked us what selections format we offer." << llendl;
1583 } else {
1584 llinfos << "Clipboard: An app requested an unsupported selection format " << req->target << ", we have " << sevent.xselection.target << llendl;
1585 sevent.xselection.target = None;
1586 }
1587 XFree(seln_data);
1588 } 1259 }
1589 int sendret =
1590 XSendEvent(LLWindowSDL::get_SDL_Display(),req->requestor,False,0,&sevent);
1591 if ((sendret==BadValue) || (sendret==BadWindow))
1592 llwarns << "Clipboard SendEvent failed" << llendl;
1593 XSync(LLWindowSDL::get_SDL_Display(), False);
1594 }
1595 break;
1596 } 1260 }
1597 1261 return FALSE; // failure
1598 /* Post the event for X11 clipboard reading above */
1599 return(1);
1600} 1262}
1601 1263
1602int 1264BOOL LLWindowSDL::copyTextToClipboard(const LLWString &text)
1603LLWindowSDL::init_x11clipboard(void)
1604{ 1265{
1605 SDL_SysWMinfo info; 1266 if (ll_try_gtk_init())
1606 int retval;
1607
1608 /* Grab the window manager specific information */
1609 retval = -1;
1610 SDL_SetError("SDL is not running on known window manager");
1611
1612 SDL_VERSION(&info.version);
1613 if ( SDL_GetWMInfo(&info) )
1614 { 1267 {
1615 /* Save the information for later use */ 1268 const std::string utf8 = wstring_to_utf8str(text);
1616 if ( info.subsystem == SDL_SYSWM_X11 ) 1269 GtkClipboard * const clipboard =
1617 { 1270 gtk_clipboard_get(GDK_NONE);
1618 mSDL_Display = info.info.x11.display; 1271 gtk_clipboard_set_text(clipboard, utf8.c_str(), utf8.length());
1619 mSDL_XWindowID = info.info.x11.wmwindow; 1272 return TRUE;
1620 Lock_Display = info.info.x11.lock_func;
1621 Unlock_Display = info.info.x11.unlock_func;
1622
1623 /* Enable the special window hook events */
1624 SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE);
1625 SDL_SetEventFilter(clipboard_filter_callback);
1626
1627 retval = 0;
1628 }
1629 else
1630 {
1631 SDL_SetError("SDL is not running on X11");
1632 }
1633 }
1634 return(retval);
1635}
1636
1637void
1638LLWindowSDL::quit_x11clipboard(void)
1639{
1640 mSDL_Display = NULL;
1641 mSDL_XWindowID = None;
1642 Lock_Display = NULL;
1643 Unlock_Display = NULL;
1644
1645 SDL_SetEventFilter(NULL); // Stop custom event filtering
1646}
1647
1648/************************************************/
1649
1650BOOL LLWindowSDL::isClipboardTextAvailable()
1651{
1652 return !is_empty_x11clipboard();
1653}
1654
1655BOOL LLWindowSDL::pasteTextFromClipboard(LLWString &dst)
1656{
1657 int cliplen; // seems 1 or 2 bytes longer than expected
1658 char *cliptext = NULL;
1659 get_x11clipboard(SDLCLIPTYPE('U','T','F','8'), &cliplen, &cliptext);
1660 if (cliptext)
1661 {
1662 llinfos << "X11: Got UTF8 clipboard text." << llendl;
1663 // at some future time we can use cliplen instead of relying on \0,
1664 // if we ever grok non-ascii, non-utf8 encodings on the clipboard.
1665 std::string clip_str(cliptext);
1666 // we can't necessarily trust the incoming text to be valid UTF-8,
1667 // but utf8str_to_wstring() seems to do an appropriate level of
1668 // validation for avoiding over-reads.
1669 dst = utf8str_to_wstring(clip_str);
1670 /*llinfos << "X11 pasteTextFromClipboard: cliplen=" << cliplen <<
1671 " strlen(cliptext)=" << strlen(cliptext) <<
1672 " clip_str.length()=" << clip_str.length() <<
1673 " dst.length()=" << dst.length() <<
1674 llendl;*/
1675 free(cliptext);
1676 return TRUE; // success
1677 }
1678 get_x11clipboard(SDLCLIPTYPE('T','E','X','T'), &cliplen, &cliptext);
1679 if (cliptext)
1680 {
1681 llinfos << "X11: Got ISO 8859-1 clipboard text." << llendl;
1682 std::string clip_str(cliptext);
1683 std::string utf8_str = rawstr_to_utf8(clip_str);
1684 dst = utf8str_to_wstring(utf8_str);
1685 free(cliptext);
1686 } 1273 }
1687 return FALSE; // failure 1274 return FALSE; // failure
1688} 1275}
1689 1276
1690BOOL LLWindowSDL::copyTextToClipboard(const LLWString &s)
1691{
1692 std::string utf8text = wstring_to_utf8str(s);
1693 const char* cstr = utf8text.c_str();
1694 if (cstr == NULL)
1695 {
1696 return FALSE;
1697 }
1698 int cstrlen = strlen(cstr); /* Flawfinder: ignore */
1699 int i;
1700 for (i=0; i<cstrlen; ++i)
1701 {
1702 if (0x80 & (unsigned char)cstr[i])
1703 {
1704 // Found an 8-bit character; use new-style UTF8 clipboard
1705 llinfos << "X11: UTF8 copyTextToClipboard" << llendl;
1706 put_x11clipboard(SDLCLIPTYPE('U','T','F','8'), cstrlen, cstr);
1707 return TRUE;
1708 }
1709 }
1710 // Didn't find any 8-bit characters; use old-style ISO 8859-1 clipboard
1711 llinfos << "X11: ISO 8859-1 copyTextToClipboard" << llendl;
1712 put_x11clipboard(SDLCLIPTYPE('T','E','X','T'), cstrlen, cstr);
1713 return TRUE;
1714}
1715#else 1277#else
1716 1278
1717BOOL LLWindowSDL::isClipboardTextAvailable() 1279BOOL LLWindowSDL::isClipboardTextAvailable()
@@ -1728,7 +1290,7 @@ BOOL LLWindowSDL::copyTextToClipboard(const LLWString &s)
1728{ 1290{
1729 return FALSE; // unsupported 1291 return FALSE; // unsupported
1730} 1292}
1731#endif // LL_X11 1293#endif // LL_GTK
1732 1294
1733LLWindow::LLWindowResolution* LLWindowSDL::getSupportedResolutions(S32 &num_resolutions) 1295LLWindow::LLWindowResolution* LLWindowSDL::getSupportedResolutions(S32 &num_resolutions)
1734{ 1296{
@@ -1928,7 +1490,7 @@ U32 LLWindowSDL::SDLCheckGrabbyKeys(SDLKey keysym, BOOL gain)
1928 /* part of the fix for SL-13243: Some popular window managers like 1490 /* part of the fix for SL-13243: Some popular window managers like
1929 to totally eat alt-drag for the purposes of moving windows. We 1491 to totally eat alt-drag for the purposes of moving windows. We
1930 spoil their day by acquiring the exclusive X11 mouse lock for as 1492 spoil their day by acquiring the exclusive X11 mouse lock for as
1931 long as LALT is held down, so the window manager can't easily 1493 long as ALT is held down, so the window manager can't easily
1932 see what's happening. Tested successfully with Metacity. 1494 see what's happening. Tested successfully with Metacity.
1933 And... do the same with CTRL, for other darn WMs. We don't 1495 And... do the same with CTRL, for other darn WMs. We don't
1934 care about other metakeys as SL doesn't use them with dragging 1496 care about other metakeys as SL doesn't use them with dragging
@@ -1943,10 +1505,12 @@ U32 LLWindowSDL::SDLCheckGrabbyKeys(SDLKey keysym, BOOL gain)
1943 { 1505 {
1944 case SDLK_LALT: 1506 case SDLK_LALT:
1945 mask = 1U << 0; break; 1507 mask = 1U << 0; break;
1946 case SDLK_LCTRL: 1508 case SDLK_RALT:
1947 mask = 1U << 1; break; 1509 mask = 1U << 1; break;
1948 case SDLK_RCTRL: 1510 case SDLK_LCTRL:
1949 mask = 1U << 2; break; 1511 mask = 1U << 2; break;
1512 case SDLK_RCTRL:
1513 mask = 1U << 3; break;
1950 default: 1514 default:
1951 break; 1515 break;
1952 } 1516 }
@@ -1965,7 +1529,7 @@ U32 LLWindowSDL::SDLCheckGrabbyKeys(SDLKey keysym, BOOL gain)
1965// virtual 1529// virtual
1966void LLWindowSDL::processMiscNativeEvents() 1530void LLWindowSDL::processMiscNativeEvents()
1967{ 1531{
1968#if LL_GTK && (LL_LLMOZLIB_ENABLED || LL_DBUS_ENABLED) 1532#if LL_GTK
1969 // Pump GTK events to avoid starvation for: 1533 // Pump GTK events to avoid starvation for:
1970 // * Embedded Gecko 1534 // * Embedded Gecko
1971 // * DBUS servicing 1535 // * DBUS servicing
@@ -1992,7 +1556,7 @@ void LLWindowSDL::processMiscNativeEvents()
1992 1556
1993 setlocale(LC_ALL, saved_locale.c_str() ); 1557 setlocale(LC_ALL, saved_locale.c_str() );
1994 } 1558 }
1995#endif // LL_GTK && (LL_LLMOZLIB_ENABLED || LL_DBUS_ENABLED) 1559#endif // LL_GTK
1996} 1560}
1997 1561
1998void LLWindowSDL::gatherInput() 1562void LLWindowSDL::gatherInput()
@@ -2086,10 +1650,9 @@ void LLWindowSDL::gatherInput()
2086 mCallbacks->handleMouseDown(this, openGlCoord, mask); 1650 mCallbacks->handleMouseDown(this, openGlCoord, mask);
2087 } 1651 }
2088 1652
2089 else if (event.button.button == SDL_BUTTON_RIGHT) // right ... yes, it's 3, not 2, in SDL... 1653 else if (event.button.button == SDL_BUTTON_RIGHT) // right
2090 { 1654 {
2091 // right double click isn't handled right now in Second Life ... if (isDoubleClick) 1655 mCallbacks->handleRightMouseDown(this, openGlCoord, mask);
2092 mCallbacks->handleRightMouseDown(this, openGlCoord, mask);
2093 } 1656 }
2094 1657
2095 else if (event.button.button == SDL_BUTTON_MIDDLE) // middle 1658 else if (event.button.button == SDL_BUTTON_MIDDLE) // middle
@@ -2112,13 +1675,11 @@ void LLWindowSDL::gatherInput()
2112 MASK mask = gKeyboard->currentMask(TRUE); 1675 MASK mask = gKeyboard->currentMask(TRUE);
2113 1676
2114 if (event.button.button == SDL_BUTTON_LEFT) // left 1677 if (event.button.button == SDL_BUTTON_LEFT) // left
2115 mCallbacks->handleMouseUp(this, openGlCoord, mask); 1678 mCallbacks->handleMouseUp(this, openGlCoord, mask);
2116 else if (event.button.button == SDL_BUTTON_RIGHT) // right ... yes, it's 3, not 2, in SDL... 1679 else if (event.button.button == SDL_BUTTON_RIGHT) // right
2117 mCallbacks->handleRightMouseUp(this, openGlCoord, mask); 1680 mCallbacks->handleRightMouseUp(this, openGlCoord, mask);
2118 else if (event.button.button == SDL_BUTTON_MIDDLE) // middle 1681 else if (event.button.button == SDL_BUTTON_MIDDLE) // middle
2119 {
2120 mCallbacks->handleMiddleMouseUp(this, openGlCoord, mask); 1682 mCallbacks->handleMiddleMouseUp(this, openGlCoord, mask);
2121 }
2122 // don't handle mousewheel here... 1683 // don't handle mousewheel here...
2123 1684
2124 break; 1685 break;
@@ -2162,12 +1723,12 @@ void LLWindowSDL::gatherInput()
2162 // which confuses the focus code [SL-24071]. 1723 // which confuses the focus code [SL-24071].
2163 if (event.active.gain != mHaveInputFocus) 1724 if (event.active.gain != mHaveInputFocus)
2164 { 1725 {
2165 if (event.active.gain) 1726 mHaveInputFocus = !!event.active.gain;
1727
1728 if (mHaveInputFocus)
2166 mCallbacks->handleFocus(this); 1729 mCallbacks->handleFocus(this);
2167 else 1730 else
2168 mCallbacks->handleFocusLost(this); 1731 mCallbacks->handleFocusLost(this);
2169
2170 mHaveInputFocus = !!event.active.gain;
2171 } 1732 }
2172 } 1733 }
2173 if (event.active.state & SDL_APPACTIVE) 1734 if (event.active.state & SDL_APPACTIVE)
@@ -2175,10 +1736,10 @@ void LLWindowSDL::gatherInput()
2175 // Change in iconification/minimization state. 1736 // Change in iconification/minimization state.
2176 if ((!event.active.gain) != mIsMinimized) 1737 if ((!event.active.gain) != mIsMinimized)
2177 { 1738 {
2178 mCallbacks->handleActivate(this, !!event.active.gain);
2179 llinfos << "SDL deiconification state switched to " << BOOL(event.active.gain) << llendl;
2180
2181 mIsMinimized = (!event.active.gain); 1739 mIsMinimized = (!event.active.gain);
1740
1741 mCallbacks->handleActivate(this, !mIsMinimized);
1742 llinfos << "SDL deiconification state switched to " << BOOL(event.active.gain) << llendl;
2182 } 1743 }
2183 else 1744 else
2184 { 1745 {
@@ -2426,8 +1987,6 @@ void LLWindowSDL::hideCursor()
2426 { 1987 {
2427 // llinfos << "hideCursor: already hidden" << llendl; 1988 // llinfos << "hideCursor: already hidden" << llendl;
2428 } 1989 }
2429
2430 adjustCursorDecouple();
2431} 1990}
2432 1991
2433void LLWindowSDL::showCursor() 1992void LLWindowSDL::showCursor()
@@ -2443,8 +2002,6 @@ void LLWindowSDL::showCursor()
2443 { 2002 {
2444 // llinfos << "showCursor: already visible" << llendl; 2003 // llinfos << "showCursor: already visible" << llendl;
2445 } 2004 }
2446
2447 adjustCursorDecouple();
2448} 2005}
2449 2006
2450void LLWindowSDL::showCursorFromMouseMove() 2007void LLWindowSDL::showCursorFromMouseMove()
@@ -2510,10 +2067,7 @@ S32 OSMessageBoxSDL(const std::string& text, const std::string& caption, U32 typ
2510 if(gWindowImplementation != NULL) 2067 if(gWindowImplementation != NULL)
2511 gWindowImplementation->beforeDialog(); 2068 gWindowImplementation->beforeDialog();
2512 2069
2513 if (LLWindowSDL::ll_try_gtk_init() 2070 if (LLWindowSDL::ll_try_gtk_init())
2514 // We can NOT expect to combine GTK and SDL's aggressive fullscreen
2515 && ((NULL==gWindowImplementation) || (!was_fullscreen))
2516 )
2517 { 2071 {
2518 GtkWidget *win = NULL; 2072 GtkWidget *win = NULL;
2519 2073
@@ -2618,10 +2172,7 @@ BOOL LLWindowSDL::dialog_color_picker ( F32 *r, F32 *g, F32 *b)
2618 2172
2619 beforeDialog(); 2173 beforeDialog();
2620 2174
2621 if (ll_try_gtk_init() 2175 if (ll_try_gtk_init())
2622 // We can NOT expect to combine GTK and SDL's aggressive fullscreen
2623 && !was_fullscreen
2624 )
2625 { 2176 {
2626 GtkWidget *win = NULL; 2177 GtkWidget *win = NULL;
2627 2178
@@ -2804,7 +2355,7 @@ void LLWindowSDL::bringToFront()
2804} 2355}
2805 2356
2806//static 2357//static
2807std::string LLWindowSDL::getFontListSans() 2358std::vector<std::string> LLWindowSDL::getDynamicFallbackFontList()
2808{ 2359{
2809 // Use libfontconfig to find us a nice ordered list of fallback fonts 2360 // Use libfontconfig to find us a nice ordered list of fallback fonts
2810 // specific to this system. 2361 // specific to this system.
@@ -2821,7 +2372,7 @@ std::string LLWindowSDL::getFontListSans()
2821 // renderable range if for some reason our FreeType actually fails 2372 // renderable range if for some reason our FreeType actually fails
2822 // to use some of the fonts we want it to. 2373 // to use some of the fonts we want it to.
2823 const bool elide_unicode_coverage = true; 2374 const bool elide_unicode_coverage = true;
2824 std::string rtn; 2375 std::vector<std::string> rtns;
2825 FcFontSet *fs = NULL; 2376 FcFontSet *fs = NULL;
2826 FcPattern *sortpat = NULL; 2377 FcPattern *sortpat = NULL;
2827 int font_count = 0; 2378 int font_count = 0;
@@ -2855,7 +2406,8 @@ std::string LLWindowSDL::getFontListSans()
2855 if (!FcInit()) 2406 if (!FcInit())
2856 { 2407 {
2857 llwarns << "FontConfig failed to initialize." << llendl; 2408 llwarns << "FontConfig failed to initialize." << llendl;
2858 return final_fallback; 2409 rtns.push_back(final_fallback);
2410 return rtns;
2859 } 2411 }
2860 2412
2861 sortpat = FcNameParse((FcChar8*) sort_order.c_str()); 2413 sortpat = FcNameParse((FcChar8*) sort_order.c_str());
@@ -2880,17 +2432,24 @@ std::string LLWindowSDL::getFontListSans()
2880 &filename) 2432 &filename)
2881 && filename) 2433 && filename)
2882 { 2434 {
2883 rtn += std::string((const char*)filename)+";"; 2435 rtns.push_back(std::string((const char*)filename));
2884 ++font_count; 2436 ++font_count;
2885 } 2437 }
2886 } 2438 }
2887 FcFontSetDestroy (fs); 2439 FcFontSetDestroy (fs);
2888 } 2440 }
2889 2441
2890 lldebugs << "Using font list: " << rtn << llendl; 2442 lldebugs << "Using font list: " << llendl;
2443 for (std::vector<std::string>::iterator it = rtns.begin();
2444 it != rtns.end();
2445 ++it)
2446 {
2447 lldebugs << " file: " << *it << llendl;
2448 }
2891 llinfos << "Using " << font_count << " system font(s)." << llendl; 2449 llinfos << "Using " << font_count << " system font(s)." << llendl;
2892 2450
2893 return rtn + final_fallback; 2451 rtns.push_back(final_fallback);
2452 return rtns;
2894} 2453}
2895 2454
2896#endif // LL_SDL 2455#endif // LL_SDL
diff --git a/linden/indra/llwindow/llwindowsdl.h b/linden/indra/llwindow/llwindowsdl.h
index 36baec6..cebb151 100644
--- a/linden/indra/llwindow/llwindowsdl.h
+++ b/linden/indra/llwindow/llwindowsdl.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -118,12 +119,11 @@ public:
118 119
119 /*virtual*/ void spawnWebBrowser(const std::string& escaped_url); 120 /*virtual*/ void spawnWebBrowser(const std::string& escaped_url);
120 121
121 static std::string getFontListSans(); 122 static std::vector<std::string> getDynamicFallbackFontList();
122 123
123 // Not great that these are public, but they have to be accessible 124 // Not great that these are public, but they have to be accessible
124 // by non-class code and it's better than making them global. 125 // by non-class code and it's better than making them global.
125#if LL_X11 126#if LL_X11
126 // These are set up by the X11 clipboard initialization code
127 Window mSDL_XWindowID; 127 Window mSDL_XWindowID;
128 Display *mSDL_Display; 128 Display *mSDL_Display;
129#endif 129#endif
@@ -173,7 +173,6 @@ protected:
173 BOOL createContext(int x, int y, int width, int height, int bits, BOOL fullscreen, BOOL disable_vsync); 173 BOOL createContext(int x, int y, int width, int height, int bits, BOOL fullscreen, BOOL disable_vsync);
174 void destroyContext(); 174 void destroyContext();
175 void setupFailure(const std::string& text, const std::string& caption, U32 type); 175 void setupFailure(const std::string& text, const std::string& caption, U32 type);
176 void adjustCursorDecouple(bool warpingMouse = false);
177 void fixWindowSize(void); 176 void fixWindowSize(void);
178 U32 SDLCheckGrabbyKeys(SDLKey keysym, BOOL gain); 177 U32 SDLCheckGrabbyKeys(SDLKey keysym, BOOL gain);
179 BOOL SDLReallyCaptureInput(BOOL capture); 178 BOOL SDLReallyCaptureInput(BOOL capture);
@@ -186,10 +185,6 @@ protected:
186 SDL_Surface * mWindow; 185 SDL_Surface * mWindow;
187 std::string mWindowTitle; 186 std::string mWindowTitle;
188 double mOriginalAspectRatio; 187 double mOriginalAspectRatio;
189 BOOL mCursorDecoupled;
190 S32 mCursorLastEventDeltaX;
191 S32 mCursorLastEventDeltaY;
192 BOOL mCursorIgnoreNextDelta;
193 BOOL mNeedsResize; // Constructor figured out the window is too big, it needs a resize. 188 BOOL mNeedsResize; // Constructor figured out the window is too big, it needs a resize.
194 LLCoordScreen mNeedsResizeSize; 189 LLCoordScreen mNeedsResizeSize;
195 F32 mOverrideAspectRatio; 190 F32 mOverrideAspectRatio;
@@ -206,12 +201,6 @@ protected:
206 201
207#if LL_X11 202#if LL_X11
208private: 203private:
209 // more X11 clipboard stuff
210 int init_x11clipboard(void);
211 void quit_x11clipboard(void);
212 int is_empty_x11clipboard(void);
213 void put_x11clipboard(int type, int srclen, const char *src);
214 void get_x11clipboard(int type, int *dstlen, char **dst);
215 void x11_set_urgent(BOOL urgent); 204 void x11_set_urgent(BOOL urgent);
216 BOOL mFlashing; 205 BOOL mFlashing;
217 LLTimer mFlashTimer; 206 LLTimer mFlashTimer;
diff --git a/linden/indra/llwindow/llwindowwin32.cpp b/linden/indra/llwindow/llwindowwin32.cpp
index 2944511..6280868 100644
--- a/linden/indra/llwindow/llwindowwin32.cpp
+++ b/linden/indra/llwindow/llwindowwin32.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -372,6 +373,8 @@ LLWindowWin32::LLWindowWin32(const std::string& title, const std::string& name,
372 mMousePositionModified = FALSE; 373 mMousePositionModified = FALSE;
373 mInputProcessingPaused = FALSE; 374 mInputProcessingPaused = FALSE;
374 mPreeditor = NULL; 375 mPreeditor = NULL;
376 mhDC = NULL;
377 mhRC = NULL;
375 378
376 // Initialize the keyboard 379 // Initialize the keyboard
377 gKeyboard = new LLKeyboardWin32(); 380 gKeyboard = new LLKeyboardWin32();
@@ -417,7 +420,7 @@ LLWindowWin32::LLWindowWin32(const std::string& title, const std::string& name,
417 mhInstance = GetModuleHandle(NULL); 420 mhInstance = GetModuleHandle(NULL);
418 mWndProc = NULL; 421 mWndProc = NULL;
419 422
420 mSwapMethod = SWAP_METHOD_EXCHANGE; 423 mSwapMethod = SWAP_METHOD_UNDEFINED;
421 424
422 // No WPARAM yet. 425 // No WPARAM yet.
423 mLastSizeWParam = 0; 426 mLastSizeWParam = 0;
@@ -843,8 +846,13 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
843 RECT window_rect; 846 RECT window_rect;
844 S32 width = size.mX; 847 S32 width = size.mX;
845 S32 height = size.mY; 848 S32 height = size.mY;
849 BOOL auto_show = FALSE;
846 850
847 resetDisplayResolution(); 851 if (mhRC)
852 {
853 auto_show = TRUE;
854 resetDisplayResolution();
855 }
848 856
849 if (EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dev_mode)) 857 if (EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dev_mode))
850 { 858 {
@@ -1182,8 +1190,28 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
1182 LL_INFOS("Window") << "Choosing pixel formats: " << num_formats << " pixel formats returned" << LL_ENDL; 1190 LL_INFOS("Window") << "Choosing pixel formats: " << num_formats << " pixel formats returned" << LL_ENDL;
1183 } 1191 }
1184 1192
1185 pixel_format = pixel_formats[0]; 1193
1194
1195 S32 swap_method = 0;
1196 S32 cur_format = num_formats-1;
1197 GLint swap_query = WGL_SWAP_METHOD_ARB;
1198
1199 BOOL found_format = FALSE;
1186 1200
1201 while (!found_format && wglGetPixelFormatAttribivARB(mhDC, pixel_format, 0, 1, &swap_query, &swap_method))
1202 {
1203 if (swap_method == WGL_SWAP_UNDEFINED_ARB || cur_format <= 0)
1204 {
1205 found_format = TRUE;
1206 }
1207 else
1208 {
1209 --cur_format;
1210 }
1211 }
1212
1213 pixel_format = pixel_formats[cur_format];
1214
1187 if (mhDC != 0) // Does The Window Have A Device Context? 1215 if (mhDC != 0) // Does The Window Have A Device Context?
1188 { 1216 {
1189 wglMakeCurrent(mhDC, 0); // Set The Current Active Rendering Context To Zero 1217 wglMakeCurrent(mhDC, 0); // Set The Current Active Rendering Context To Zero
@@ -1226,9 +1254,6 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
1226 return FALSE; 1254 return FALSE;
1227 } 1255 }
1228 1256
1229 int swap_method = 0;
1230 GLint swap_query = WGL_SWAP_METHOD_ARB;
1231
1232 if (wglGetPixelFormatAttribivARB(mhDC, pixel_format, 0, 1, &swap_query, &swap_method)) 1257 if (wglGetPixelFormatAttribivARB(mhDC, pixel_format, 0, 1, &swap_query, &swap_method))
1233 { 1258 {
1234 switch (swap_method) 1259 switch (swap_method)
@@ -1341,13 +1366,21 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
1341 } 1366 }
1342 1367
1343 SetWindowLong(mWindowHandle, GWL_USERDATA, (U32)this); 1368 SetWindowLong(mWindowHandle, GWL_USERDATA, (U32)this);
1344 show(); 1369
1345
1346 //register joystick timer callback 1370 //register joystick timer callback
1347 SetTimer( mWindowHandle, 0, 1000 / 30, NULL ); // 30 fps timer 1371 SetTimer( mWindowHandle, 0, 1000 / 30, NULL ); // 30 fps timer
1348 1372
1349 // ok to post quit messages now 1373 // ok to post quit messages now
1350 mPostQuit = TRUE; 1374 mPostQuit = TRUE;
1375
1376 if (auto_show)
1377 {
1378 show();
1379 glClearColor(0.0f, 0.0f, 0.0f, 0.f);
1380 glClear(GL_COLOR_BUFFER_BIT);
1381 swapBuffers();
1382 }
1383
1351 return TRUE; 1384 return TRUE;
1352} 1385}
1353 1386
@@ -2930,7 +2963,7 @@ void LLWindowWin32::spawnWebBrowser(const std::string& escaped_url )
2930 /* 2963 /*
2931 std::string reg_path_str = gURLProtocolWhitelistHandler[i] + "\\shell\\open\\command"; 2964 std::string reg_path_str = gURLProtocolWhitelistHandler[i] + "\\shell\\open\\command";
2932 WCHAR reg_path_wstr[256]; 2965 WCHAR reg_path_wstr[256];
2933 mbstowcs(reg_path_wstr, reg_path_str.c_str(), sizeof(reg_path_wstr)/sizeof(reg_path_wstr[0])); 2966 mbstowcs( reg_path_wstr, reg_path_str.c_str(), LL_ARRAY_SIZE(reg_path_wstr) );
2934 2967
2935 HKEY key; 2968 HKEY key;
2936 WCHAR browser_open_wstr[1024]; 2969 WCHAR browser_open_wstr[1024];
@@ -3621,11 +3654,10 @@ BOOL LLWindowWin32::handleImeRequests(U32 request, U32 param, LRESULT *result)
3621} 3654}
3622 3655
3623//static 3656//static
3624std::string LLWindowWin32::getFontListSans() 3657std::vector<std::string> LLWindowWin32::getDynamicFallbackFontList()
3625{ 3658{
3626 // Lists Japanese, Korean, and Chinese sanserif fonts available in 3659 // Fonts previously in getFontListSans() have moved to fonts.xml.
3627 // Windows XP and Vista, as well as "Arial Unicode MS". 3660 return std::vector<std::string>();
3628 return "MSGOTHIC.TTC;gulim.ttc;simhei.ttf;ArialUni.ttf";
3629} 3661}
3630 3662
3631 3663
diff --git a/linden/indra/llwindow/llwindowwin32.h b/linden/indra/llwindow/llwindowwin32.h
index 795fc79..237f834 100644
--- a/linden/indra/llwindow/llwindowwin32.h
+++ b/linden/indra/llwindow/llwindowwin32.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -111,7 +112,7 @@ public:
111 /*virtual*/ void interruptLanguageTextInput(); 112 /*virtual*/ void interruptLanguageTextInput();
112 /*virtual*/ void spawnWebBrowser(const std::string& escaped_url); 113 /*virtual*/ void spawnWebBrowser(const std::string& escaped_url);
113 114
114 static std::string getFontListSans(); 115 static std::vector<std::string> getDynamicFallbackFontList();
115 116
116protected: 117protected:
117 LLWindowWin32( 118 LLWindowWin32(