Compare commits

...
246 Commits
Author SHA1 Message Date
twinaphex 8e8bdaaab3 Update CHANGES.md 2017-08-18 02:52:46 +02:00
Brad Parker 6c91c39aae glui: fix entry box highlight calculation 2017-08-17 20:49:21 -04:00
Twinaphex 59aaabb9bf Merge pull request #5324 from theheroGAC/patch-13
Updated the MATERIALUI translation
2017-08-18 02:49:32 +02:00
Twinaphex 456e1b033f Merge pull request #5326 from heuripedes/xmb-improv
Xmb improvements
2017-08-18 02:40:17 +02:00
Higor Eurípedes 0d59994c42 (xmb) Only iterate over visible items in xmb_render() 2017-08-17 21:36:48 -03:00
Higor Eurípedes ea9991f749 (xmb) Detect non-visible items before drawing 2017-08-17 21:36:48 -03:00
Brad Parker 139d95c563 FreeBSD buildfix 2017-08-17 20:28:47 -04:00
theheroGAC 87b4576e78 Update msg_hash_it.h 2017-08-18 02:13:28 +02:00
theheroGAC e70c15e641 Updated the MATERIALUI translation 2017-08-17 23:57:52 +02:00
twinaphex 73e00e021a Bump up version to 1.6.7 2017-08-17 21:09:42 +02:00
twinaphex b4912db587 Update CHANGES.md 2017-08-17 21:07:16 +02:00
twinaphex 6fc48a39d9 (MaterialUI) Add Menu Icons Enable setting 2017-08-17 21:05:38 +02:00
twinaphex 6d3292945e Update CHANGES.md 2017-08-17 20:04:17 +02:00
Brad Parker 9242cdeda9 glui: subtract icon size from word wrap width if one is used 2017-08-17 14:02:41 -04:00
twinaphex 7a402b97ec Italian language build fixes 2017-08-17 20:01:34 +02:00
Twinaphex d4ffc6801f Merge pull request #5321 from theheroGAC/patch-12
Fixed translation errors
2017-08-17 20:00:16 +02:00
theheroGAC dff78cf0cc Fixed translation errors 2017-08-17 19:57:00 +02:00
twinaphex 4e37b784d2 Update CHANGES.md 2017-08-17 19:27:59 +02:00
twinaphex 828f4aa8b9 (materialUI) Add disk image append icons 2017-08-17 19:24:23 +02:00
twinaphex 6952d6bd12 Update CHANGES.md 2017-08-17 19:10:23 +02:00
twinaphex 366c73f429 Fix 'Append Disk Image' 2017-08-17 19:07:38 +02:00
twinaphex 5909d72a09 Fix 'Scan File' 2017-08-17 18:53:55 +02:00
Twinaphex 8e2689fca2 Merge pull request #5318 from theheroGAC/patch-11
Updated translation of some strings and tabs
2017-08-17 18:17:39 +02:00
twinaphex 33a2d58891 Fix 'Scan Directory' 2017-08-17 18:16:33 +02:00
theheroGAC 04b8f0584e Update msg_hash_it.h 2017-08-17 10:55:20 +02:00
theheroGAC 4af569fbcc Updated translation of some strings and tabs 2017-08-17 10:18:13 +02:00
Twinaphex e3818d50ac Merge pull request #5315 from ensra/master
Fix db build
2017-08-17 02:51:27 +02:00
ensra 4dcb151f03 Fix db build 2017-08-17 01:06:18 +01:00
twinaphex e56250c84f C89_BUILD fix 2017-08-17 01:41:30 +02:00
Twinaphex c08fc10ba4 Merge pull request #5314 from theheroGAC/patch-10
Missing strings added
2017-08-17 01:21:43 +02:00
twinaphex a795237898 Add some last-minute icons 2017-08-17 01:03:30 +02:00
theheroGAC 8dbafceebe Missing strings added 2017-08-17 01:00:59 +02:00
twinaphex 47cf178309 Bump up version to 1.6.6 2017-08-16 23:59:15 +02:00
twinaphex adc3b4b726 Playlist file needs to be written to when we add an entry to
Favorites
2017-08-16 22:43:42 +02:00
twinaphex e743875de2 Enable 'Show Physical Inputs' 2017-08-16 22:30:15 +02:00
twinaphex 8acd734be2 Remove some hash labels 2017-08-16 19:20:24 +02:00
twinaphex d0e24b02b4 Update 2017-08-16 19:10:07 +02:00
twinaphex a243278f53 Get rid of more hash labels 2017-08-16 19:06:14 +02:00
twinaphex 887364062a Get rid of more hash labels 2017-08-16 19:00:15 +02:00
twinaphex d1f0f19824 (menu_cbs_label.c) Cut down on code duplication 2017-08-16 18:51:44 +02:00
twinaphex b8008d74e5 Get rid of some hash labels 2017-08-16 18:47:29 +02:00
twinaphex 2a1c8c7a6c Update menu_cbs_title.c 2017-08-16 18:43:08 +02:00
twinaphex ef83954376 Fix relative header include 2017-08-16 09:00:36 +02:00
twinaphex 7a44d29ed4 Only show video entries when HAVE_FFMPEG is enabled 2017-08-16 08:50:46 +02:00
twinaphex 877d14b1e7 Fix playlist updating 2017-08-16 08:01:35 +02:00
twinaphex 494e229b03 Refactor this 2017-08-16 07:46:43 +02:00
twinaphex 1093c1bac8 (XMB) Fix black box regression 2017-08-16 05:52:59 +02:00
twinaphex 0eb78a26b3 Let's try to implement the message inside intl/msg_hash_us.c instead -
we need to get index from somewhere
2017-08-16 05:45:51 +02:00
Twinaphex 442339a63e Merge pull request #5307 from fr500/master
Start adding descriptions to lobbies
2017-08-16 05:24:52 +02:00
Twinaphex 1a3d79b458 Merge pull request #5306 from heuripedes/master
(xmb) Fix crash
2017-08-16 04:20:59 +02:00
radius f54a834ada update CHANGES.md 2017-08-15 21:07:10 -05:00
radius 6804432fa7 log address family, fix inet_ntop_compat 2017-08-15 21:03:59 -05:00
radius 6f4697d60f start adding descriptions for netplay rooms 2017-08-15 21:03:59 -05:00
twinaphex cf7fd7b34b Shorten sublabel for Information 2017-08-16 03:18:18 +02:00
twinaphex 5c7fd82a40 Add Music/Image/Video lists for MaterialUI and RGUI 2017-08-16 03:15:04 +02:00
Higor Eurípedes db48561289 (xmb) Fix crash 2017-08-15 21:34:49 -03:00
twinaphex 0d86027cd5 (RGUI) Add Load Content -> Favorites 2017-08-16 01:10:27 +02:00
twinaphex e32ec709b3 Added 'Favorites' to MaterialUI playlists tab 2017-08-16 00:01:56 +02:00
twinaphex 89b695dae3 Tweak Dark Blue a bit 2017-08-15 22:52:18 +02:00
twinaphex ef79711837 (MaterialUI) Hook up framebuffer opacity 2017-08-15 22:43:09 +02:00
twinaphex 5c6b230e42 Start adding separate setting 'framebuffer_opacity' 2017-08-15 22:17:02 +02:00
Twinaphex b2fd9c5b05 Merge pull request #5305 from RobLoach/joypadprofiles
Rename "Update Autoconfig Profiles" to "Update Joypad Profiles"
2017-08-15 20:12:38 +02:00
twinaphex 1887862a03 (MaterialUI) Update 2017-08-15 19:52:50 +02:00
Rob Loach a66f9249df Fix "Update Autoconfig Profiles" to "Update Joypad Profiles"
Fixes #2680
2017-08-15 13:43:41 -04:00
twinaphex c438e556b1 (MaterialUI) Update icons 2017-08-15 19:40:49 +02:00
twinaphex 990f746aee (MaterialUI) Update icons 2017-08-15 19:34:34 +02:00
twinaphex b760a407fd (MaterialUI) Add icons 2017-08-15 19:20:16 +02:00
twinaphex e34f8e0911 Update 2017-08-15 19:05:23 +02:00
twinaphex f1069ee7ed (MaterialUI) Update 2017-08-15 19:02:58 +02:00
twinaphex 573cf1df1a (MAterialUI) use white icons for shield theme 2017-08-15 18:11:47 +02:00
twinaphex 09cf3262f1 (RGUI) Cleanups 2017-08-15 17:56:42 +02:00
twinaphex ade279c0ba (RGUI) Cleanups 2017-08-15 17:51:08 +02:00
Twinaphex a73695aca9 Merge pull request #5303 from rz5/master
(materialui.c) New struct to hold all theme-related info
2017-08-15 17:36:13 +02:00
r5 31317f7cbf (materialui.c) New struct to hold all theme-related info
Struct should be used to group together variables that
control font/bg/fg/highlight/icon colors.
2017-08-15 16:32:39 +01:00
Twinaphex 09c980c645 Merge pull request #5301 from theheroGAC/patch-9
Update some strings
2017-08-15 10:25:02 +02:00
twinaphex 19efd41164 Add more icons 2017-08-15 10:06:52 +02:00
theheroGAC e4a8793dcc Update some strings 2017-08-15 09:57:13 +02:00
twinaphex 5de11039c6 Updates 2017-08-15 09:02:55 +02:00
twinaphex aad8e551fe Add more icons 2017-08-15 08:52:04 +02:00
twinaphex 27966879b0 (MaterialUI) Add more icons 2017-08-15 08:16:32 +02:00
twinaphex ea16a51342 Add icons 2017-08-15 07:47:17 +02:00
twinaphex 1bcec096bb Update icons 2017-08-15 07:27:15 +02:00
twinaphex 64686b46b1 Add icons 2017-08-15 07:08:55 +02:00
twinaphex c5c5af0507 Add more icons 2017-08-15 06:42:48 +02:00
twinaphex 14f7ee6116 Add new icons 2017-08-15 06:01:35 +02:00
twinaphex b40f59a6ec (MaterialUI) Add audio icon 2017-08-15 05:42:44 +02:00
twinaphex 950264e89e Fix setting the path 2017-08-15 05:30:57 +02:00
twinaphex 28ade72baf (MaterialUI) Cleanups 2017-08-15 05:23:54 +02:00
twinaphex 07dd7c8ccb Cleanups 2017-08-15 05:15:45 +02:00
twinaphex e9d738226a (MaterialUI) Some more refinements 2017-08-15 04:41:17 +02:00
twinaphex db24e4da42 Try to avoid countless string_is_equal function calls
being called multiple times per frame render - prebake
these decisions instead inside list_insert
2017-08-15 04:33:36 +02:00
twinaphex f608ac3556 (MaterialUI) small performance improvements 2017-08-15 03:24:07 +02:00
twinaphex a0859229f9 Locally cache menu_display_get_dpi inside a variable 2017-08-15 03:11:39 +02:00
twinaphex 8fc6427d0e Don't use menu_entries_get_end() inside for loop epilogue 2017-08-15 03:06:40 +02:00
twinaphex 058116b8da Add more labels 2017-08-15 03:00:49 +02:00
twinaphex 00ae975c6f (materialui) Add another icon 2017-08-15 01:21:20 +02:00
twinaphex 28147d8aa6 Add another icon 2017-08-15 01:11:37 +02:00
twinaphex 777308c42c Add icon 2017-08-15 00:35:36 +02:00
twinaphex 736477d4e4 (MaterialUI) Add icons 2017-08-15 00:24:02 +02:00
twinaphex e060029d4c (MaterialUI) Update icons 2017-08-14 23:51:52 +02:00
twinaphex 559fabeb08 (MaterialUI) Add more icons 2017-08-14 23:31:04 +02:00
twinaphex 4c877148fe (MaterialUI) Add image icon 2017-08-14 23:13:25 +02:00
twinaphex 648cf89893 Start using a second icon at the lefthand side 2017-08-14 23:05:51 +02:00
twinaphex c2c98184e6 Update CHANGES.md 2017-08-14 20:10:22 +02:00
twinaphex 147374c9c1 You can now rename playlist entries 2017-08-14 20:07:43 +02:00
twinaphex fd0c9fb9c1 Start adding entries for renaming entry 2017-08-14 19:40:25 +02:00
twinaphex 24878694f8 Silence some warnings 2017-08-14 07:13:50 +02:00
Twinaphex e262ae3326 Merge pull request #5297 from RobLoach/world
Remove TODO note for Show Favorites
2017-08-14 03:37:42 +02:00
Rob Loach 91d1b18124 Remove TODO note for Show Favorites 2017-08-13 21:30:29 -04:00
Twinaphex 8d4e06856b Merge pull request #5296 from RobLoach/favorites
Add to Favorites
2017-08-14 03:23:55 +02:00
Rob Loach 7c54cebfb3 Merge branch 'master' of github.com:libretro/RetroArch into favorites 2017-08-13 21:20:22 -04:00
Rob Loach d469be76a7 Add Show Favorites Tab to msg_hash_lbl 2017-08-13 21:07:41 -04:00
twinaphex 7165ba5245 Update CHANGES.md 2017-08-14 02:51:54 +02:00
twinaphex 81273cedcf Fix playlist remove regression 2017-08-14 02:49:55 +02:00
Rob Loach 0a9143b999 Merge branch 'favorites' of github.com:Kivutar/RetroArch into favorites 2017-08-13 19:22:33 -04:00
Rob Loach c8c3f9b842 Add eo spelling of Favorites 2017-08-13 19:10:21 -04:00
Rob Loach e324b4a074 Reorder the View settings 2017-08-13 19:10:09 -04:00
Rob Loach 6a47658502 Add Show Favorites to displaylist 2017-08-13 18:53:09 -04:00
Jean-André Santoni b906da5131 Save the favorites to the disk 2017-08-14 00:50:16 +02:00
Rob Loach 8e0e99ba66 Add Show Favorites sublabel 2017-08-13 18:44:50 -04:00
Jean-André Santoni b1daf18772 add_to_favorites OK callback 2017-08-14 00:42:56 +02:00
Rob Loach 8424c26068 Add View Favorites Tab setting 2017-08-13 18:38:38 -04:00
Jean-André Santoni 9dfb39c672 Start implementing the callback for add-to-favorites 2017-08-14 00:29:38 +02:00
Rob Loach 76899d0d33 Merge branch 'favorites' of github.com:Kivutar/RetroArch into favorites 2017-08-13 18:20:36 -04:00
Jean-André Santoni 42012389cd (Menu) Add the add-favorites entry to the quick menu too 2017-08-14 00:19:20 +02:00
Jean-André Santoni c9ad8cd1f9 (XMB) Display the small add-favorite icon 2017-08-14 00:12:55 +02:00
twinaphex 02cfe1f7c0 Bump up version to 1.6.5 2017-08-13 19:07:58 +02:00
twinaphex f6458334b6 Move some settings around, and rename 'Menu' to 'Appearance' 2017-08-13 18:29:34 +02:00
twinaphex 0ed4b97bbc Revert "Don't hide 'Resolution' setting behind compile-time ifdefs anymore"
This reverts commit 365cfd22ee.
2017-08-13 18:05:51 +02:00
twinaphex f9765a98fb Cut down on code duplication 2017-08-13 07:14:10 +02:00
twinaphex dce21063dd Cut down on code duplication 2017-08-13 06:57:32 +02:00
twinaphex 45cb6925cf Cut down on code duplication 2017-08-13 06:49:51 +02:00
twinaphex 2756217d9b (menu_cbs_ok.c) Cut down on code duplication 2017-08-13 06:36:53 +02:00
twinaphex 6ec27a7e5d Get rid of one calloc call and replace it with malloc 2017-08-13 06:14:54 +02:00
twinaphex a0cbb1ee43 Use malloc instead of calloc 2017-08-13 06:05:35 +02:00
Twinaphex 1666827ad4 Merge pull request #5289 from RobLoach/libui
Updates for libui
2017-08-13 06:02:51 +02:00
twinaphex 2558ca2fb6 Update CHANGES.md 2017-08-13 03:36:45 +02:00
Twinaphex 782b9eef0e Merge pull request #5290 from heuripedes/xmb-improv
More xmb improvements
2017-08-13 03:33:34 +02:00
Higor Eurípedes 950b77c0ca (xmb) Speed up xmb_list_insert() and xmb_deep_copy() a bit
This replaces calloc() and memcpy() calls with custom functions to
handle xmb_node_t allocation and copy optimized for the common case.
2017-08-12 22:30:22 -03:00
Higor Eurípedes 26a9648c4f (menu_animation) Detect when defrag is really needed 2017-08-12 22:30:22 -03:00
Higor Eurípedes c384f56e4f Speed up playlist reparse 2017-08-12 22:30:22 -03:00
Rob Loach 772c126f1e Merge branch 'master' of github.com:libretro/RetroArch into libui 2017-08-12 20:50:19 -04:00
Rob Loach 4177286dbb Add include directory for glib 2017-08-12 20:42:40 -04:00
twinaphex 4dd3d897dc Revert "Get rid of a ton of HAVE_SHADER_MANAGER ifdefs"
This reverts commit c4f7111aa3.
2017-08-13 02:08:33 +02:00
twinaphex c4f7111aa3 Get rid of a ton of HAVE_SHADER_MANAGER ifdefs 2017-08-13 02:04:57 +02:00
Rob Loach b0805d5e1d Update Makefile.common 2017-08-12 19:54:48 -04:00
Rob Loach 8ca5c7558f Restore libui_main 2017-08-12 19:54:31 -04:00
Rob Loach 45e823dec9 Update libui 2017-08-12 19:51:39 -04:00
twinaphex 51ca9825dd Cleanups 2017-08-13 00:55:47 +02:00
twinaphex cb2fd48bb6 Push some small optimizations to menu_cbs_left.c and menu_cbs_right.c
too
2017-08-13 00:45:20 +02:00
Rob Loach f4283f6de0 Add HAVE_LIBUI define 2017-08-12 18:43:16 -04:00
twinaphex a98e8bc915 Optimize this part 2017-08-13 00:39:11 +02:00
Higor Eurípedes 9f760af6c6 Menu improvements (#5288)
* (menu_animation) Stop KILL_BY_SUBJECT asap

* (xmb) Don't query mouse/pointer state so many times per frame
2017-08-12 22:53:56 +02:00
twinaphex 2f9ad9c3fa Update CHANGES.md 2017-08-12 22:07:49 +02:00
twinaphex ae2435cf16 Silence some more C89_BUILD warnings 2017-08-12 18:15:26 +02:00
twinaphex f546020429 Silence more warnings with C89_BUILD 2017-08-12 18:06:48 +02:00
twinaphex 00412c9836 More C89_BUILD fixes 2017-08-12 18:02:39 +02:00
twinaphex 9c32d03c1e (Vulkan/Win32) C89_BUILD fixes 2017-08-12 17:56:30 +02:00
twinaphex 6611ccf3fa C89_BUILD fixes 2017-08-12 17:42:52 +02:00
twinaphex cfde480e82 Add some C89_BUILD rules 2017-08-12 17:41:34 +02:00
theheroGAC 39e72ae0f8 fix Other strings (#5286)
another update :)
2017-08-12 17:38:56 +02:00
Rob Loach 8bda6e8a3a Merge pull request #1 from Kivutar/favorites
Favorites
2017-08-12 11:31:51 -04:00
Jean-André Santoni f1ccd29e77 (XMB) Display the favorite icon for content 2017-08-12 17:27:31 +02:00
Jean-André Santoni d037546a13 (XMB) Display favorites tab, part 2 2017-08-12 17:10:14 +02:00
twinaphex 921418af03 Backport this regression fix for builds with no network support - this
should presumably restore 3DS performance according to danieljg
2017-08-12 16:47:13 +02:00
Jean-André Santoni 61cc899867 (XMB) Display the favorites tab, part 1 2017-08-12 16:37:20 +02:00
Rob Loach ae5535c425 Merge branch 'master' of github.com:libretro/RetroArch into libui 2017-08-12 10:16:37 -04:00
Rob Loach fc2637a696 Add to Favorites label 2017-08-12 10:04:12 -04:00
Rob Loach 80be260b68 Merge branch 'master' of github.com:libretro/RetroArch into favorites 2017-08-12 01:48:17 -04:00
twinaphex 74a22169ac Buildfixes 2017-08-11 21:37:00 +02:00
theheroGAC cb63584511 Update msg_hash_it.h (#5284) 2017-08-11 21:28:31 +02:00
theheroGAC e3015088c2 Update msg_hash_it.h (#5283) 2017-08-11 20:56:29 +02:00
twinaphex a443196726 Cut down on code duplication 2017-08-11 02:51:09 +02:00
twinaphex a5bb61684c Get rid of these conditionals 2017-08-11 02:30:23 +02:00
twinaphex dad0fcbbe8 Get rid of the conditionals 2017-08-11 01:20:57 +02:00
twinaphex 22139dc4a0 Turn menu_animation_ctx_tag into typedef 2017-08-11 01:16:21 +02:00
twinaphex 4e66ec28cb Some more truncation fixes 2017-08-10 23:19:54 +02:00
twinaphex 4a9c7384c7 Silence more format truncation warnings 2017-08-10 23:14:03 +02:00
twinaphex 29af83f8e3 Fix some format-truncation warnings 2017-08-10 23:07:27 +02:00
twinaphex 16f59aba96 Some C89_BUILD fixes 2017-08-10 21:38:57 +02:00
twinaphex edb70936ae Silence warning 2017-08-10 21:27:05 +02:00
twinaphex 7a490aa6d6 Use C-style comments 2017-08-10 21:25:30 +02:00
twinaphex 805c2ad529 Buildfixes 2017-08-10 21:22:30 +02:00
Brad Parker 5d12368c83 fix extern C usage for msvc2005 2017-08-10 11:42:47 -04:00
Brad Parker ff98730906 don't define UNICODE for msvc2005 2017-08-09 23:33:57 -04:00
Twinaphex abf95744ee Update (#5279) (#5280)
* Remove horizontal slide animation for XMB

* Add Horizontal Animation configuration

* add translations

* fix one translation error

* Add serial detection for Wii

* Cleanups

* Load Content Special should now produce a filebrowser

* Turn this off

* Revert "(GLUI) Don't select an entry when scrolling"

This reverts commit 9b1ab23aa1.

* (MUI) Attempt to fix the single click

* Revert "(MUI) Attempt to fix the single click"

This reverts commit d5d0f580b0.

* Bump up APK code

* fix windows buildbot urls to point to the correct folder

* (MUI) First batch of comments

* Start documenting menu_driver.h

* (MUI) More comments

* (MUI) More comments

* MOre documentation

* More documentation

* Document menu_event.c

* Document menu_cbs.c

* Update Russian translation

* (menu-setting.c) Allow Max Timing Skew to be set to 0

* Set buildbot dir for MSVC 2005 RetroArch build to MSVC 2005 cores

* Add "Delete Core" option to Core Information menu (#5132)

* msvc2005: add missing winmm dependency

* fire tv hack

* buildfix

* extra devices

* if swap override is not specified it should be false

* update CHANGES.md

* [WiiU] Rewrite exception handler

* Update CHANGES.md

* Preliminary MOD/S3M/XM support through ibmx library (part of micromod repository)

* Update CHANGES.md

* First working prototype.

* Buildfix

* Shouldn't be part of images

* Add mod/s3m/xm support to audio mixer in GUI

* Get rid of logging

* Refactor this to be a bit safer with string lists

* Update CHANGES.md

* Buildfixes

* Some more build fixes

* gdi: enable OSD text drawing

* caca: enable OSD text drawing

* Proper fix for MOD support

* buildfix

* Fix some Coverity warnings

* Prevent dereference after null check warning by Coverity

* allow specifying libretro device and analog dpad mode on remap files

* allow saving analog dpad mode and libretro device to remap files

* remove remaps

* add new variables for "content dir"

* add menu settings

* allow savestates and savefiles to go into content dir via bool setting in addition of the empty string

* allow systemfiles into content dir via bool setting in addition of the empty string

* allow screenshots into content dir via bool setting in addition of the empty string

* make all the directories reseteable

* update win32 platform driver

* update android platform driver

* update CHANGES.md

* update CHANGES.md

* Updates

* Try to avoid direct initialization

* (Wii) Backport
https://github.com/SuperrSonic/RA-SS/commit/0574b91595a231e15bafa9f2778d1b9b14944ba6
- untested

* fix new android paths

* (GX) Buildfix

* (GX) Another buildfix

* add unicode-aware option for word_wrap (only needed for xmb)

* Update msg_hash_it.h

* Update msg_hash_it.h

* Update msg_hash_it.h

* (GX) Buildfix

* Get rid of some incompatible implicit declaration warnings

* Add encoding_utf to Salamander

* Get rid of some warnings

* Set PPU_CFLAGS

* (PS3) Fix Salamander

* Cleanup retro_dirent_is_dir

* Update msg_hash_it.h

Update italian language

* Missed break here

* Update CHANGES.md

* Update CHANGES.md

* Update CHANGES.md

* Update CHANGES.md

* Update CHANGES.md

* update CHANGES.md

* C89 buildfix

* (Localization) Update Dutch language

* Update CHANGES.md

* Some C89 buildfixes

* C89 buildfix

* C89 buildfix

* Some C89 buildfixes

* Buildfix

* (xmb) deep list copy - Use malloc instead of calloc

* Cleanup

* ps3: use python2 for pkg.py script

* ps3: copy data folder to dist-cores when ran

* fix #5257

* fix saving the libretro device in overrides

* msvc2005: use non-unicode stb font driver

* ps3: build pkgcrypt.dll and copy it to ps3py folder before running pkg.py

* forgot about mingw not defining _MSC_VER

* Add RETRO_ENVIRONMENT_SET_HW_SHARED_CONTEXT

* Update CHANGES.md

* Bump up to 1.6.4

* Update imports.h

add additional imports  (semaphore)

* Added button press lightup on overlay.

input_overlay_add_inputs added, still need to implement dpad and analog visuals on overlay. Also still needs to be restructured so input_overlay_post_poll is only called once.

* use input_state instead of current_input->input_state.

* Moved input_overlay_add_inputs call out of input_driver.c, shortened arguments.

* reduce scope of input_overlay_add_inputs to file.

* Added analog overlay support to input_overlay_add_inputs.

* Fix MOD support not mixing core provided audio stream

* Add keyboard overlay support to input_overlay_add_inputs.

* Remove commented code in input_driver.c

* Cast ctype args to unsigned char

* Add option and menu setting for viewing inputs on overlay.

* Add support for buttons that are multiple inputs.

* Added sublabel to Show Inputs On Overlay

* Added option to change controller port to listen to for showing overlay input.

* msg_hash_it.h - fix build

* Update CHANGES.md

* Updates

* Updates

* Update msg_hash_it.h

* Update msg_hash_it.h

* (xmb) Improve responsiveness while browsing horizontally

* Try to be somewhat safer here in case of null pointer derefences

* (xmb) Fix segfault when entering certain lists

* (xmb) Defragment and shrink tween list after updates

* Add win32_get_video_output_size

* Add win32_get_video_output_prev

* Fix logic in win32_get_video_output_next

* Create win32_get_video_output_next

* Start filling in more resolution functionality for Windows

* emscripten: only fire keyup once, and don't wait so long to do so

* Don't hide 'Resolution' setting behind compile-time ifdefs anymore

* Start hooking up more resolution functions - not working properly yet

* Revert "Start hooking up more resolution functions - not working properly yet"

This reverts commit dccc9711d9.

* win32_common.cpp - style nits

* Convert win32_common.cpp to C - gets rid of all the extern "C"
references as well.
Note to bparker - DragAcceptFiles has a minimum dependency for WinXP,
might have to go through a function pointer there or have a
compilation-time ifdef

* Convert wgl_ctx into C - also take care of serious warning

* Convert gdi_ctx.cpp to C

* (Lakka) Fix Online Updater

* (dinput.c) Cleanups

* Cleanup

* Make DragAcceptFiles go through function pointer

* Go through DragAcceptFiles function pointer for ui_win32_window too

* (dinput) Buildfix

* update icons

* update icons

* update icons

* update banner

* d3d9: only use wide char on msvc if UNICODE is defined
2017-08-10 03:14:35 +02:00
Brad Parker 530d79f8e3 d3d9: only use wide char on msvc if UNICODE is defined 2017-08-09 18:25:45 -04:00
Twinaphex d557deb70d Merge pull request #5277 from fr500/master
update icons
2017-08-09 21:27:02 +02:00
radius d2f870a2a1 update banner 2017-08-09 13:13:59 -05:00
radius 23d9637dc0 update icons 2017-08-09 13:04:56 -05:00
radius 3310939983 update icons 2017-08-09 13:04:56 -05:00
radius 34236932a3 update icons 2017-08-09 13:04:55 -05:00
twinaphex 5101895cc9 (dinput) Buildfix 2017-08-09 16:53:06 +02:00
twinaphex dfd2c45454 Go through DragAcceptFiles function pointer for ui_win32_window too 2017-08-09 16:32:08 +02:00
twinaphex 2f832d145f Make DragAcceptFiles go through function pointer 2017-08-09 16:25:23 +02:00
twinaphex 4e49155147 Cleanup 2017-08-09 15:54:24 +02:00
twinaphex ee275c85d8 (dinput.c) Cleanups 2017-08-09 15:51:27 +02:00
twinaphex 795ae524e9 Convert gdi_ctx.cpp to C 2017-08-09 13:56:47 +02:00
twinaphex a4a027be67 Convert wgl_ctx into C - also take care of serious warning 2017-08-09 13:51:33 +02:00
twinaphex c3851d42e6 Convert win32_common.cpp to C - gets rid of all the extern "C"
references as well.
Note to bparker - DragAcceptFiles has a minimum dependency for WinXP,
might have to go through a function pointer there or have a
compilation-time ifdef
2017-08-09 13:39:14 +02:00
twinaphex 535dbe0aaa win32_common.cpp - style nits 2017-08-09 13:28:31 +02:00
Jean-André Santoni 05558697ca (Lakka) Fix Online Updater 2017-08-09 15:16:27 +02:00
twinaphex 3bac7cc7ef Revert "Start hooking up more resolution functions - not working properly yet"
This reverts commit dccc9711d9.
2017-08-09 11:19:27 +02:00
twinaphex dccc9711d9 Start hooking up more resolution functions - not working properly yet 2017-08-09 10:58:43 +02:00
twinaphex 365cfd22ee Don't hide 'Resolution' setting behind compile-time ifdefs anymore 2017-08-09 10:33:36 +02:00
twinaphex 9272d26269 Start filling in more resolution functionality for Windows 2017-08-09 04:17:32 +02:00
twinaphex cea3cab3f4 Create win32_get_video_output_next 2017-08-09 04:09:44 +02:00
twinaphex 97de6deb56 Fix logic in win32_get_video_output_next 2017-08-09 04:07:41 +02:00
twinaphex 1ecdbf4050 Add win32_get_video_output_prev 2017-08-09 03:53:19 +02:00
twinaphex b943060797 Add win32_get_video_output_size 2017-08-09 03:44:03 +02:00
twinaphex ca80f13b2b Try to be somewhat safer here in case of null pointer derefences 2017-08-09 02:42:19 +02:00
bparker06 3a5a2d9de6 emscripten: only fire keyup once, and don't wait so long to do so 2017-08-08 22:18:27 -04:00
Twinaphex aef66e3d9e Merge pull request #5273 from heuripedes/xmb-lists
XMB horizontal browsing tweaks
2017-08-09 04:12:03 +02:00
Higor Eurípedes 63c0cae326 (xmb) Defragment and shrink tween list after updates 2017-08-08 22:37:37 -03:00
Higor Eurípedes 8d358899df (xmb) Fix segfault when entering certain lists 2017-08-08 22:34:54 -03:00
Higor Eurípedes c0cb042998 (xmb) Improve responsiveness while browsing horizontally 2017-08-08 21:05:00 -03:00
Twinaphex a37f91c2a1 Merge pull request #5272 from theheroGAC/patch-5
Update msg_hash_it.h
2017-08-08 23:45:54 +02:00
theheroGAC ee76e54617 Update msg_hash_it.h 2017-08-08 20:49:55 +02:00
theheroGAC 3f3b30b5dc Update msg_hash_it.h 2017-08-08 19:18:40 +02:00
Twinaphex 988468f691 Merge pull request #5267 from rtissera/modmixfix
Fix MOD support not mixing core provided audio stream
2017-08-08 18:52:03 +02:00
twinaphex 3c758609b5 Updates 2017-08-08 18:51:01 +02:00
twinaphex e979eece1c Updates 2017-08-08 18:45:56 +02:00
twinaphex 383d810fd4 Update CHANGES.md 2017-08-08 17:45:27 +02:00
twinaphex 86a107afc9 msg_hash_it.h - fix build 2017-08-08 17:42:28 +02:00
Twinaphex d14fa0c8b9 Merge pull request #5269 from Denu8thell/overlay_controller_response
Overlay controller response
2017-08-08 19:41:33 +02:00
Twinaphex 060603b8d3 Merge pull request #5270 from theheroGAC/patch-5
Update msg_hash_it.h
2017-08-08 19:21:23 +02:00
denu8thell 5bece2cbcc Merge branch 'master' of https://github.com/libretro/RetroArch into overlay_controller_response 2017-08-08 09:57:50 -05:00
denu8thell c5b36320df Added option to change controller port to listen to for showing overlay input. 2017-08-08 09:56:27 -05:00
denu8thell c07380293e Added sublabel to Show Inputs On Overlay 2017-08-08 09:05:03 -05:00
denu8thell 8e69a348e6 Add support for buttons that are multiple inputs. 2017-08-08 07:49:02 -05:00
Twinaphex b0ad2c4a2b Merge pull request #5268 from ensra/master
Cast ctype args to unsigned char
2017-08-08 14:37:14 +02:00
denu8thell f0606d60d2 Add option and menu setting for viewing inputs on overlay. 2017-08-08 06:50:39 -05:00
ensra 6a36453f20 Cast ctype args to unsigned char 2017-08-08 12:21:48 +01:00
denu8thell 4ed715d0f3 Remove commented code in input_driver.c 2017-08-08 05:39:18 -05:00
denu8thell 23b2e4488a Add keyboard overlay support to input_overlay_add_inputs. 2017-08-08 05:32:34 -05:00
Romain Tisserand 5a85c53174 Fix MOD support not mixing core provided audio stream 2017-08-08 12:19:24 +02:00
denu8thell cc06b8b62e Added analog overlay support to input_overlay_add_inputs. 2017-08-08 05:10:44 -05:00
denu8thell 0df4186191 reduce scope of input_overlay_add_inputs to file. 2017-08-08 02:48:46 -05:00
denu8thell 4c31d41920 Moved input_overlay_add_inputs call out of input_driver.c, shortened arguments. 2017-08-08 02:31:26 -05:00
denu8thell 3d4e36455d use input_state instead of current_input->input_state. 2017-08-07 22:22:48 -05:00
denu8thell c882e64653 Added button press lightup on overlay.
input_overlay_add_inputs added, still need to implement dpad and analog visuals on overlay. Also still needs to be restructured so input_overlay_post_poll is only called once.
2017-08-07 21:59:05 -05:00
Twinaphex b6cd19a83c Merge pull request #5264 from r-type/master
Update imports.h (semaphore)
2017-08-07 23:38:10 +02:00
not6 10492c1ee7 Update imports.h
add additional imports  (semaphore)
2017-08-07 23:25:05 +02:00
Rob Loach 9195eeb1e1 Add favorite enum 2017-08-04 23:05:54 -04:00
Rob Loach 2a7bb2def1 Add initial work on Favorites 2017-08-04 22:34:13 -04:00
Rob Loach 0996291d91 libui: Changes for LIBUI 2017-08-01 12:25:08 -04:00
277 changed files with 10323 additions and 3745 deletions

No files matched your search

+30 -1
View File
@@ -1,4 +1,33 @@
# 1.6.5 (future)
# 1.6.8 (future)
# 1.6.7 (future)
- SCANNER: Fix directory scanning.
- SCANNER: Fix file scanning.
- COMMON: Fix 'Disk Image Append' option.
- FREEBSD: Compatibility fixes for Video4Linux2 camera driver.
- GUI: (MaterialUI) Add disk image append icons.
- GUI: (MaterialUI) Improve word wrapping when menu icons are enabled.
- GUI: (MaterialUI) Add User Interface -> Appearance -> Menu Icons Enable. You can turn on/off the icons on the lefthand side of the menu entries.
- GUI: Performance optimizations for XMB menu driver - only calculates visible items.
- LOCALIZATION: Update Italian translation.
# 1.6.6 (future)
- 3DS: Fixes serious performance regression that affected every core; rewind was always implicitly enabled.
- AUDIO: MOD/S3M/XM sound should now be properly mixed in with the core's sound.
- GUI: Visual makeover of MaterialUI.
- GUI: Added 'Music', 'Images' and 'Video' collection options to RGUI/MaterialUI.
- GUI: Allow the user to add 'Favorites'.
- GUI: Allow the user to rename entries.
- GUI: Performance optimizations for XMB menu driver.
- LOCALIZATION: Update Italian translation
- INPUT: Overlay controller response - when we press buttons on the gamepad or keyboard, the corresponding buttons on the overlay will be highlighted as well.
- NETBSD: Silence some compilation warnings.
- COMMON: Fixed bug 'Deleting an entry from a playlist would not update the list view inside XMB'.
- COMMON: Fix inet_ntop_compat on *nix
- LOBBY: Add skeleton to add help descriptions to lobbies
# 1.6.5
Skipped this one.
# 1.6.4
+97 -98
View File
@@ -380,106 +380,62 @@ OBJ += $(OBJS_TLS_CRYPTO) $(OBJS_TLS_X509) $(OBJS_TLS)
endif
ifeq ($(HAVE_LIBUI), 1)
ifeq ($(HAVE_GTKPLUS), 1)
CFLAGS += -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/atk-1.0
LIBS += -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0
OBJ += deps/libui/gtk/alloc.o \
deps/libui/gtk/area.o \
deps/libui/gtk/box.o \
deps/libui/gtk/button.o \
deps/libui/gtk/cellrendererbutton.o \
deps/libui/gtk/checkbox.o \
deps/libui/gtk/child.o \
deps/libui/gtk/colorbutton.o \
deps/libui/gtk/combobox.o \
deps/libui/gtk/control.o \
deps/libui/gtk/datetimepicker.o \
deps/libui/gtk/debug.o \
deps/libui/gtk/draw.o \
deps/libui/gtk/drawmatrix.o \
deps/libui/gtk/drawpath.o \
deps/libui/gtk/drawtext.o \
deps/libui/gtk/editablecombo.o \
deps/libui/gtk/entry.o \
deps/libui/gtk/fontbutton.o \
deps/libui/gtk/form.o \
deps/libui/gtk/future.o \
deps/libui/gtk/graphemes.o \
deps/libui/gtk/grid.o \
deps/libui/gtk/group.o \
deps/libui/gtk/image.o \
deps/libui/gtk/label.o \
deps/libui/gtk/main.o \
deps/libui/gtk/menu.o \
deps/libui/gtk/multilineentry.o \
deps/libui/gtk/progressbar.o \
deps/libui/gtk/radiobuttons.o \
deps/libui/gtk/separator.o \
deps/libui/gtk/slider.o \
deps/libui/gtk/spinbox.o \
deps/libui/gtk/stddialogs.o \
deps/libui/gtk/tab.o \
deps/libui/gtk/text.o \
deps/libui/gtk/util.o \
deps/libui/gtk/window.o
endif
DEFINES += -DHAVE_LIBUI
ifneq ($(findstring Win32,$(OS)),)
OBJ += deps/libui/win32/alloc.o \
deps/libui/win32/area.o \
deps/libui/win32/areadraw.o \
deps/libui/win32/areaevents.o \
deps/libui/win32/areascroll.o \
deps/libui/win32/areautil.o \
deps/libui/win32/box.o \
deps/libui/win32/button.o \
deps/libui/win32/checkbox.o \
deps/libui/win32/colorbutton.o \
deps/libui/win32/colordialog.o \
deps/libui/win32/combobox.o \
deps/libui/win32/container.o \
deps/libui/win32/control.o \
deps/libui/win32/d2dscratch.o \
deps/libui/win32/datetimepicker.o \
deps/libui/win32/debug.o \
deps/libui/win32/draw.o \
deps/libui/win32/drawmatrix.o \
deps/libui/win32/drawpath.o \
deps/libui/win32/drawtext.o \
deps/libui/win32/dwrite.o \
deps/libui/win32/editablecombo.o \
deps/libui/win32/entry.o \
deps/libui/win32/events.o \
deps/libui/win32/fontbutton.o \
deps/libui/win32/fontdialog.o \
deps/libui/win32/form.o \
deps/libui/win32/graphemes.o \
deps/libui/win32/grid.o \
deps/libui/win32/group.o \
deps/libui/win32/init.o \
deps/libui/win32/label.o \
deps/libui/win32/main.o \
deps/libui/win32/menu.o \
deps/libui/win32/multilineentry.o \
deps/libui/win32/parent.o \
deps/libui/win32/progressbar.o \
deps/libui/win32/radiobuttons.o \
deps/libui/win32/separator.o \
deps/libui/win32/sizing.o \
deps/libui/win32/slider.o \
deps/libui/win32/spinbox.o \
deps/libui/win32/stddialogs.o \
deps/libui/win32/tab.o \
deps/libui/win32/tabpage.o \
deps/libui/win32/text.o \
deps/libui/win32/utf16.o \
deps/libui/win32/utilwin.o \
deps/libui/win32/window.o \
deps/libui/win32/winpublic.o \
deps/libui/win32/winutil.o
OBJ += deps/libui/windows/alloc.o \
deps/libui/windows/area.o \
deps/libui/windows/areadraw.o \
deps/libui/windows/areaevents.o \
deps/libui/windows/areascroll.o \
deps/libui/windows/areautil.o \
deps/libui/windows/box.o \
deps/libui/windows/button.o \
deps/libui/windows/checkbox.o \
deps/libui/windows/colorbutton.o \
deps/libui/windows/colordialog.o \
deps/libui/windows/combobox.o \
deps/libui/windows/container.o \
deps/libui/windows/control.o \
deps/libui/windows/d2dscratch.o \
deps/libui/windows/datetimepicker.o \
deps/libui/windows/debug.o \
deps/libui/windows/draw.o \
deps/libui/windows/drawmatrix.o \
deps/libui/windows/drawpath.o \
deps/libui/windows/drawtext.o \
deps/libui/windows/dwrite.o \
deps/libui/windows/editablecombo.o \
deps/libui/windows/entry.o \
deps/libui/windows/events.o \
deps/libui/windows/fontbutton.o \
deps/libui/windows/fontdialog.o \
deps/libui/windows/form.o \
deps/libui/windows/graphemes.o \
deps/libui/windows/grid.o \
deps/libui/windows/group.o \
deps/libui/windows/init.o \
deps/libui/windows/label.o \
deps/libui/windows/main.o \
deps/libui/windows/menu.o \
deps/libui/windows/multilineentry.o \
deps/libui/windows/parent.o \
deps/libui/windows/progressbar.o \
deps/libui/windows/radiobuttons.o \
deps/libui/windows/separator.o \
deps/libui/windows/sizing.o \
deps/libui/windows/slider.o \
deps/libui/windows/spinbox.o \
deps/libui/windows/stddialogs.o \
deps/libui/windows/tab.o \
deps/libui/windows/tabpage.o \
deps/libui/windows/text.o \
deps/libui/windows/utf16.o \
deps/libui/windows/utilwin.o \
deps/libui/windows/window.o \
deps/libui/windows/winpublic.o \
deps/libui/windows/winutil.o
LIBS += -luxtheme -ld2d1 -ldwrite -lusp10
endif
else
ifneq ($(findstring Darwin,$(OS)),)
OBJ += deps/libui/darwin/alloc.o \
deps/libui/darwin/area.o \
@@ -519,6 +475,49 @@ OBJ += deps/libui/darwin/alloc.o \
deps/libui/darwin/util.o \
deps/libui/darwin/window.o \
deps/libui/darwin/winmoveresize.o
else
CFLAGS += -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/atk-1.0
LIBS += -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0
OBJ += deps/libui/unix/alloc.o \
deps/libui/unix/area.o \
deps/libui/unix/box.o \
deps/libui/unix/button.o \
deps/libui/unix/cellrendererbutton.o \
deps/libui/unix/checkbox.o \
deps/libui/unix/child.o \
deps/libui/unix/colorbutton.o \
deps/libui/unix/combobox.o \
deps/libui/unix/control.o \
deps/libui/unix/datetimepicker.o \
deps/libui/unix/debug.o \
deps/libui/unix/draw.o \
deps/libui/unix/drawmatrix.o \
deps/libui/unix/drawpath.o \
deps/libui/unix/drawtext.o \
deps/libui/unix/editablecombo.o \
deps/libui/unix/entry.o \
deps/libui/unix/fontbutton.o \
deps/libui/unix/form.o \
deps/libui/unix/future.o \
deps/libui/unix/graphemes.o \
deps/libui/unix/grid.o \
deps/libui/unix/group.o \
deps/libui/unix/image.o \
deps/libui/unix/label.o \
deps/libui/unix/main.o \
deps/libui/unix/menu.o \
deps/libui/unix/multilineentry.o \
deps/libui/unix/progressbar.o \
deps/libui/unix/radiobuttons.o \
deps/libui/unix/separator.o \
deps/libui/unix/slider.o \
deps/libui/unix/spinbox.o \
deps/libui/unix/stddialogs.o \
deps/libui/unix/tab.o \
deps/libui/unix/text.o \
deps/libui/unix/util.o \
deps/libui/unix/window.o
endif
endif
OBJ += deps/libui/common/areaevents.o \
+1 -1
View File
@@ -1,4 +1,4 @@
RARCH_VERSION = "0.9.9.3"
RARCH_VERSION = "1.6.7.0"
DEBUG = 0
+1 -1
View File
@@ -1,4 +1,4 @@
RARCH_VERSION = "1.6.4.0"
RARCH_VERSION = "1.6.7.0"
#which compiler to build with - GCC or SNC
#set to GCC for debug builds for use with debugger
+1 -1
View File
@@ -1,4 +1,4 @@
RARCH_VERSION = "0.9.9.3"
RARCH_VERSION = "1.6.7.0"
#which compiler to build with - GCC or SNC
#set to GCC for debug builds for use with debugger
+1 -1
View File
@@ -1,4 +1,4 @@
RARCH_VERSION = "1.6.4.0"
RARCH_VERSION = "1.6.7.0"
DEBUG = 0
HAVE_LOGGER = 0
+5 -1
View File
@@ -322,7 +322,11 @@ static void *dsound_init(const char *device, unsigned rate, unsigned latency,
RARCH_LOG("DirectSound devices:\n");
#ifndef _XBOX
DirectSoundEnumerate(enumerate_cb, &dev);
#ifdef UNICODE
DirectSoundEnumerate((LPDSENUMCALLBACKW)enumerate_cb, &dev);
#else
DirectSoundEnumerate((LPDSENUMCALLBACKA)enumerate_cb, &dev);
#endif
#endif
if (DirectSoundCreate(dev.guid, &ds->ds, NULL) != DS_OK)
+2 -2
View File
@@ -741,9 +741,9 @@ static ssize_t wasapi_write(void *wh, const void *data, size_t size)
for (writen = 0, ir = -1; writen < size; writen += ir)
{
if (w->exclusive)
ir = wasapi_write_ex(w, data + writen, size - writen);
ir = wasapi_write_ex(w, (char*)data + writen, size - writen);
else
ir = wasapi_write_sh(w, data + writen, size - writen);
ir = wasapi_write_sh(w, (char*)data + writen, size - writen);
if (ir == -1)
return -1;
}
+4
View File
@@ -16,7 +16,9 @@
*/
#include <stdio.h>
#if !defined(__FreeBSD__) || __FreeBSD__ < 5
#include <malloc.h>
#endif
#include <string.h>
#include <assert.h>
#include <stddef.h>
@@ -28,7 +30,9 @@
#include <sys/time.h>
#include <sys/ioctl.h>
#ifndef __FreeBSD__
#include <asm/types.h>
#endif
#include <linux/videodev2.h>
#include <memmap.h>
+6 -6
View File
@@ -921,7 +921,7 @@ static unsigned cheevos_prefix_to_comp_size(char prefix)
{
/* Careful not to use ABCDEF here, this denotes part of an actual variable! */
switch( toupper( prefix ) )
switch( toupper( (unsigned char)prefix ) )
{
case 'M':
return CHEEVOS_VAR_SIZE_BIT_0;
@@ -1141,13 +1141,13 @@ static void cheevos_parse_var(cheevos_var_t *var, const char **memaddr)
const char *str = *memaddr;
unsigned base = 16;
if (toupper(*str) == 'D' && str[1] == '0' && toupper(str[2]) == 'X')
if (toupper((unsigned char)*str) == 'D' && str[1] == '0' && toupper((unsigned char)str[2]) == 'X')
{
/* d0x + 4 hex digits */
str += 3;
var->type = CHEEVOS_VAR_TYPE_DELTA_MEM;
}
else if (*str == '0' && toupper(str[1]) == 'X')
else if (*str == '0' && toupper((unsigned char)str[1]) == 'X')
{
/* 0x + 4 hex digits */
str += 2;
@@ -1157,11 +1157,11 @@ static void cheevos_parse_var(cheevos_var_t *var, const char **memaddr)
{
var->type = CHEEVOS_VAR_TYPE_VALUE_COMP;
if (toupper(*str) == 'H')
if (toupper((unsigned char)*str) == 'H')
str++;
else
{
if (toupper(*str) == 'V')
if (toupper((unsigned char)*str) == 'V')
str++;
base = 10;
@@ -2072,7 +2072,7 @@ static void cheevos_url_encode(const char *str, char *encoded, size_t len)
{
while (*str)
{
if ( isalnum(*str) || *str == '-'
if ( isalnum((unsigned char)*str) || *str == '-'
|| *str == '_' || *str == '.'
|| *str == '~')
{
+52 -22
View File
@@ -1865,13 +1865,17 @@ bool command_event(enum event_command cmd, void *data)
if (settings->bools.cheevos_hardcore_mode_enable)
return false;
#endif
if (settings->bools.rewind_enable)
{
#ifdef HAVE_NETWORKING
/* Only enable state manager if netplay is not underway
TODO: Add a setting for these tweaks */
if (settings->bools.rewind_enable
&& !netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL))
/* Only enable state manager if netplay is not underway
TODO: Add a setting for these tweaks */
if (!netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL))
#endif
state_manager_event_init((unsigned)settings->rewind_buffer_size);
{
state_manager_event_init((unsigned)settings->rewind_buffer_size);
}
}
}
break;
case CMD_EVENT_REWIND_TOGGLE:
@@ -1895,7 +1899,7 @@ bool command_event(enum event_command cmd, void *data)
#ifdef HAVE_THREADS
{
#ifdef HAVE_NETWORKING
/* Only enable state manager if netplay is not underway
/* Only enable state manager if netplay is not underway
TODO: Add a setting for these tweaks */
settings_t *settings = config_get_ptr();
if (settings->uints.autosave_interval != 0
@@ -1991,6 +1995,13 @@ bool command_event(enum event_command cmd, void *data)
}
g_defaults.content_history = NULL;
if (g_defaults.content_favorites)
{
playlist_write_file(g_defaults.content_favorites);
playlist_free(g_defaults.content_favorites);
}
g_defaults.content_favorites = NULL;
if (g_defaults.music_history)
{
playlist_write_file(g_defaults.music_history);
@@ -2034,6 +2045,13 @@ bool command_event(enum event_command cmd, void *data)
settings->paths.path_content_history,
content_history_size);
RARCH_LOG("%s: [%s].\n",
msg_hash_to_str(MSG_LOADING_HISTORY_FILE),
settings->paths.path_content_favorites);
g_defaults.content_favorites = playlist_init(
settings->paths.path_content_favorites,
content_history_size);
RARCH_LOG("%s: [%s].\n",
msg_hash_to_str(MSG_LOADING_HISTORY_FILE),
settings->paths.path_content_music_history);
@@ -2133,7 +2151,7 @@ bool command_event(enum event_command cmd, void *data)
* need to make sure to keep a copy */
struct retro_hw_render_callback hwr_copy;
struct retro_hw_render_callback *hwr = video_driver_get_hw_context();
const struct retro_hw_render_context_negotiation_interface *iface =
const struct retro_hw_render_context_negotiation_interface *iface =
video_driver_get_context_negotiation_interface();
memcpy(&hwr_copy, hwr, sizeof(hwr_copy));
@@ -2166,6 +2184,18 @@ bool command_event(enum event_command cmd, void *data)
if (ui_companion_is_on_foreground())
ui_companion_driver_toggle();
break;
case CMD_EVENT_ADD_TO_FAVORITES:
playlist_push(
g_defaults.content_favorites,
path_get(RARCH_PATH_CONTENT),
NULL,
file_path_str(FILE_PATH_DETECT),
file_path_str(FILE_PATH_DETECT),
NULL,
NULL
);
playlist_write_file(g_defaults.content_favorites);
break;
case CMD_EVENT_RESTART_RETROARCH:
if (!frontend_driver_set_fork(FRONTEND_FORK_RESTART))
return false;
@@ -2206,7 +2236,7 @@ bool command_event(enum event_command cmd, void *data)
RARCH_LOG("%s\n", msg_hash_to_str(MSG_PAUSED));
command_event(CMD_EVENT_AUDIO_STOP, NULL);
runloop_msg_queue_push(msg_hash_to_str(MSG_PAUSED), 1,
runloop_msg_queue_push(msg_hash_to_str(MSG_PAUSED), 1,
1, true);
if (!is_idle)
@@ -2289,15 +2319,15 @@ bool command_event(enum event_command cmd, void *data)
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
if (!init_netplay(NULL, hostname ? hostname :
if (!init_netplay(NULL, hostname ? hostname :
settings->paths.netplay_server,
settings->uints.netplay_port))
{
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
return false;
}
/* Disable rewind & sram autosave if it was enabled
/* Disable rewind & sram autosave if it was enabled
TODO: Add a setting for these tweaks */
state_manager_event_deinit();
#ifdef HAVE_THREADS
@@ -2315,12 +2345,12 @@ bool command_event(enum event_command cmd, void *data)
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
RARCH_LOG("[netplay] connecting to %s:%d\n",
hostname->elems[0].data, !string_is_empty(hostname->elems[1].data)
RARCH_LOG("[netplay] connecting to %s:%d\n",
hostname->elems[0].data, !string_is_empty(hostname->elems[1].data)
? atoi(hostname->elems[1].data) : 55435);
if (!init_netplay(NULL, hostname->elems[0].data,
!string_is_empty(hostname->elems[1].data)
if (!init_netplay(NULL, hostname->elems[0].data,
!string_is_empty(hostname->elems[1].data)
? atoi(hostname->elems[1].data) : 55435))
{
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
@@ -2330,7 +2360,7 @@ bool command_event(enum event_command cmd, void *data)
string_list_free(hostname);
/* Disable rewind if it was enabled
/* Disable rewind if it was enabled
TODO: Add a setting for these tweaks */
state_manager_event_deinit();
#ifdef HAVE_THREADS
@@ -2348,12 +2378,12 @@ bool command_event(enum event_command cmd, void *data)
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
RARCH_LOG("[netplay] connecting to %s:%d\n",
hostname->elems[0].data, !string_is_empty(hostname->elems[1].data)
RARCH_LOG("[netplay] connecting to %s:%d\n",
hostname->elems[0].data, !string_is_empty(hostname->elems[1].data)
? atoi(hostname->elems[1].data) : 55435);
if (!init_netplay_deferred(hostname->elems[0].data,
!string_is_empty(hostname->elems[1].data)
!string_is_empty(hostname->elems[1].data)
? atoi(hostname->elems[1].data) : 55435))
{
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
@@ -2363,7 +2393,7 @@ bool command_event(enum event_command cmd, void *data)
string_list_free(hostname);
/* Disable rewind if it was enabled
/* Disable rewind if it was enabled
TODO: Add a setting for these tweaks */
state_manager_event_deinit();
#ifdef HAVE_THREADS
@@ -2540,7 +2570,7 @@ bool command_event(enum event_command cmd, void *data)
{
static bool game_focus_state = false;
intptr_t mode = (intptr_t)data;
/* mode = -1: restores current game focus state
* mode = 1: force set game focus, instead of toggling
* any other: toggle
@@ -2605,7 +2635,7 @@ bool command_event(enum event_command cmd, void *data)
command_event_restore_default_shader_preset();
break;
case CMD_EVENT_LIBUI_TEST:
#if 0
#if HAVE_LIBUI
libui_main();
#endif
break;
+2
View File
@@ -134,6 +134,8 @@ enum event_command
CMD_EVENT_REBOOT,
/* Resume RetroArch when in menu. */
CMD_EVENT_RESUME,
/* Add a playlist entry to favorites. */
CMD_EVENT_ADD_TO_FAVORITES,
/* Toggles pause. */
CMD_EVENT_PAUSE_TOGGLE,
/* Pauses RetroArch. */
+9
View File
@@ -58,6 +58,10 @@ static bool bundle_assets_extract_enable = true;
static bool bundle_assets_extract_enable = false;
#endif
#ifdef HAVE_MATERIALUI
static bool materialui_icons_enable = true;
#endif
static const bool def_history_list_enable = true;
static const bool def_playlist_entry_remove = true;
@@ -250,6 +254,7 @@ static bool xmb_shadows_enable = false;
static bool xmb_shadows_enable = true;
#endif
static bool xmb_show_settings = true;
static bool xmb_show_favorites = true;
#ifdef HAVE_IMAGEVIEWER
static bool xmb_show_images = true;
#endif
@@ -266,6 +271,8 @@ static bool xmb_show_add = true;
#endif
#endif
static float menu_framebuffer_opacity = 0.900;
static float menu_wallpaper_opacity = 0.300;
static float menu_footer_opacity = 1.000;
@@ -313,6 +320,8 @@ static unsigned input_backtouch_enable = false;
static unsigned input_backtouch_toggle = false;
#endif
static bool show_physical_inputs = true;
static bool all_users_control_menu = false;
#if defined(ANDROID) || defined(_WIN32)
+29
View File
@@ -1020,6 +1020,8 @@ static struct config_path_setting *populate_settings_path(settings_t *settings,
#endif
SETTING_PATH("content_history_path",
settings->paths.path_content_history, false, NULL, true);
SETTING_PATH("content_favorites_path",
settings->paths.path_content_favorites, false, NULL, true);
SETTING_PATH("content_music_history_path",
settings->paths.path_content_music_history, false, NULL, true);
SETTING_PATH("content_video_history_path",
@@ -1190,9 +1192,13 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
SETTING_BOOL("menu_battery_level_enable", &settings->bools.menu_battery_level_enable, true, true, false);
SETTING_BOOL("menu_core_enable", &settings->bools.menu_core_enable, true, true, false);
SETTING_BOOL("menu_dynamic_wallpaper_enable", &settings->bools.menu_dynamic_wallpaper_enable, true, false, false);
#ifdef HAVE_MATERIALUI
SETTING_BOOL("materialui_icons_enable", &settings->bools.menu_materialui_icons_enable, true, materialui_icons_enable, false);
#endif
#ifdef HAVE_XMB
SETTING_BOOL("xmb_shadows_enable", &settings->bools.menu_xmb_shadows_enable, true, xmb_shadows_enable, false);
SETTING_BOOL("xmb_show_settings", &settings->bools.menu_xmb_show_settings, true, xmb_show_settings, false);
SETTING_BOOL("xmb_show_favorites", &settings->bools.menu_xmb_show_favorites, true, xmb_show_favorites, false);
#ifdef HAVE_IMAGEVIEWER
SETTING_BOOL("xmb_show_images", &settings->bools.menu_xmb_show_images, true, xmb_show_images, false);
#endif
@@ -1226,6 +1232,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
#ifdef HAVE_OVERLAY
SETTING_BOOL("input_overlay_enable", &settings->bools.input_overlay_enable, true, config_overlay_enable_default(), false);
SETTING_BOOL("input_overlay_enable_autopreferred", &settings->bools.input_overlay_enable_autopreferred, true, true, false);
SETTING_BOOL("input_overlay_show_physical_inputs", &settings->bools.input_overlay_show_physical_inputs, true, false, false);
SETTING_BOOL("input_overlay_hide_in_menu", &settings->bools.input_overlay_hide_in_menu, true, overlay_hide_in_menu, false);
#endif
#ifdef HAVE_COMMAND
@@ -1293,6 +1300,7 @@ static struct config_float_setting *populate_settings_float(settings_t *settings
#endif
#ifdef HAVE_MENU
SETTING_FLOAT("menu_wallpaper_opacity", &settings->floats.menu_wallpaper_opacity, true, menu_wallpaper_opacity, false);
SETTING_FLOAT("menu_framebuffer_opacity", &settings->floats.menu_framebuffer_opacity, true, menu_framebuffer_opacity, false);
SETTING_FLOAT("menu_footer_opacity", &settings->floats.menu_footer_opacity, true, menu_footer_opacity, false);
SETTING_FLOAT("menu_header_opacity", &settings->floats.menu_header_opacity, true, menu_header_opacity, false);
#endif
@@ -1373,6 +1381,7 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings,
#endif
SETTING_UINT("bundle_assets_extract_version_current", &settings->uints.bundle_assets_extract_version_current, true, 0, false);
SETTING_UINT("bundle_assets_extract_last_version", &settings->uints.bundle_assets_extract_last_version, true, 0, false);
SETTING_UINT("input_overlay_show_physical_inputs_port", &settings->uints.input_overlay_show_physical_inputs_port, true, 0, false);
*size = count;
@@ -1653,6 +1662,7 @@ static void config_set_defaults(void)
*settings->paths.path_core_options = '\0';
*settings->paths.path_content_history = '\0';
*settings->paths.path_content_favorites = '\0';
*settings->paths.path_content_music_history = '\0';
*settings->paths.path_content_image_history = '\0';
*settings->paths.path_content_video_history = '\0';
@@ -2480,6 +2490,25 @@ static bool config_load_file(const char *path, bool set_defaults,
}
}
if (string_is_empty(settings->paths.path_content_favorites))
{
if (string_is_empty(settings->paths.directory_content_history))
{
fill_pathname_resolve_relative(
settings->paths.path_content_favorites,
path_get(RARCH_PATH_CONFIG),
file_path_str(FILE_PATH_CONTENT_FAVORITES),
sizeof(settings->paths.path_content_favorites));
}
else
{
fill_pathname_join(settings->paths.path_content_favorites,
settings->paths.directory_content_history,
file_path_str(FILE_PATH_CONTENT_FAVORITES),
sizeof(settings->paths.path_content_favorites));
}
}
if (string_is_empty(settings->paths.path_content_music_history))
{
if (string_is_empty(settings->paths.directory_content_history))
+8
View File
@@ -88,6 +88,7 @@ typedef struct settings
bool input_overlay_enable;
bool input_overlay_enable_autopreferred;
bool input_overlay_hide_in_menu;
bool input_overlay_show_physical_inputs;
bool input_descriptor_label_show;
bool input_descriptor_hide_unbound;
bool input_all_users_control_menu;
@@ -122,8 +123,10 @@ typedef struct settings
bool menu_horizontal_animation;
bool menu_show_online_updater;
bool menu_show_core_updater;
bool menu_materialui_icons_enable;
bool menu_xmb_shadows_enable;
bool menu_xmb_show_settings;
bool menu_xmb_show_favorites;
bool menu_xmb_show_images;
bool menu_xmb_show_music;
bool menu_xmb_show_video;
@@ -236,6 +239,7 @@ typedef struct settings
float video_msg_color_b;
float menu_wallpaper_opacity;
float menu_framebuffer_opacity;
float menu_footer_opacity;
float menu_header_opacity;
@@ -328,6 +332,8 @@ typedef struct settings
unsigned camera_width;
unsigned camera_height;
unsigned input_overlay_show_physical_inputs_port;
} uints;
struct
@@ -379,6 +385,7 @@ typedef struct settings
char path_softfilter_plugin[PATH_MAX_LENGTH];
char path_core_options[PATH_MAX_LENGTH];
char path_content_history[PATH_MAX_LENGTH];
char path_content_favorites[PATH_MAX_LENGTH];
char path_content_music_history[PATH_MAX_LENGTH];
char path_content_image_history[PATH_MAX_LENGTH];
char path_content_video_history[PATH_MAX_LENGTH];
@@ -395,6 +402,7 @@ typedef struct settings
char directory_video_filter[PATH_MAX_LENGTH];
char directory_video_shader[PATH_MAX_LENGTH];
char directory_content_history[PATH_MAX_LENGTH];
char directory_content_favorites[PATH_MAX_LENGTH];
char directory_libretro[PATH_MAX_LENGTH];
char directory_cursor[PATH_MAX_LENGTH];
char directory_input_remapping[PATH_MAX_LENGTH];
+1
View File
@@ -102,6 +102,7 @@ struct defaults
#ifndef IS_SALAMANDER
playlist_t *content_history;
playlist_t *content_favorites;
#ifdef HAVE_IMAGEVIEWER
playlist_t *image_history;
#endif
+9
View File
@@ -0,0 +1,9 @@
Copyright (c) 2014 Pietro Gagliardi
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
(this is called the MIT License or Expat License; see http://www.opensource.org/licenses/MIT)
+16
View File
@@ -0,0 +1,16 @@
# 3 june 2016
list(APPEND _LIBUI_SOURCES
common/areaevents.c
common/control.c
common/debug.c
common/matrix.c
common/shouldquit.c
common/userbugs.c
)
set(_LIBUI_SOURCES ${_LIBUI_SOURCES} PARENT_SCOPE)
list(APPEND _LIBUI_INCLUDEDIRS
common
)
set(_LIBUI_INCLUDEDIRS ${_LIBUI_INCLUDEDIRS} PARENT_SCOPE)
+10 -9
View File
@@ -61,9 +61,11 @@ void uiControlDisable(uiControl *c)
uiControl *uiAllocControl(size_t size, uint32_t OSsig, uint32_t typesig, const char *typenamestr)
{
uiControl *c = (uiControl *) uiAlloc(size, typenamestr);
c->Signature = uiControlSignature;
c->OSSignature = OSsig;
uiControl *c;
c = (uiControl *) uiAlloc(size, typenamestr);
c->Signature = uiControlSignature;
c->OSSignature = OSsig;
c->TypeSignature = typesig;
return c;
}
@@ -90,11 +92,10 @@ void uiControlVerifySetParent(uiControl *c, uiControl *parent)
int uiControlEnabledToUser(uiControl *c)
{
while (c != NULL)
{
if (!uiControlEnabled(c))
return 0;
c = uiControlParent(c);
}
while (c != NULL) {
if (!uiControlEnabled(c))
return 0;
c = uiControlParent(c);
}
return 1;
}
+1 -1
View File
@@ -1,4 +1,4 @@
/* 24 april 2016 */
// 24 april 2016
#define uiAreaSignature 0x41726561
#define uiBoxSignature 0x426F784C
+10 -10
View File
@@ -1,4 +1,4 @@
/* 11 october 2015 */
// 11 october 2015
#include <math.h>
#include "../ui.h"
#include "uipriv.h"
@@ -13,17 +13,17 @@ void uiDrawMatrixSetIdentity(uiDrawMatrix *m)
m->M32 = 0;
}
/* The rest of this file provides basic utilities in case the platform doesn't provide any of its own for these tasks.
* Keep these as minimal as possible. They should generally not call other fallbacks.
// The rest of this file provides basic utilities in case the platform doesn't provide any of its own for these tasks.
// Keep these as minimal as possible. They should generally not call other fallbacks.
* see https://msdn.microsoft.com/en-us/library/windows/desktop/ff684171%28v=vs.85%29.aspx#skew_transform
* TODO see if there's a way we can avoid the multiplication */
// see https://msdn.microsoft.com/en-us/library/windows/desktop/ff684171%28v=vs.85%29.aspx#skew_transform
// TODO see if there's a way we can avoid the multiplication
void fallbackSkew(uiDrawMatrix *m, double x, double y, double xamount, double yamount)
{
uiDrawMatrix n;
uiDrawMatrixSetIdentity(&n);
/* TODO explain this */
// TODO explain this
n.M12 = tan(yamount);
n.M21 = tan(xamount);
n.M31 = -y * tan(xamount);
@@ -37,13 +37,13 @@ void scaleCenter(double xCenter, double yCenter, double *x, double *y)
*y = yCenter - (*y * yCenter);
}
/* the basic algorithm is from cairo
* but it's the same algorithm as the transform point,
* just without M31 and M32 taken into account, so let's just do that instead */
// the basic algorithm is from cairo
// but it's the same algorithm as the transform point, just without M31 and M32 taken into account, so let's just do that instead
void fallbackTransformSize(uiDrawMatrix *m, double *x, double *y)
{
uiDrawMatrix m2 = *m;
uiDrawMatrix m2;
m2 = *m;
m2.M31 = 0;
m2.M32 = 0;
uiDrawMatrixTransformPoint(&m2, x, y);
+8 -9
View File
@@ -1,4 +1,4 @@
/* 6 april 2015 */
// 6 april 2015
#ifdef __cplusplus
extern "C" {
#endif
@@ -13,7 +13,7 @@ extern void *uiAlloc(size_t, const char *);
extern void *uiRealloc(void *, size_t, const char *);
extern void uiFree(void *);
/* ugh, this was only introduced in MSVC 2015... */
// ugh, this was only introduced in MSVC 2015...
#ifdef _MSC_VER
#define __func__ __FUNCTION__
#endif
@@ -25,17 +25,16 @@ extern void _implbug(const char *file, const char *line, const char *func, const
extern void _userbug(const char *file, const char *line, const char *func, const char *format, ...);
#define userbug(...) _userbug(__FILE__, _ns(__LINE__), __func__, __VA_ARGS__)
/* control.c */
// control.c
extern uiControl *newControl(size_t size, uint32_t OSsig, uint32_t typesig, const char *typenamestr);
/* shouldquit.c */
// shouldquit.c
extern int shouldQuit(void);
/* areaevents.c */
// areaevents.c
typedef struct clickCounter clickCounter;
/* you should call Reset() to zero-initialize a new instance
* it doesn't matter that all the non-count fields are zero: the first click will fail the curButton test straightaway, so it'll return 1 and set the rest of the structure accordingly */
// you should call Reset() to zero-initialize a new instance
// it doesn't matter that all the non-count fields are zero: the first click will fail the curButton test straightaway, so it'll return 1 and set the rest of the structure accordingly
struct clickCounter {
int curButton;
int rectX0;
@@ -49,7 +48,7 @@ int clickCounterClick(clickCounter *c, int button, int x, int y, uintptr_t time,
extern void clickCounterReset(clickCounter *);
extern int fromScancode(uintptr_t, uiAreaKeyEvent *);
/* matrix.c */
// matrix.c
extern void fallbackSkew(uiDrawMatrix *, double, double, double, double);
extern void scaleCenter(double, double, double *, double *);
extern void fallbackTransformSize(uiDrawMatrix *, double *, double *);
+79
View File
@@ -0,0 +1,79 @@
# 3 june 2016
list(APPEND _LIBUI_SOURCES
darwin/alloc.m
darwin/area.m
darwin/areaevents.m
darwin/autolayout.m
darwin/box.m
darwin/button.m
darwin/checkbox.m
darwin/colorbutton.m
darwin/combobox.m
darwin/control.m
darwin/datetimepicker.m
darwin/debug.m
darwin/draw.m
darwin/drawtext.m
darwin/editablecombo.m
darwin/entry.m
darwin/fontbutton.m
darwin/form.m
darwin/grid.m
darwin/group.m
darwin/image.m
darwin/label.m
darwin/main.m
darwin/map.m
darwin/menu.m
darwin/multilineentry.m
darwin/progressbar.m
darwin/radiobuttons.m
darwin/scrollview.m
darwin/separator.m
darwin/slider.m
darwin/spinbox.m
darwin/stddialogs.m
darwin/tab.m
darwin/text.m
darwin/util.m
darwin/window.m
darwin/winmoveresize.m
)
set(_LIBUI_SOURCES ${_LIBUI_SOURCES} PARENT_SCOPE)
list(APPEND _LIBUI_INCLUDEDIRS
darwin
)
set(_LIBUI_INCLUDEDIRS _LIBUI_INCLUDEDIRS PARENT_SCOPE)
set(_LIBUINAME libui PARENT_SCOPE)
if(NOT BUILD_SHARED_LIBS)
set(_LIBUINAME libui-temporary PARENT_SCOPE)
endif()
# thanks to Mr-Hide in irc.freenode.net/#cmake
macro(_handle_static)
set_target_properties(${_LIBUINAME} PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
set(_aname $<TARGET_FILE:${_LIBUINAME}>)
set(_lname libui-combined.list)
set(_oname libui-combined.o)
add_custom_command(
OUTPUT ${_oname}
COMMAND
nm -m ${_aname} | sed -E -n "'s/^[0-9a-f]* \\([A-Z_]+,[a-z_]+\\) external //p'" > ${_lname}
COMMAND
ld -exported_symbols_list ${_lname} -r -all_load ${_aname} -o ${_oname}
COMMENT "Removing hidden symbols")
add_library(libui STATIC ${_oname})
# otherwise cmake won't know which linker to use
set_target_properties(libui PROPERTIES
LINKER_LANGUAGE C)
set(_aname)
set(_lname)
set(_oname)
endmacro()
set(_LIBUI_LIBS
objc "-framework Foundation" "-framework AppKit"
PARENT_SCOPE)
+42 -44
View File
@@ -1,6 +1,6 @@
/* 6 april 2015 */
// 6 april 2015
/* TODO add a uiVerifyControlType() function that can be used by control implementations to verify controls */
// TODO add a uiVerifyControlType() function that can be used by control implementations to verify controls
#ifndef __LIBUI_UI_H__
#define __LIBUI_UI_H__
@@ -12,7 +12,7 @@
extern "C" {
#endif
/* this macro is generated by cmake */
// this macro is generated by cmake
#ifdef libui_EXPORTS
#ifdef _WIN32
#define _UI_EXTERN __declspec(dllexport) extern
@@ -20,19 +20,19 @@ extern "C" {
#define _UI_EXTERN __attribute__((visibility("default"))) extern
#endif
#else
/* TODO add __declspec(dllimport) on windows, but only if not static */
// TODO add __declspec(dllimport) on windows, but only if not static
#define _UI_EXTERN extern
#endif
/* C++ is really really really really really really dumb about enums, so screw that and just make them anonymous
* This has the advantage of being ABI-able should we ever need an ABI... */
// C++ is really really really really really really dumb about enums, so screw that and just make them anonymous
// This has the advantage of being ABI-able should we ever need an ABI...
#define _UI_ENUM(s) typedef unsigned int s; enum
/* This constant is provided because M_PI is nonstandard.
* This comes from Go's math.Pi, which in turn comes from http://oeis.org/A000796. */
// This constant is provided because M_PI is nonstandard.
// This comes from Go's math.Pi, which in turn comes from http://oeis.org/A000796.
#define uiPi 3.14159265358979323846264338327950288419716939937510582097494459
/* TODO uiBool? */
// TODO uiBool?
typedef struct uiInitOptions uiInitOptions;
@@ -73,7 +73,7 @@ struct uiControl {
void (*Enable)(uiControl *);
void (*Disable)(uiControl *);
};
/* TOOD add argument names to all arguments */
// TOOD add argument names to all arguments
#define uiControl(this) ((uiControl *) (this))
_UI_EXTERN void uiControlDestroy(uiControl *);
_UI_EXTERN uintptr_t uiControlHandle(uiControl *);
@@ -90,7 +90,7 @@ _UI_EXTERN void uiControlDisable(uiControl *);
_UI_EXTERN uiControl *uiAllocControl(size_t n, uint32_t OSsig, uint32_t typesig, const char *typenamestr);
_UI_EXTERN void uiFreeControl(uiControl *);
/* TODO make sure all controls have these */
// TODO make sure all controls have these
_UI_EXTERN void uiControlVerifySetParent(uiControl *, uiControl *);
_UI_EXTERN int uiControlEnabledToUser(uiControl *);
@@ -174,11 +174,10 @@ _UI_EXTERN int uiGroupMargined(uiGroup *g);
_UI_EXTERN void uiGroupSetMargined(uiGroup *g, int margined);
_UI_EXTERN uiGroup *uiNewGroup(const char *title);
/* spinbox/slider rules:
* setting value outside of range will automatically clamp
* initial value is minimum
* complaint if min >= max?
*/
// spinbox/slider rules:
// setting value outside of range will automatically clamp
// initial value is minimum
// complaint if min >= max?
typedef struct uiSpinbox uiSpinbox;
#define uiSpinbox(this) ((uiSpinbox *) (this))
@@ -218,7 +217,7 @@ typedef struct uiEditableCombobox uiEditableCombobox;
_UI_EXTERN void uiEditableComboboxAppend(uiEditableCombobox *c, const char *text);
_UI_EXTERN char *uiEditableComboboxText(uiEditableCombobox *c);
_UI_EXTERN void uiEditableComboboxSetText(uiEditableCombobox *c, const char *text);
/* TODO what do we call a function that sets the currently selected item and fills the text field with it? editable comboboxes have no consistent concept of selected item */
// TODO what do we call a function that sets the currently selected item and fills the text field with it? editable comboboxes have no consistent concept of selected item
_UI_EXTERN void uiEditableComboboxOnChanged(uiEditableCombobox *c, void (*f)(uiEditableCombobox *c, void *data), void *data);
_UI_EXTERN uiEditableCombobox *uiNewEditableCombobox(void);
@@ -236,7 +235,7 @@ _UI_EXTERN uiDateTimePicker *uiNewDateTimePicker(void);
_UI_EXTERN uiDateTimePicker *uiNewDatePicker(void);
_UI_EXTERN uiDateTimePicker *uiNewTimePicker(void);
/* TODO provide a facility for entering tab stops? */
// TODO provide a facility for entering tab stops?
typedef struct uiMultilineEntry uiMultilineEntry;
#define uiMultilineEntry(this) ((uiMultilineEntry *) (this))
_UI_EXTERN char *uiMultilineEntryText(uiMultilineEntry *e);
@@ -292,8 +291,7 @@ struct uiAreaHandler {
// TODO RTL layouts?
// TODO reconcile edge and corner naming
_UI_ENUM(uiWindowResizeEdge)
{
_UI_ENUM(uiWindowResizeEdge) {
uiWindowResizeEdgeLeft,
uiWindowResizeEdgeTop,
uiWindowResizeEdgeRight,
@@ -301,10 +299,10 @@ _UI_ENUM(uiWindowResizeEdge)
uiWindowResizeEdgeTopLeft,
uiWindowResizeEdgeTopRight,
uiWindowResizeEdgeBottomLeft,
uiWindowResizeEdgeBottomRight
/* TODO have one for keyboard resizes?
* TODO GDK doesn't seem to have any others, including for keyboards...
* TODO way to bring up the system menu instead? */
uiWindowResizeEdgeBottomRight,
// TODO have one for keyboard resizes?
// TODO GDK doesn't seem to have any others, including for keyboards...
// TODO way to bring up the system menu instead?
};
#define uiArea(this) ((uiArea *) (this))
@@ -348,29 +346,29 @@ _UI_ENUM(uiDrawBrushType) {
uiDrawBrushTypeSolid,
uiDrawBrushTypeLinearGradient,
uiDrawBrushTypeRadialGradient,
uiDrawBrushTypeImage
uiDrawBrushTypeImage,
};
_UI_ENUM(uiDrawLineCap) {
uiDrawLineCapFlat,
uiDrawLineCapRound,
uiDrawLineCapSquare
uiDrawLineCapSquare,
};
_UI_ENUM(uiDrawLineJoin) {
uiDrawLineJoinMiter,
uiDrawLineJoinRound,
uiDrawLineJoinBevel
uiDrawLineJoinBevel,
};
/* this is the default for botoh cairo and Direct2D (in the latter case, from the C++ helper functions)
* Core Graphics doesn't explicitly specify a default, but NSBezierPath allows you to choose one, and this is the initial value
* so we're good to use it too! */
// this is the default for botoh cairo and Direct2D (in the latter case, from the C++ helper functions)
// Core Graphics doesn't explicitly specify a default, but NSBezierPath allows you to choose one, and this is the initial value
// so we're good to use it too!
#define uiDrawDefaultMiterLimit 10.0
_UI_ENUM(uiDrawFillMode) {
uiDrawFillModeWinding,
uiDrawFillModeAlternate
uiDrawFillModeAlternate,
};
struct uiDrawMatrix {
@@ -385,13 +383,13 @@ struct uiDrawMatrix {
struct uiDrawBrush {
uiDrawBrushType Type;
/* solid brushes */
// solid brushes
double R;
double G;
double B;
double A;
/* gradient brushes */
// gradient brushes
double X0; // linear: start X, radial: start X
double Y0; // linear: start Y, radial: start Y
double X1; // linear: end X, radial: outer circle center X
@@ -504,13 +502,13 @@ _UI_ENUM(uiDrawTextWeight) {
uiDrawTextWeightBold,
uiDrawTextWeightUltraBold,
uiDrawTextWeightHeavy,
uiDrawTextWeightUltraHeavy
uiDrawTextWeightUltraHeavy,
};
_UI_ENUM(uiDrawTextItalic) {
uiDrawTextItalicNormal,
uiDrawTextItalicOblique,
uiDrawTextItalicItalic
uiDrawTextItalicItalic,
};
_UI_ENUM(uiDrawTextStretch) {
@@ -522,7 +520,7 @@ _UI_ENUM(uiDrawTextStretch) {
uiDrawTextStretchSemiExpanded,
uiDrawTextStretchExpanded,
uiDrawTextStretchExtraExpanded,
uiDrawTextStretchUltraExpanded
uiDrawTextStretchUltraExpanded,
};
struct uiDrawTextFontDescriptor {
@@ -563,10 +561,10 @@ _UI_EXTERN void uiDrawTextLayoutSetColor(uiDrawTextLayout *layout, int startChar
_UI_EXTERN void uiDrawText(uiDrawContext *c, double x, double y, uiDrawTextLayout *layout);
_UI_ENUM(uiModifiers) {
uiModifierCtrl = 1 << 0,
uiModifierAlt = 1 << 1,
uiModifierCtrl = 1 << 0,
uiModifierAlt = 1 << 1,
uiModifierShift = 1 << 2,
uiModifierSuper = 1 << 3
uiModifierSuper = 1 << 3,
};
// TODO document drag captures
@@ -628,7 +626,7 @@ _UI_ENUM(uiExtKey) {
uiExtKeyNAdd,
uiExtKeyNSubtract,
uiExtKeyNMultiply,
uiExtKeyNDivide
uiExtKeyNDivide,
};
struct uiAreaKeyEvent {
@@ -643,9 +641,9 @@ struct uiAreaKeyEvent {
typedef struct uiFontButton uiFontButton;
#define uiFontButton(this) ((uiFontButton *) (this))
/* TODO document this returns a new font */
// TODO document this returns a new font
_UI_EXTERN uiDrawTextFont *uiFontButtonFont(uiFontButton *b);
/* TOOD SetFont, mechanics */
// TOOD SetFont, mechanics
_UI_EXTERN void uiFontButtonOnChanged(uiFontButton *b, void (*f)(uiFontButton *, void *), void *data);
_UI_EXTERN uiFontButton *uiNewFontButton(void);
@@ -668,14 +666,14 @@ _UI_ENUM(uiAlign) {
uiAlignFill,
uiAlignStart,
uiAlignCenter,
uiAlignEnd
uiAlignEnd,
};
_UI_ENUM(uiAt) {
uiAtLeading,
uiAtTop,
uiAtTrailing,
uiAtBottom
uiAtBottom,
};
typedef struct uiGrid uiGrid;
+6 -6
View File
@@ -1,4 +1,4 @@
/* 7 april 2015 */
// 7 april 2015
/*
This file assumes that you have included <gtk/gtk.h> and "ui.h" beforehand. It provides API-specific functions for interfacing with foreign controls on Unix systems that use GTK+ to provide their UI (currently all except Mac OS X).
@@ -19,7 +19,7 @@ struct uiUnixControl {
void (*SetContainer)(uiUnixControl *, GtkContainer *, gboolean);
};
#define uiUnixControl(this) ((uiUnixControl *) (this))
/* TODO document */
// TODO document
_UI_EXTERN void uiUnixControlSetContainer(uiUnixControl *, GtkContainer *, gboolean);
#define uiUnixControlDefaultDestroy(type) \
@@ -80,7 +80,7 @@ _UI_EXTERN void uiUnixControlSetContainer(uiUnixControl *, GtkContainer *, gbool
{ \
gtk_widget_set_sensitive(type(c)->widget, FALSE); \
}
/* TODO this whole addedBefore stuff is a MASSIVE HACK. */
// TODO this whole addedBefore stuff is a MASSIVE HACK.
#define uiUnixControlDefaultSetContainer(type) \
static void type ## SetContainer(uiUnixControl *c, GtkContainer *container, gboolean remove) \
{ \
@@ -112,7 +112,7 @@ _UI_EXTERN void uiUnixControlSetContainer(uiUnixControl *, GtkContainer *, gbool
uiUnixControlDefaultDestroy(type) \
uiUnixControlAllDefaultsExceptDestroy(type)
/* TODO document */
// TODO document
#define uiUnixNewControl(type, var) \
var = type(uiUnixAllocControl(sizeof (type), type ## Signature, #type)); \
uiControl(var)->Destroy = type ## Destroy; \
@@ -127,10 +127,10 @@ _UI_EXTERN void uiUnixControlSetContainer(uiUnixControl *, GtkContainer *, gbool
uiControl(var)->Enable = type ## Enable; \
uiControl(var)->Disable = type ## Disable; \
uiUnixControl(var)->SetContainer = type ## SetContainer;
/* TODO document */
// TODO document
_UI_EXTERN uiUnixControl *uiUnixAllocControl(size_t n, uint32_t typesig, const char *typenamestr);
/* uiUnixStrdupText() takes the given string and produces a copy of it suitable for being freed by uiFreeText(). */
// uiUnixStrdupText() takes the given string and produces a copy of it suitable for being freed by uiFreeText().
_UI_EXTERN char *uiUnixStrdupText(const char *);
#ifdef __cplusplus
+85
View File
@@ -0,0 +1,85 @@
# 3 june 2016
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK REQUIRED gtk+-3.0)
list(APPEND _LIBUI_SOURCES
unix/alloc.c
unix/area.c
unix/box.c
unix/button.c
unix/cellrendererbutton.c
unix/checkbox.c
unix/child.c
unix/colorbutton.c
unix/combobox.c
unix/control.c
unix/datetimepicker.c
unix/debug.c
unix/draw.c
unix/drawmatrix.c
unix/drawpath.c
unix/drawtext.c
unix/editablecombo.c
unix/entry.c
unix/fontbutton.c
unix/form.c
unix/future.c
unix/graphemes.c
unix/grid.c
unix/group.c
unix/image.c
unix/label.c
unix/main.c
unix/menu.c
unix/multilineentry.c
unix/progressbar.c
unix/radiobuttons.c
unix/separator.c
unix/slider.c
unix/spinbox.c
unix/stddialogs.c
unix/tab.c
unix/text.c
unix/util.c
unix/window.c
)
set(_LIBUI_SOURCES ${_LIBUI_SOURCES} PARENT_SCOPE)
list(APPEND _LIBUI_INCLUDEDIRS
unix
)
set(_LIBUI_INCLUDEDIRS _LIBUI_INCLUDEDIRS PARENT_SCOPE)
set(_LIBUINAME libui PARENT_SCOPE)
if(NOT BUILD_SHARED_LIBS)
set(_LIBUINAME libui-temporary PARENT_SCOPE)
endif()
macro(_handle_static)
set_target_properties(${_LIBUINAME} PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
set(_aname $<TARGET_FILE:${_LIBUINAME}>)
set(_oname libui-combined.o)
add_custom_command(
OUTPUT ${_oname}
COMMAND
ld -r --whole-archive ${_aname} -o ${_oname}
COMMAND
objcopy --localize-hidden ${_oname}
COMMENT "Removing hidden symbols")
add_library(libui STATIC ${_oname})
# otherwise cmake won't know which linker to use
set_target_properties(libui PROPERTIES
LINKER_LANGUAGE C)
set(_aname)
set(_oname)
endmacro()
# TODO the other variables don't work?
set(_LIBUI_CFLAGS
${GTK_CFLAGS}
PARENT_SCOPE)
set(_LIBUI_LIBS
${GTK_LDFLAGS} m ${CMAKE_DL_LIBS}
PARENT_SCOPE)
+9 -10
View File
@@ -1,4 +1,4 @@
/* 7 april 2015 */
// 7 april 2015
#include <string.h>
#include "uipriv_unix.h"
@@ -20,8 +20,8 @@ void initAlloc(void)
static void uninitComplain(gpointer ptr, gpointer data)
{
char *str2 = NULL;
char **str = (char **)data;
char **str = (char **) data;
char *str2;
if (*str == NULL)
*str = g_strdup_printf("");
@@ -34,12 +34,10 @@ void uninitAlloc(void)
{
char *str = NULL;
if (allocations->len == 0)
{
g_ptr_array_free(allocations, TRUE);
return;
}
if (allocations->len == 0) {
g_ptr_array_free(allocations, TRUE);
return;
}
g_ptr_array_foreach(allocations, uninitComplain, &str);
userbug("Some data was leaked; either you left a uiControl lying around or there's a bug in libui itself. Leaked data:\n%s", str);
g_free(str);
@@ -47,8 +45,9 @@ void uninitAlloc(void)
void *uiAlloc(size_t size, const char *type)
{
void *out = g_malloc0(EXTRA + size);
void *out;
out = g_malloc0(EXTRA + size);
*SIZE(out) = size;
*TYPE(out) = type;
g_ptr_array_add(allocations, out);
+123 -154
View File
@@ -114,10 +114,10 @@ static void loadAreaSize(uiArea *a, double *width, double *height)
static gboolean areaWidget_draw(GtkWidget *w, cairo_t *cr)
{
areaWidget *aw = areaWidget(w);
uiArea *a = aw->a;
uiAreaDrawParams dp;
double clipX0, clipY0, clipX1, clipY1;
areaWidget *aw = areaWidget(w);
uiArea *a = aw->a;
dp.Context = newContext(cr);
@@ -129,30 +129,25 @@ static gboolean areaWidget_draw(GtkWidget *w, cairo_t *cr)
dp.ClipWidth = clipX1 - clipX0;
dp.ClipHeight = clipY1 - clipY0;
/* no need to save or restore the graphics state
* to reset transformations; GTK+ does that for us */
// no need to save or restore the graphics state to reset transformations; GTK+ does that for us
(*(a->ah->Draw))(a->ah, a, &dp);
freeContext(dp.Context);
return FALSE;
}
/* to do this properly for scrolling areas, we need to
* - return the same value for min and nat
* - call gtk_widget_queue_resize() when the size changes
* thanks to Company in irc.gimp.net/#gtk+ */
static void areaWidget_get_preferred_height(GtkWidget *w,
gint *min, gint *nat)
// to do this properly for scrolling areas, we need to
// - return the same value for min and nat
// - call gtk_widget_queue_resize() when the size changes
// thanks to Company in irc.gimp.net/#gtk+
static void areaWidget_get_preferred_height(GtkWidget *w, gint *min, gint *nat)
{
areaWidget *aw = areaWidget(w);
uiArea *a = aw->a;
// always chain up just in case
GTK_WIDGET_CLASS(areaWidget_parent_class)->
get_preferred_height(w, min, nat);
if (a->scrolling)
{
GTK_WIDGET_CLASS(areaWidget_parent_class)->get_preferred_height(w, min, nat);
if (a->scrolling) {
*min = a->scrollHeight;
*nat = a->scrollHeight;
}
@@ -163,54 +158,51 @@ static void areaWidget_get_preferred_width(GtkWidget *w, gint *min, gint *nat)
areaWidget *aw = areaWidget(w);
uiArea *a = aw->a;
/* always chain up just in case */
// always chain up just in case
GTK_WIDGET_CLASS(areaWidget_parent_class)->get_preferred_width(w, min, nat);
if (a->scrolling)
{
*min = a->scrollWidth;
*nat = a->scrollWidth;
}
if (a->scrolling) {
*min = a->scrollWidth;
*nat = a->scrollWidth;
}
}
static guint translateModifiers(guint state, GdkWindow *window)
{
GdkModifierType statetype;
GdkModifierType statetype;
/* GDK doesn't initialize the modifier flags fully; we have to
* explicitly tell it to (thanks to Daniel_S and daniels
* (two different people) in irc.gimp.net/#gtk+) */
statetype = state;
gdk_keymap_add_virtual_modifiers(
gdk_keymap_get_for_display(gdk_window_get_display(window)),
&statetype);
return statetype;
// GDK doesn't initialize the modifier flags fully; we have to explicitly tell it to (thanks to Daniel_S and daniels (two different people) in irc.gimp.net/#gtk+)
statetype = state;
gdk_keymap_add_virtual_modifiers(
gdk_keymap_get_for_display(gdk_window_get_display(window)),
&statetype);
return statetype;
}
static uiModifiers toModifiers(guint state)
{
uiModifiers m = 0;
uiModifiers m;
if ((state & GDK_CONTROL_MASK) != 0)
m |= uiModifierCtrl;
if ((state & GDK_META_MASK) != 0)
m |= uiModifierAlt;
/* GTK+ itself requires this to be Alt (just read through gtkaccelgroup.c) */
if ((state & GDK_MOD1_MASK) != 0)
m |= uiModifierAlt;
if ((state & GDK_SHIFT_MASK) != 0)
m |= uiModifierShift;
if ((state & GDK_SUPER_MASK) != 0)
m |= uiModifierSuper;
return m;
m = 0;
if ((state & GDK_CONTROL_MASK) != 0)
m |= uiModifierCtrl;
if ((state & GDK_META_MASK) != 0)
m |= uiModifierAlt;
if ((state & GDK_MOD1_MASK) != 0) // GTK+ itself requires this to be Alt (just read through gtkaccelgroup.c)
m |= uiModifierAlt;
if ((state & GDK_SHIFT_MASK) != 0)
m |= uiModifierShift;
if ((state & GDK_SUPER_MASK) != 0)
m |= uiModifierSuper;
return m;
}
/* capture on drag is done automatically on GTK+ */
// capture on drag is done automatically on GTK+
static void finishMouseEvent(uiArea *a, uiAreaMouseEvent *me, guint mb, gdouble x, gdouble y, guint state, GdkWindow *window)
{
/* on GTK+, mouse buttons 4-7 are for scrolling; if we got here, that's a mistake */
// on GTK+, mouse buttons 4-7 are for scrolling; if we got here, that's a mistake
if (mb >= 4 && mb <= 7)
return;
/* if the button ID >= 8, continue counting from 4, as in the MouseEvent spec */
// if the button ID >= 8, continue counting from 4, as in the MouseEvent spec
if (me->Down >= 8)
me->Down -= 4;
if (me->Up >= 8)
@@ -219,7 +211,7 @@ static void finishMouseEvent(uiArea *a, uiAreaMouseEvent *me, guint mb, gdouble
state = translateModifiers(state, window);
me->Modifiers = toModifiers(state);
/* the mb != # checks exclude the Up/Down button from Held */
// the mb != # checks exclude the Up/Down button from Held
me->Held1To64 = 0;
if (mb != 1 && (state & GDK_BUTTON1_MASK) != 0)
me->Held1To64 |= 1 << 0;
@@ -227,19 +219,12 @@ static void finishMouseEvent(uiArea *a, uiAreaMouseEvent *me, guint mb, gdouble
me->Held1To64 |= 1 << 1;
if (mb != 3 && (state & GDK_BUTTON3_MASK) != 0)
me->Held1To64 |= 1 << 2;
// don't check GDK_BUTTON4_MASK or GDK_BUTTON5_MASK because those are for the scrolling buttons mentioned above
// GDK expressly does not support any more buttons in the GdkModifierType; see https://git.gnome.org/browse/gtk+/tree/gdk/x11/gdkdevice-xi2.c#n763 (thanks mclasen in irc.gimp.net/#gtk+)
/* don't check GDK_BUTTON4_MASK or GDK_BUTTON5_MASK because those
* are for the scrolling buttons mentioned above
*
* GDK expressly does not support any more buttons in the
* GdkModifierType; see
* https://git.gnome.org/browse/gtk+/tree/gdk/x11/gdkdevice-xi2.c#n763
* (thanks mclasen in irc.gimp.net/#gtk+)
*/
/* these are already in drawing space coordinates
* the size of drawing space has the same value as the widget allocation
* thanks to tristan in irc.gimp.net/#gtk+ */
// these are already in drawing space coordinates
// the size of drawing space has the same value as the widget allocation
// thanks to tristan in irc.gimp.net/#gtk+
me->X = x;
me->Y = y;
@@ -250,43 +235,37 @@ static void finishMouseEvent(uiArea *a, uiAreaMouseEvent *me, guint mb, gdouble
static gboolean areaWidget_button_press_event(GtkWidget *w, GdkEventButton *e)
{
areaWidget *aw = areaWidget(w);
uiArea *a = aw->a;
gint maxTime, maxDistance;
GtkSettings *settings;
uiAreaMouseEvent me;
areaWidget *aw = areaWidget(w);
uiArea *a = aw->a;
GtkSettings *settings = NULL;
/* clicking doesn't automatically transfer keyboard focus;
* we must do so manually (thanks tristan in irc.gimp.net/#gtk+) */
// clicking doesn't automatically transfer keyboard focus; we must do so manually (thanks tristan in irc.gimp.net/#gtk+)
gtk_widget_grab_focus(w);
/* we handle multiple clicks ourselves here,
* in the same way as we do on Windows */
/* ignore GDK's generated double-clicks and beyond */
// we handle multiple clicks ourselves here, in the same way as we do on Windows
if (e->type != GDK_BUTTON_PRESS)
// ignore GDK's generated double-clicks and beyond
return GDK_EVENT_PROPAGATE;
settings = gtk_widget_get_settings(w);
g_object_get(settings,
"gtk-double-click-time", &maxTime,
"gtk-double-click-distance", &maxDistance,
NULL);
/* don't unref settings; it's transfer-none (thanks gregier in irc.gimp.net/#gtk+)
* e->time is guint32
* e->x and e->y are floating-point; just make them 32-bit integers
* maxTime and maxDistance... are gint, which *should* fit, hopefully... */
// don't unref settings; it's transfer-none (thanks gregier in irc.gimp.net/#gtk+)
// e->time is guint32
// e->x and e->y are floating-point; just make them 32-bit integers
// maxTime and maxDistance... are gint, which *should* fit, hopefully...
me.Count = clickCounterClick(a->cc, me.Down,
e->x, e->y,
e->time, maxTime,
maxDistance, maxDistance);
me.Down = e->button;
me.Up = 0;
me.Up = 0;
/* and set things up for window drags */
// and set things up for window drags
a->dragevent = e;
finishMouseEvent(a, &me, e->button, e->x, e->y, e->state, e->window);
a->dragevent = NULL;
@@ -295,37 +274,32 @@ static gboolean areaWidget_button_press_event(GtkWidget *w, GdkEventButton *e)
static gboolean areaWidget_button_release_event(GtkWidget *w, GdkEventButton *e)
{
uiAreaMouseEvent me;
areaWidget *aw = areaWidget(w);
uiArea *a = aw->a;
areaWidget *aw = areaWidget(w);
uiArea *a = aw->a;
uiAreaMouseEvent me;
me.Down = 0;
me.Up = e->button;
me.Count = 0;
finishMouseEvent(a, &me, e->button, e->x, e->y, e->state, e->window);
return GDK_EVENT_PROPAGATE;
me.Down = 0;
me.Up = e->button;
me.Count = 0;
finishMouseEvent(a, &me, e->button, e->x, e->y, e->state, e->window);
return GDK_EVENT_PROPAGATE;
}
static gboolean areaWidget_motion_notify_event(GtkWidget *w, GdkEventMotion *e)
{
uiAreaMouseEvent me;
areaWidget *aw = areaWidget(w);
uiArea *a = aw->a;
uiArea *a = aw->a;
uiAreaMouseEvent me;
me.Down = 0;
me.Up = 0;
me.Count = 0;
me.Down = 0;
me.Up = 0;
me.Count = 0;
finishMouseEvent(a, &me, 0, e->x, e->y, e->state, e->window);
return GDK_EVENT_PROPAGATE;
}
/* we want switching away from the control to reset the double-click counter,
* like with WM_ACTIVATE on Windows
*
* according to tristan in irc.gimp.net/#gtk+, doing this on both
* enter-notify-event and leave-notify-event is correct (and it seems to be
* true in my own tests; plus the events DO get sent when switching programs
* with the keyboard (just pointing that out)) */
// we want switching away from the control to reset the double-click counter, like with WM_ACTIVATE on Windows
// according to tristan in irc.gimp.net/#gtk+, doing this on both enter-notify-event and leave-notify-event is correct (and it seems to be true in my own tests; plus the events DO get sent when switching programs with the keyboard (just pointing that out))
static gboolean onCrossing(areaWidget *aw, int left)
{
uiArea *a = aw->a;
@@ -345,15 +319,11 @@ static gboolean areaWidget_leave_notify_event(GtkWidget *w, GdkEventCrossing *e)
return onCrossing(areaWidget(w), 1);
}
/* note: there is no equivalent to WM_CAPTURECHANGED on GTK+; there literally
* is no way to break a grab like that (at least not on X11 and Wayland)
*
* even if I invoke the task switcher and switch processes, the mouse grab will
* still be held until I let go of all buttons
* therefore, no DragBroken()
*
* we use GDK_KEY_Print as a sentinel because libui will never support the print screen key; that key belongs to the user
*/
// note: there is no equivalent to WM_CAPTURECHANGED on GTK+; there literally is no way to break a grab like that (at least not on X11 and Wayland)
// even if I invoke the task switcher and switch processes, the mouse grab will still be held until I let go of all buttons
// therefore, no DragBroken()
// we use GDK_KEY_Print as a sentinel because libui will never support the print screen key; that key belongs to the user
static const struct {
guint keyval;
@@ -382,7 +352,7 @@ static const struct {
{ GDK_KEY_F10, uiExtKeyF10 },
{ GDK_KEY_F11, uiExtKeyF11 },
{ GDK_KEY_F12, uiExtKeyF12 },
/* numpad numeric keys and . are handled in events.c */
// numpad numeric keys and . are handled in events.c
{ GDK_KEY_KP_Enter, uiExtKeyNEnter },
{ GDK_KEY_KP_Add, uiExtKeyNAdd },
{ GDK_KEY_KP_Subtract, uiExtKeyNSubtract },
@@ -424,25 +394,23 @@ static int areaKeyEvent(uiArea *a, int up, GdkEventKey *e)
ke.Up = up;
for (i = 0; extKeys[i].keyval != GDK_KEY_Print; i++)
if (extKeys[i].keyval == e->keyval)
{
if (extKeys[i].keyval == e->keyval) {
ke.ExtKey = extKeys[i].extkey;
goto keyFound;
}
for (i = 0; modKeys[i].keyval != GDK_KEY_Print; i++)
if (modKeys[i].keyval == e->keyval)
{
ke.Modifier = modKeys[i].mod;
/* don't include the modifier in ke.Modifiers */
ke.Modifiers &= ~ke.Modifier;
goto keyFound;
}
if (modKeys[i].keyval == e->keyval) {
ke.Modifier = modKeys[i].mod;
// don't include the modifier in ke.Modifiers
ke.Modifiers &= ~ke.Modifier;
goto keyFound;
}
if (fromScancode(e->hardware_keycode - 8, &ke))
goto keyFound;
/* no supported key found; treat as unhandled */
// no supported key found; treat as unhandled
return 0;
keyFound:
@@ -452,7 +420,7 @@ keyFound:
static gboolean areaWidget_key_press_event(GtkWidget *w, GdkEventKey *e)
{
areaWidget *aw = areaWidget(w);
uiArea *a = aw->a;
uiArea *a = aw->a;
if (areaKeyEvent(a, 0, e))
return GDK_EVENT_STOP;
@@ -478,16 +446,15 @@ static GParamSpec *pspecArea;
static void areaWidget_set_property(GObject *obj, guint prop, const GValue *value, GParamSpec *pspec)
{
areaWidget *aw = areaWidget(obj);
areaWidget *aw = areaWidget(obj);
switch (prop)
{
case pArea:
aw->a = (uiArea *) g_value_get_pointer(value);
aw->a->cc = &(aw->cc);
return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, prop, pspec);
switch (prop) {
case pArea:
aw->a = (uiArea *) g_value_get_pointer(value);
aw->a->cc = &(aw->cc);
return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, prop, pspec);
}
static void areaWidget_get_property(GObject *obj, guint prop, GValue *value, GParamSpec *pspec)
@@ -541,8 +508,8 @@ void uiAreaQueueRedrawAll(uiArea *a)
void uiAreaScrollTo(uiArea *a, double x, double y, double width, double height)
{
/* TODO
* TODO adjust adjustments and find source for that */
// TODO
// TODO adjust adjustments and find source for that
}
void uiAreaBeginUserWindowMove(uiArea *a)
@@ -551,23 +518,25 @@ void uiAreaBeginUserWindowMove(uiArea *a)
if (a->dragevent == NULL)
userbug("cannot call uiAreaBeginUserWindowMove() outside of a Mouse() with Down != 0");
/* TODO don't we have a libui function for this? did I scrap it?
* TODO widget or areaWidget? */
// TODO don't we have a libui function for this? did I scrap it?
// TODO widget or areaWidget?
toplevel = gtk_widget_get_toplevel(a->widget);
// TODO
if (toplevel == NULL)
if (toplevel == NULL) {
// TODO
return;
/* the docs say to do this */
/* TODO */
if (!gtk_widget_is_toplevel(toplevel))
}
// the docs say to do this
if (!gtk_widget_is_toplevel(toplevel)) {
// TODO
return;
/* TODO */
if (!GTK_IS_WINDOW(toplevel))
}
if (!GTK_IS_WINDOW(toplevel)) {
// TODO
return;
}
gtk_window_begin_move_drag(GTK_WINDOW(toplevel),
a->dragevent->button,
a->dragevent->x_root, /* TODO are these correct? */
a->dragevent->x_root, // TODO are these correct?
a->dragevent->y_root,
a->dragevent->time);
}
@@ -589,25 +558,26 @@ void uiAreaBeginUserWindowResize(uiArea *a, uiWindowResizeEdge edge)
if (a->dragevent == NULL)
userbug("cannot call uiAreaBeginUserWindowResize() outside of a Mouse() with Down != 0");
/* TODO don't we have a libui function for this? did I scrap it?
* TODO widget or areaWidget? */
// TODO don't we have a libui function for this? did I scrap it?
// TODO widget or areaWidget?
toplevel = gtk_widget_get_toplevel(a->widget);
/* TODO */
if (toplevel == NULL)
if (toplevel == NULL) {
// TODO
return;
/* the docs say to do this */
/* TODO */
if (!gtk_widget_is_toplevel(toplevel))
}
// the docs say to do this
if (!gtk_widget_is_toplevel(toplevel)) {
// TODO
return;
/* TODO */
if (!GTK_IS_WINDOW(toplevel))
}
if (!GTK_IS_WINDOW(toplevel)) {
// TODO
return;
}
gtk_window_begin_resize_drag(GTK_WINDOW(toplevel),
edges[edge],
a->dragevent->button,
a->dragevent->x_root, /* TODO are these correct? */
a->dragevent->x_root, // TODO are these correct?
a->dragevent->y_root,
a->dragevent->time);
}
@@ -656,8 +626,7 @@ uiArea *uiNewScrollingArea(uiAreaHandler *ah, int width, int height)
a->widget = a->swidget;
gtk_container_add(a->scontainer, a->areaWidget);
/* and make the area visible; only the scrolled
* window's visibility is controlled by libui */
// and make the area visible; only the scrolled window's visibility is controlled by libui
gtk_widget_show(a->areaWidget);
return a;
+33 -33
View File
@@ -1,26 +1,24 @@
// 7 april 2015
#include "uipriv_unix.h"
struct boxChild
{
uiControl *c;
int stretchy;
gboolean oldhexpand;
GtkAlign oldhalign;
gboolean oldvexpand;
GtkAlign oldvalign;
struct boxChild {
uiControl *c;
int stretchy;
gboolean oldhexpand;
GtkAlign oldhalign;
gboolean oldvexpand;
GtkAlign oldvalign;
};
struct uiBox
{
uiUnixControl c;
GtkWidget *widget;
GtkContainer *container;
GtkBox *box;
GArray *controls;
int vertical;
int padded;
GtkSizeGroup *stretchygroup; /* ensures all stretchy controls have the same size */
struct uiBox {
uiUnixControl c;
GtkWidget *widget;
GtkContainer *container;
GtkBox *box;
GArray *controls;
int vertical;
int padded;
GtkSizeGroup *stretchygroup; // ensures all stretchy controls have the same size
};
uiUnixControlAllDefaultsExceptDestroy(uiBox)
@@ -33,19 +31,18 @@ static void uiBoxDestroy(uiControl *c)
struct boxChild *bc;
guint i;
/* kill the size group */
// kill the size group
g_object_unref(b->stretchygroup);
/* free all controls */
for (i = 0; i < b->controls->len; i++)
{
bc = ctrl(b, i);
uiControlSetParent(bc->c, NULL);
/* and make sure the widget itself stays alive */
uiUnixControlSetContainer(uiUnixControl(bc->c), b->container, TRUE);
uiControlDestroy(bc->c);
}
// free all controls
for (i = 0; i < b->controls->len; i++) {
bc = ctrl(b, i);
uiControlSetParent(bc->c, NULL);
// and make sure the widget itself stays alive
uiUnixControlSetContainer(uiUnixControl(bc->c), b->container, TRUE);
uiControlDestroy(bc->c);
}
g_array_free(b->controls, TRUE);
/* and then ourselves */
// and then ourselves
g_object_unref(b->widget);
uiFreeControl(uiControl(b));
}
@@ -53,7 +50,7 @@ static void uiBoxDestroy(uiControl *c)
void uiBoxAppend(uiBox *b, uiControl *c, int stretchy)
{
struct boxChild bc;
GtkWidget *widget = NULL;
GtkWidget *widget;
bc.c = c;
bc.stretchy = stretchy;
@@ -77,7 +74,7 @@ void uiBoxAppend(uiBox *b, uiControl *c, int stretchy)
gtk_widget_set_vexpand(widget, FALSE);
else
gtk_widget_set_hexpand(widget, FALSE);
/* and make them fill the opposite direction */
// and make them fill the opposite direction
if (b->vertical) {
gtk_widget_set_hexpand(widget, TRUE);
gtk_widget_set_halign(widget, GTK_ALIGN_FILL);
@@ -93,8 +90,11 @@ void uiBoxAppend(uiBox *b, uiControl *c, int stretchy)
void uiBoxDelete(uiBox *b, int index)
{
struct boxChild *bc = ctrl(b, index);
GtkWidget *widget = GTK_WIDGET(uiControlHandle(bc->c));
struct boxChild *bc;
GtkWidget *widget;
bc = ctrl(b, index);
widget = GTK_WIDGET(uiControlHandle(bc->c));
uiControlSetParent(bc->c, NULL);
uiUnixControlSetContainer(uiUnixControl(bc->c), b->container, TRUE);
+3 -4
View File
@@ -1,8 +1,7 @@
// 10 june 2015
#include "uipriv_unix.h"
struct uiButton
{
struct uiButton {
uiUnixControl c;
GtkWidget *widget;
GtkButton *button;
@@ -21,7 +20,7 @@ static void onClicked(GtkButton *button, gpointer data)
static void defaultOnClicked(uiButton *b, void *data)
{
/* do nothing */
// do nothing
}
char *uiButtonText(uiButton *b)
@@ -36,7 +35,7 @@ void uiButtonSetText(uiButton *b, const char *text)
void uiButtonOnClicked(uiButton *b, void (*f)(uiButton *, void *), void *data)
{
b->onClicked = f;
b->onClicked = f;
b->onClickedData = data;
}
File renamed without changes.
File renamed without changes.
+7 -7
View File
@@ -28,7 +28,7 @@ struct child {
struct child *newChild(uiControl *child, uiControl *parent, GtkContainer *parentContainer)
{
struct child *c = NULL;
struct child *c;
if (child == NULL)
return NULL;
@@ -51,8 +51,8 @@ struct child *newChild(uiControl *child, uiControl *parent, GtkContainer *parent
struct child *newChildWithBox(uiControl *child, uiControl *parent, GtkContainer *parentContainer, int margined)
{
struct child *c = NULL;
GtkWidget *box = NULL;
struct child *c;
GtkWidget *box;
if (child == NULL)
return NULL;
@@ -87,11 +87,11 @@ void childRemove(struct child *c)
void childDestroy(struct child *c)
{
uiControl *child = NULL;
uiControl *child;
child = c->c;
childRemove(c);
uiControlDestroy(child);
child = c->c;
childRemove(c);
uiControlDestroy(child);
}
GtkWidget *childWidget(struct child *c)
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -14,31 +14,30 @@
typedef struct dateTimePickerWidget dateTimePickerWidget;
typedef struct dateTimePickerWidgetClass dateTimePickerWidgetClass;
struct dateTimePickerWidget
{
GtkToggleButton parent_instance;
struct dateTimePickerWidget {
GtkToggleButton parent_instance;
gulong toggledSignal;
gulong toggledSignal;
gboolean hasTime;
gboolean hasDate;
gboolean hasTime;
gboolean hasDate;
GtkWidget *window;
GtkWidget *box;
GtkWidget *calendar;
GtkWidget *timebox;
GtkWidget *hours;
GtkWidget *minutes;
GtkWidget *seconds;
GtkWidget *ampm;
GtkWidget *window;
GtkWidget *box;
GtkWidget *calendar;
GtkWidget *timebox;
GtkWidget *hours;
GtkWidget *minutes;
GtkWidget *seconds;
GtkWidget *ampm;
gulong hoursBlock;
gulong minutesBlock;
gulong secondsBlock;
gulong ampmBlock;
gulong hoursBlock;
gulong minutesBlock;
gulong secondsBlock;
gulong ampmBlock;
GdkDevice *keyboard;
GdkDevice *mouse;
GdkDevice *keyboard;
GdkDevice *mouse;
};
struct dateTimePickerWidgetClass {
@@ -49,7 +48,9 @@ G_DEFINE_TYPE(dateTimePickerWidget, dateTimePickerWidget, GTK_TYPE_TOGGLE_BUTTON
static int realSpinValue(GtkSpinButton *spinButton)
{
GtkAdjustment *adj = gtk_spin_button_get_adjustment(spinButton);
GtkAdjustment *adj;
adj = gtk_spin_button_get_adjustment(spinButton);
return (int) gtk_adjustment_get_value(adj);
}
@@ -69,14 +70,11 @@ static GDateTime *selected(dateTimePickerWidget *d)
guint year = 1970, month = 1, day = 1;
guint hour = 0, minute = 0, second = 0;
if (d->hasDate)
{
if (d->hasDate) {
gtk_calendar_get_date(GTK_CALENDAR(d->calendar), &year, &month, &day);
month++; /* GtkCalendar/GDateTime differences */
month++; // GtkCalendar/GDateTime differences
}
if (d->hasTime)
{
if (d->hasTime) {
hour = realSpinValue(GTK_SPIN_BUTTON(d->hours));
if (realSpinValue(GTK_SPIN_BUTTON(d->ampm)) != 0)
hour += 12;
@@ -88,22 +86,21 @@ static GDateTime *selected(dateTimePickerWidget *d)
static void setLabel(dateTimePickerWidget *d)
{
char *fmt = NULL;
char *msg = NULL;
GDateTime *dt = selected(d);
gboolean free = FALSE;
GDateTime *dt;
char *fmt;
char *msg;
gboolean free;
if (d->hasDate && d->hasTime)
{
/* don't use D_T_FMT; that's too verbose */
fmt = g_strdup_printf("%s %s", nl_langinfo(D_FMT), nl_langinfo(T_FMT));
dt = selected(d);
free = FALSE;
if (d->hasDate && d->hasTime) {
// don't use D_T_FMT; that's too verbose
fmt = g_strdup_printf("%s %s", nl_langinfo(D_FMT), nl_langinfo(T_FMT));
free = TRUE;
}
else if (d->hasDate)
fmt = nl_langinfo(D_FMT);
} else if (d->hasDate)
fmt = nl_langinfo(D_FMT);
else
fmt = nl_langinfo(T_FMT);
msg = g_date_time_format(dt, fmt);
gtk_button_set_label(GTK_BUTTON(d), msg);
g_free(msg);
@@ -147,31 +144,32 @@ static void hidePopup(dateTimePickerWidget *d)
// this consolidates a good chunk of what GtkComboBox does
static gboolean startGrab(dateTimePickerWidget *d)
{
GdkDevice *dev;
guint32 time;
GdkWindow *window = NULL;
GdkDevice *keyboard = NULL;
GdkDevice *mouse = NULL;
GdkDevice *dev = gtk_get_current_event_device();
GdkWindow *window;
GdkDevice *keyboard, *mouse;
if (dev == NULL)
{
dev = gtk_get_current_event_device();
if (dev == NULL) {
// this is what GtkComboBox does
// since no device was set, just use the first available "master device"
GdkDisplay *disp = gtk_widget_get_display(GTK_WIDGET(d));
GdkDeviceManager *dm = gdk_display_get_device_manager(disp);
GList *list = gdk_device_manager_list_devices(dm, GDK_DEVICE_TYPE_MASTER);
GdkDisplay *disp;
GdkDeviceManager *dm;
GList *list;
disp = gtk_widget_get_display(GTK_WIDGET(d));
dm = gdk_display_get_device_manager(disp);
list = gdk_device_manager_list_devices(dm, GDK_DEVICE_TYPE_MASTER);
dev = (GdkDevice *) (list->data);
g_list_free(list);
}
time = gtk_get_current_event_time();
time = gtk_get_current_event_time();
keyboard = dev;
mouse = gdk_device_get_associated_device(dev);
if (gdk_device_get_source(dev) != GDK_SOURCE_KEYBOARD)
{
dev = mouse;
mouse = keyboard;
mouse = gdk_device_get_associated_device(dev);
if (gdk_device_get_source(dev) != GDK_SOURCE_KEYBOARD) {
dev = mouse;
mouse = keyboard;
keyboard = dev;
}
@@ -198,7 +196,7 @@ static gboolean startGrab(dateTimePickerWidget *d)
return TRUE;
}
/* based on gtk_combo_box_list_position() in the GTK+ source code */
// based on gtk_combo_box_list_position() in the GTK+ source code
static void allocationToScreen(dateTimePickerWidget *d, gint *x, gint *y)
{
GdkWindow *window;
@@ -279,17 +277,15 @@ static gboolean grabBroken(GtkWidget *w, GdkEventGrabBroken *e, gpointer data)
static gboolean buttonReleased(GtkWidget *w, GdkEventButton *e, gpointer data)
{
dateTimePickerWidget *d = dateTimePickerWidget(data);
int winx, winy;
GtkAllocation wina;
gboolean in;
dateTimePickerWidget *d = dateTimePickerWidget(data);
gtk_widget_get_allocation(d->window, &wina);
winx = 0;
winy = 0;
if (!gtk_widget_get_has_window(d->window))
{
if (!gtk_widget_get_has_window(d->window)) {
winx = wina.x;
winy = wina.y;
}
@@ -311,9 +307,11 @@ static gboolean buttonReleased(GtkWidget *w, GdkEventButton *e, gpointer data)
static gint hoursSpinboxInput(GtkSpinButton *sb, gpointer ptr, gpointer data)
{
double *out = (double *) ptr;
const gchar *text = gtk_entry_get_text(GTK_ENTRY(sb));
int value = (int) g_strtod(text, NULL);
const gchar *text;
int value;
text = gtk_entry_get_text(GTK_ENTRY(sb));
value = (int) g_strtod(text, NULL);
if (value < 0 || value > 12)
return GTK_INPUT_ERROR;
if (value == 12) // 12 to the user is 0 internally
@@ -324,9 +322,10 @@ static gint hoursSpinboxInput(GtkSpinButton *sb, gpointer ptr, gpointer data)
static gboolean hoursSpinboxOutput(GtkSpinButton *sb, gpointer data)
{
gchar *text = NULL;
int value = realSpinValue(sb);
gchar *text;
int value;
value = realSpinValue(sb);
if (value == 0) // 0 internally is 12 to the user
value = 12;
text = g_strdup_printf("%d", value);
@@ -337,9 +336,11 @@ static gboolean hoursSpinboxOutput(GtkSpinButton *sb, gpointer data)
static gboolean zeroPadSpinbox(GtkSpinButton *sb, gpointer data)
{
int value = realSpinValue(sb);
gchar *text = g_strdup_printf("%02d", value);
gchar *text;
int value;
value = realSpinValue(sb);
text = g_strdup_printf("%02d", value);
gtk_entry_set_text(GTK_ENTRY(sb), text);
g_free(text);
return TRUE;
@@ -348,20 +349,19 @@ static gboolean zeroPadSpinbox(GtkSpinButton *sb, gpointer data)
// this is really hacky but we can't use GtkCombobox here :(
static gint ampmSpinboxInput(GtkSpinButton *sb, gpointer ptr, gpointer data)
{
double *out = (double *) ptr;
const gchar *text = gtk_entry_get_text(GTK_ENTRY(sb));
// LONGTERM don't use ASCII here for case insensitivity
char firstAM = g_ascii_tolower(nl_langinfo(AM_STR)[0]);
char firstPM = g_ascii_tolower(nl_langinfo(PM_STR)[0]);
double *out = (double *) ptr;
const gchar *text;
char firstAM, firstPM;
text = gtk_entry_get_text(GTK_ENTRY(sb));
// LONGTERM don't use ASCII here for case insensitivity
firstAM = g_ascii_tolower(nl_langinfo(AM_STR)[0]);
firstPM = g_ascii_tolower(nl_langinfo(PM_STR)[0]);
for (; *text != '\0'; text++)
if (g_ascii_tolower(*text) == firstAM)
{
if (g_ascii_tolower(*text) == firstAM) {
*out = 0;
return TRUE;
}
else if (g_ascii_tolower(*text) == firstPM)
{
} else if (g_ascii_tolower(*text) == firstPM) {
*out = 1;
return TRUE;
}
@@ -387,21 +387,20 @@ static void spinboxChanged(GtkSpinButton *sb, gpointer data)
dateTimeChanged(d);
}
static GtkWidget *newSpinbox(dateTimePickerWidget *d, int min, int max,
gint (*input)(GtkSpinButton *, gpointer, gpointer),
gboolean (*output)(GtkSpinButton *, gpointer), gulong *block)
static GtkWidget *newSpinbox(dateTimePickerWidget *d, int min, int max, gint (*input)(GtkSpinButton *, gpointer, gpointer), gboolean (*output)(GtkSpinButton *, gpointer), gulong *block)
{
GtkWidget *sb = gtk_spin_button_new_with_range(min, max, 1);
GtkWidget *sb;
gtk_spin_button_set_digits(GTK_SPIN_BUTTON(sb), 0);
gtk_spin_button_set_wrap(GTK_SPIN_BUTTON(sb), TRUE);
gtk_orientable_set_orientation(GTK_ORIENTABLE(sb), GTK_ORIENTATION_VERTICAL);
*block = g_signal_connect(sb, "value-changed", G_CALLBACK(spinboxChanged), d);
if (input != NULL)
g_signal_connect(sb, "input", G_CALLBACK(input), NULL);
if (output != NULL)
g_signal_connect(sb, "output", G_CALLBACK(output), NULL);
return sb;
sb = gtk_spin_button_new_with_range(min, max, 1);
gtk_spin_button_set_digits(GTK_SPIN_BUTTON(sb), 0);
gtk_spin_button_set_wrap(GTK_SPIN_BUTTON(sb), TRUE);
gtk_orientable_set_orientation(GTK_ORIENTABLE(sb), GTK_ORIENTATION_VERTICAL);
*block = g_signal_connect(sb, "value-changed", G_CALLBACK(spinboxChanged), d);
if (input != NULL)
g_signal_connect(sb, "input", G_CALLBACK(input), NULL);
if (output != NULL)
g_signal_connect(sb, "output", G_CALLBACK(output), NULL);
return sb;
}
static void dateChanged(GtkCalendar *c, gpointer data)
@@ -537,14 +536,18 @@ static void dateTimePickerWidget_class_init(dateTimePickerWidgetClass *class)
static GtkWidget *newDTP(void)
{
GtkWidget *w = GTK_WIDGET(g_object_new(dateTimePickerWidgetType, "label", "", NULL));
GtkWidget *w;
w = GTK_WIDGET(g_object_new(dateTimePickerWidgetType, "label", "", NULL));
setLabel(dateTimePickerWidget(w));
return w;
}
static GtkWidget *newDP(void)
{
GtkWidget *w = GTK_WIDGET(g_object_new(dateTimePickerWidgetType, "label", "", NULL));
GtkWidget *w;
w = GTK_WIDGET(g_object_new(dateTimePickerWidgetType, "label", "", NULL));
setDateOnly(dateTimePickerWidget(w));
setLabel(dateTimePickerWidget(w));
return w;
@@ -552,17 +555,18 @@ static GtkWidget *newDP(void)
static GtkWidget *newTP(void)
{
GtkWidget *w = GTK_WIDGET(g_object_new(dateTimePickerWidgetType, "label", "", NULL));
GtkWidget *w;
w = GTK_WIDGET(g_object_new(dateTimePickerWidgetType, "label", "", NULL));
setTimeOnly(dateTimePickerWidget(w));
setLabel(dateTimePickerWidget(w));
return w;
}
struct uiDateTimePicker
{
uiUnixControl c;
GtkWidget *widget;
dateTimePickerWidget *d;
struct uiDateTimePicker {
uiUnixControl c;
GtkWidget *widget;
dateTimePickerWidget *d;
};
uiUnixControlAllDefaults(uiDateTimePicker)
@@ -574,7 +578,7 @@ uiDateTimePicker *finishNewDateTimePicker(GtkWidget *(*fn)(void))
uiUnixNewControl(uiDateTimePicker, d);
d->widget = (*fn)();
d->d = dateTimePickerWidget(d->widget);
d->d = dateTimePickerWidget(d->widget);
return d;
}
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+30 -33
View File
@@ -1,27 +1,25 @@
// 8 june 2016
#include "uipriv_unix.h"
struct formChild
{
uiControl *c;
int stretchy;
GtkWidget *label;
gboolean oldhexpand;
GtkAlign oldhalign;
gboolean oldvexpand;
GtkAlign oldvalign;
GBinding *labelBinding;
struct formChild {
uiControl *c;
int stretchy;
GtkWidget *label;
gboolean oldhexpand;
GtkAlign oldhalign;
gboolean oldvexpand;
GtkAlign oldvalign;
GBinding *labelBinding;
};
struct uiForm
{
uiUnixControl c;
GtkWidget *widget;
GtkContainer *container;
GtkGrid *grid;
GArray *children;
int padded;
GtkSizeGroup *stretchygroup; /* ensures all stretchy controls have the same size */
struct uiForm {
uiUnixControl c;
GtkWidget *widget;
GtkContainer *container;
GtkGrid *grid;
GArray *children;
int padded;
GtkSizeGroup *stretchygroup; // ensures all stretchy controls have the same size
};
uiUnixControlAllDefaultsExceptDestroy(uiForm)
@@ -34,19 +32,18 @@ static void uiFormDestroy(uiControl *c)
struct formChild *fc;
guint i;
/* kill the size group */
// kill the size group
g_object_unref(f->stretchygroup);
/* free all controls */
for (i = 0; i < f->children->len; i++)
{
fc = ctrl(f, i);
uiControlSetParent(fc->c, NULL);
uiUnixControlSetContainer(uiUnixControl(fc->c), f->container, TRUE);
uiControlDestroy(fc->c);
gtk_widget_destroy(fc->label);
}
// free all controls
for (i = 0; i < f->children->len; i++) {
fc = ctrl(f, i);
uiControlSetParent(fc->c, NULL);
uiUnixControlSetContainer(uiUnixControl(fc->c), f->container, TRUE);
uiControlDestroy(fc->c);
gtk_widget_destroy(fc->label);
}
g_array_free(f->children, TRUE);
/* and then ourselves */
// and then ourselves
g_object_unref(f->widget);
uiFreeControl(uiControl(f));
}
@@ -71,7 +68,7 @@ void uiFormAppend(uiForm *f, const char *label, uiControl *c, int stretchy)
gtk_size_group_add_widget(f->stretchygroup, widget);
} else
gtk_widget_set_vexpand(widget, FALSE);
/* and make them fill horizontally */
// and make them fill horizontally
gtk_widget_set_hexpand(widget, TRUE);
gtk_widget_set_halign(widget, GTK_ALIGN_FILL);
@@ -88,7 +85,7 @@ void uiFormAppend(uiForm *f, const char *label, uiControl *c, int stretchy)
gtk_grid_attach(f->grid, fc.label,
0, row,
1, 1);
/* and make them share visibility so if the control is hidden, so is its label */
// and make them share visibility so if the control is hidden, so is its label
fc.labelBinding = g_object_bind_property(GTK_WIDGET(uiControlHandle(fc.c)), "visible",
fc.label, "visible",
G_BINDING_SYNC_CREATE);
@@ -97,7 +94,7 @@ void uiFormAppend(uiForm *f, const char *label, uiControl *c, int stretchy)
uiUnixControlSetContainer(uiUnixControl(fc.c), f->container, FALSE);
g_array_append_val(f->children, fc);
/* move the widget to the correct place */
// move the widget to the correct place
gtk_container_child_set(f->container, widget,
"left-attach", 1,
"top-attach", row,
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
+8 -10
View File
@@ -52,10 +52,8 @@ void uiImageAppend(uiImage *i, void *pixels, int pixelWidth, int pixelHeight, in
cs = cairo_image_surface_create_for_data(buf, CAIRO_FORMAT_ARGB32,
pixelWidth, pixelHeight,
cstride);
/* TODO */
if (cairo_surface_status(cs) != CAIRO_STATUS_SUCCESS) { }
if (cairo_surface_status(cs) != CAIRO_STATUS_SUCCESS)
/* TODO */;
cairo_surface_flush(cs);
g_ptr_array_add(i->images, cs);
}
@@ -69,7 +67,7 @@ struct matcher {
gboolean foundLarger;
};
/* TODO is this the right algorithm? */
// TODO is this the right algorithm?
static void match(gpointer surface, gpointer data)
{
cairo_surface_t *cs = (cairo_surface_t *) surface;
@@ -83,11 +81,11 @@ static void match(gpointer surface, gpointer data)
goto writeMatch;
if (x < m->targetX && y < m->targetY)
if (m->foundLarger) /* always prefer larger ones */
if (m->foundLarger)
// always prefer larger ones
return;
/* we set foundLarger below */
if (x >= m->targetX && y >= m->targetY && !m->foundLarger)
// we set foundLarger below
goto writeMatch;
x2 = abs(m->targetX - x);
@@ -95,11 +93,11 @@ static void match(gpointer surface, gpointer data)
if (x2 < m->distX && y2 < m->distY)
goto writeMatch;
/* TODO weight one dimension? threshhold? */
// TODO weight one dimension? threshhold?
return;
writeMatch:
/* must set this here too; otherwise the first image will never have ths set */
// must set this here too; otherwise the first image will never have ths set
if (x >= m->targetX && y >= m->targetY && !m->foundLarger)
m->foundLarger = TRUE;
m->best = cs;
File renamed without changes.
+18 -19
View File
@@ -6,15 +6,14 @@ uiInitOptions options;
const char *uiInit(uiInitOptions *o)
{
GError *err = NULL;
const char *msg;
options = *o;
if (gtk_init_with_args(NULL, NULL, NULL, NULL, NULL, &err) == FALSE)
{
const char *msg = g_strdup(err->message);
g_error_free(err);
return msg;
}
options = *o;
if (gtk_init_with_args(NULL, NULL, NULL, NULL, NULL, &err) == FALSE) {
msg = g_strdup(err->message);
g_error_free(err);
return msg;
}
initAlloc();
loadFutures();
return NULL;
@@ -41,9 +40,8 @@ void uiMain(void)
static gboolean stepsQuit = FALSE;
/* the only difference is we ignore the return value from gtk_main_iteration_do(),
* since it will always be TRUE if gtk_main() was never called
* gtk_main_iteration_do() will still run the main loop regardless */
// the only difference is we ignore the return value from gtk_main_iteration_do(), since it will always be TRUE if gtk_main() was never called
// gtk_main_iteration_do() will still run the main loop regardless
static gboolean stepsIteration(gboolean block)
{
gtk_main_iteration_do(block);
@@ -57,7 +55,9 @@ void uiMainSteps(void)
int uiMainStep(int wait)
{
gboolean block = FALSE;
gboolean block;
block = FALSE;
if (wait)
block = TRUE;
return (*iteration)(block) == FALSE;
@@ -70,8 +70,7 @@ static gboolean quit(gpointer data)
{
if (iteration == stepsIteration)
stepsQuit = TRUE;
/* TODO run a gtk_main() here just to do the cleanup steps of
* syncing the clipboard and other stuff gtk_main() does before it returns */
// TODO run a gtk_main() here just to do the cleanup steps of syncing the clipboard and other stuff gtk_main() does before it returns
else
gtk_main_quit();
return FALSE;
@@ -98,12 +97,12 @@ static gboolean doqueued(gpointer data)
void uiQueueMain(void (*f)(void *data), void *data)
{
struct queued *q = g_new0(struct queued, 1);
struct queued *q;
/* we have to use g_new0()/g_free() because uiAlloc()
* is only safe to call on the main thread
* for some reason it didn't affect me, but it did affect krakjoe */
q->f = f;
// we have to use g_new0()/g_free() because uiAlloc() is only safe to call on the main thread
// for some reason it didn't affect me, but it did affect krakjoe
q = g_new0(struct queued, 1);
q->f = f;
q->data = data;
gdk_threads_add_idle(doqueued, q);
}
+45 -43
View File
@@ -121,8 +121,10 @@ int uiMenuItemChecked(uiMenuItem *item)
void uiMenuItemSetChecked(uiMenuItem *item, int checked)
{
/* use explicit values */
gboolean c = FALSE;
gboolean c;
// use explicit values
c = FALSE;
if (checked)
c = TRUE;
setChecked(item, c);
@@ -130,55 +132,55 @@ void uiMenuItemSetChecked(uiMenuItem *item, int checked)
static uiMenuItem *newItem(uiMenu *m, int type, const char *name)
{
uiMenuItem *item;
uiMenuItem *item;
if (menusFinalized)
userbug("You cannot create a new menu item after menus have been finalized.");
if (menusFinalized)
userbug("You cannot create a new menu item after menus have been finalized.");
item = uiNew(uiMenuItem);
item = uiNew(uiMenuItem);
g_array_append_val(m->items, item);
g_array_append_val(m->items, item);
item->type = type;
switch (item->type) {
case typeQuit:
item->name = g_strdup("Quit");
break;
case typePreferences:
item->name = g_strdup("Preferences...");
break;
case typeAbout:
item->name = g_strdup("About");
break;
case typeSeparator:
break;
default:
item->name = g_strdup(name);
break;
}
item->type = type;
switch (item->type) {
case typeQuit:
item->name = g_strdup("Quit");
break;
case typePreferences:
item->name = g_strdup("Preferences...");
break;
case typeAbout:
item->name = g_strdup("About");
break;
case typeSeparator:
break;
default:
item->name = g_strdup(name);
break;
}
if (item->type == typeQuit) {
// can't call uiMenuItemOnClicked() here
item->onClicked = onQuitClicked;
item->onClickedData = NULL;
} else
uiMenuItemOnClicked(item, defaultOnClicked, NULL);
if (item->type == typeQuit) {
// can't call uiMenuItemOnClicked() here
item->onClicked = onQuitClicked;
item->onClickedData = NULL;
} else
uiMenuItemOnClicked(item, defaultOnClicked, NULL);
switch (item->type) {
case typeCheckbox:
item->gtype = GTK_TYPE_CHECK_MENU_ITEM;
break;
case typeSeparator:
item->gtype = GTK_TYPE_SEPARATOR_MENU_ITEM;
break;
default:
item->gtype = GTK_TYPE_MENU_ITEM;
break;
}
switch (item->type) {
case typeCheckbox:
item->gtype = GTK_TYPE_CHECK_MENU_ITEM;
break;
case typeSeparator:
item->gtype = GTK_TYPE_SEPARATOR_MENU_ITEM;
break;
default:
item->gtype = GTK_TYPE_MENU_ITEM;
break;
}
item->windows = g_hash_table_new(g_direct_hash, g_direct_equal);
item->windows = g_hash_table_new(g_direct_hash, g_direct_equal);
return item;
return item;
}
uiMenuItem *uiMenuAppendItem(uiMenu *m, const char *name)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+11 -13
View File
@@ -32,10 +32,9 @@ int uiSpinboxValue(uiSpinbox *s)
void uiSpinboxSetValue(uiSpinbox *s, int value)
{
/* we need to inhibit sending of ::value-changed
* because this WILL send a ::value-changed otherwise */
// we need to inhibit sending of ::value-changed because this WILL send a ::value-changed otherwise
g_signal_handler_block(s->spinButton, s->onChangedSignal);
/* this clamps for us */
// this clamps for us
gtk_spin_button_set_value(s->spinButton, (gdouble) value);
g_signal_handler_unblock(s->spinButton, s->onChangedSignal);
}
@@ -48,23 +47,22 @@ void uiSpinboxOnChanged(uiSpinbox *s, void (*f)(uiSpinbox *, void *), void *data
uiSpinbox *uiNewSpinbox(int min, int max)
{
uiSpinbox *s;
int temp;
uiSpinbox *s = NULL;
if (min >= max)
{
temp = min;
min = max;
max = temp;
}
if (min >= max) {
temp = min;
min = max;
max = temp;
}
uiUnixNewControl(uiSpinbox, s);
s->widget = gtk_spin_button_new_with_range(min, max, 1);
s->entry = GTK_ENTRY(s->widget);
s->widget = gtk_spin_button_new_with_range(min, max, 1);
s->entry = GTK_ENTRY(s->widget);
s->spinButton = GTK_SPIN_BUTTON(s->widget);
/* ensure integers, just to be safe */
// ensure integers, just to be safe
gtk_spin_button_set_digits(s->spinButton, 0);
s->onChangedSignal = g_signal_connect(s->spinButton, "value-changed", G_CALLBACK(onChanged), s);
File renamed without changes.
+18 -16
View File
@@ -15,18 +15,16 @@ uiUnixControlAllDefaultsExceptDestroy(uiTab)
static void uiTabDestroy(uiControl *c)
{
uiTab *t = uiTab(c);
guint i;
uiTab *t = uiTab(c);
struct child *page = NULL;
struct child *page;
for (i = 0; i < t->pages->len; i++)
{
for (i = 0; i < t->pages->len; i++) {
page = g_array_index(t->pages, struct child *, i);
childDestroy(page);
}
g_array_free(t->pages, TRUE);
/* and free ourselves */
// and free ourselves
g_object_unref(t->widget);
uiFreeControl(uiControl(t));
}
@@ -38,8 +36,10 @@ void uiTabAppend(uiTab *t, const char *name, uiControl *child)
void uiTabInsertAt(uiTab *t, const char *name, int n, uiControl *child)
{
/* this will create a tab, because of gtk_container_add() */
struct child *page = newChildWithBox(child, uiControl(t), t->container, 0);
struct child *page;
// this will create a tab, because of gtk_container_add()
page = newChildWithBox(child, uiControl(t), t->container, 0);
gtk_notebook_set_tab_label_text(t->notebook, childBox(page), name);
gtk_notebook_reorder_child(t->notebook, childBox(page), n);
@@ -49,10 +49,10 @@ void uiTabInsertAt(uiTab *t, const char *name, int n, uiControl *child)
void uiTabDelete(uiTab *t, int n)
{
struct child *page = g_array_index(t->pages, struct child *, n);
/* this will remove the tab,
* because gtk_widget_destroy() calls gtk_container_remove() */
struct child *page;
page = g_array_index(t->pages, struct child *, n);
// this will remove the tab, because gtk_widget_destroy() calls gtk_container_remove()
childRemove(page);
g_array_remove_index(t->pages, n);
}
@@ -64,28 +64,30 @@ int uiTabNumPages(uiTab *t)
int uiTabMargined(uiTab *t, int n)
{
struct child *page = g_array_index(t->pages, struct child *, n);
struct child *page;
page = g_array_index(t->pages, struct child *, n);
return childFlag(page);
}
void uiTabSetMargined(uiTab *t, int n, int margined)
{
struct child *page = g_array_index(t->pages, struct child *, n);
struct child *page;
page = g_array_index(t->pages, struct child *, n);
childSetFlag(page, margined);
childSetMargined(page, childFlag(page));
}
uiTab *uiNewTab(void)
{
uiTab *t = NULL;;
uiTab *t;
uiUnixNewControl(uiTab, t);
t->widget = gtk_notebook_new();
t->widget = gtk_notebook_new();
t->container = GTK_CONTAINER(t->widget);
t->notebook = GTK_NOTEBOOK(t->widget);
t->notebook = GTK_NOTEBOOK(t->widget);
gtk_notebook_set_scrollable(t->notebook, TRUE);
View File
File renamed without changes.
@@ -1,11 +1,11 @@
/* 22 april 2015 */
// 22 april 2015
#define GLIB_VERSION_MIN_REQUIRED GLIB_VERSION_2_40
#define GLIB_VERSION_MAX_ALLOWED GLIB_VERSION_2_40
#define GDK_VERSION_MIN_REQUIRED GDK_VERSION_3_10
#define GDK_VERSION_MAX_ALLOWED GDK_VERSION_3_10
#include <gtk/gtk.h>
#include <math.h>
#include <dlfcn.h> /* see drawtext.c */
#include <dlfcn.h> // see drawtext.c
#include <langinfo.h>
#include <string.h>
#include <stdlib.h>
@@ -18,19 +18,19 @@
#define gtkXPadding 12
#define gtkYPadding 6
/* menu.c */
// menu.c
extern GtkWidget *makeMenubar(uiWindow *);
extern void freeMenubar(GtkWidget *);
extern void uninitMenus(void);
/* alloc.c */
// alloc.c
extern void initAlloc(void);
extern void uninitAlloc(void);
/* util.c */
// util.c
extern void setMargined(GtkContainer *, int);
/* child.c */
// child.c
extern struct child *newChild(uiControl *child, uiControl *parent, GtkContainer *parentContainer);
extern struct child *newChildWithBox(uiControl *child, uiControl *parent, GtkContainer *parentContainer, int margined);
extern void childRemove(struct child *c);
@@ -41,25 +41,25 @@ extern void childSetFlag(struct child *c, int flag);
extern GtkWidget *childBox(struct child *c);
extern void childSetMargined(struct child *c, int margined);
/* draw.c */
// draw.c
extern uiDrawContext *newContext(cairo_t *);
extern void freeContext(uiDrawContext *);
/* drawtext.c */
// drawtext.c
extern uiDrawTextFont *mkTextFont(PangoFont *f, gboolean add);
extern PangoFont *pangoDescToPangoFont(PangoFontDescription *pdesc);
/* graphemes.c */
// graphemes.c
extern ptrdiff_t *graphemes(const char *text, PangoContext *context);
/* image.c */
// image.c
/*TODO remove this*/typedef struct uiImage uiImage;
extern cairo_surface_t *imageAppropriateSurface(uiImage *i, GtkWidget *w);
/* cellrendererbutton.c */
// cellrendererbutton.c
extern GtkCellRenderer *newCellRendererButton(void);
/* future.c */
// future.c
extern void loadFutures(void);
extern PangoAttribute *FUTURE_pango_attr_foreground_alpha_new(guint16 alpha);
extern gboolean FUTURE_gtk_widget_path_iter_set_object_name(GtkWidgetPath *path, gint pos, const char *name);
View File
File renamed without changes.
+36 -44
View File
@@ -1,43 +1,40 @@
// 11 june 2015
#include "uipriv_unix.h"
struct uiWindow
{
uiUnixControl c;
struct uiWindow {
uiUnixControl c;
GtkWidget *widget;
GtkContainer *container;
GtkWindow *window;
GtkWidget *widget;
GtkContainer *container;
GtkWindow *window;
GtkWidget *vboxWidget;
GtkContainer *vboxContainer;
GtkBox *vbox;
GtkWidget *vboxWidget;
GtkContainer *vboxContainer;
GtkBox *vbox;
GtkWidget *childHolderWidget;
GtkContainer *childHolderContainer;
GtkWidget *childHolderWidget;
GtkContainer *childHolderContainer;
GtkWidget *menubar;
GtkWidget *menubar;
uiControl *child;
int margined;
uiControl *child;
int margined;
int (*onClosing)(uiWindow *, void *);
void *onClosingData;
void (*onContentSizeChanged)(uiWindow *, void *);
void *onContentSizeChangedData;
gboolean fullscreen;
int (*onClosing)(uiWindow *, void *);
void *onClosingData;
void (*onContentSizeChanged)(uiWindow *, void *);
void *onContentSizeChangedData;
gboolean fullscreen;
};
static gboolean onClosing(GtkWidget *win, GdkEvent *e, gpointer data)
{
uiWindow *w = uiWindow(data);
/* manually destroy the window ourselves; don't let
* the delete-event handler do it */
// manually destroy the window ourselves; don't let the delete-event handler do it
if ((*(w->onClosing))(w, w->onClosingData))
uiControlDestroy(uiControl(w));
/* don't continue to the default delete-event handler;
* we destroyed the window by now */
// don't continue to the default delete-event handler; we destroyed the window by now
return TRUE;
}
@@ -45,7 +42,7 @@ static void onSizeAllocate(GtkWidget *widget, GdkRectangle *allocation, gpointer
{
uiWindow *w = uiWindow(data);
/* TODO deal with spurious size-allocates */
// TODO deal with spurious size-allocates
(*(w->onContentSizeChanged))(w, w->onContentSizeChangedData);
}
@@ -56,30 +53,28 @@ static int defaultOnClosing(uiWindow *w, void *data)
static void defaultOnPositionContentSizeChanged(uiWindow *w, void *data)
{
/* do nothing */
// do nothing
}
static void uiWindowDestroy(uiControl *c)
{
uiWindow *w = uiWindow(c);
/* first hide ourselves */
// first hide ourselves
gtk_widget_hide(w->widget);
/* now destroy the child */
if (w->child != NULL)
{
uiControlSetParent(w->child, NULL);
uiUnixControlSetContainer(uiUnixControl(w->child), w->childHolderContainer, TRUE);
uiControlDestroy(w->child);
}
/* now destroy the menus, if any */
// now destroy the child
if (w->child != NULL) {
uiControlSetParent(w->child, NULL);
uiUnixControlSetContainer(uiUnixControl(w->child), w->childHolderContainer, TRUE);
uiControlDestroy(w->child);
}
// now destroy the menus, if any
if (w->menubar != NULL)
freeMenubar(w->menubar);
gtk_widget_destroy(w->childHolderWidget);
gtk_widget_destroy(w->vboxWidget);
/* and finally free ourselves
* use gtk_widget_destroy() instead of g_object_unref()
* because GTK+ has internal references (see #165) */
// and finally free ourselves
// use gtk_widget_destroy() instead of g_object_unref() because GTK+ has internal references (see #165)
gtk_widget_destroy(w->widget);
uiFreeControl(uiControl(w));
}
@@ -107,11 +102,9 @@ static void uiWindowShow(uiControl *c)
{
uiWindow *w = uiWindow(c);
/* don't use gtk_widget_show_all() as that
* will show all children, regardless of user settings
* don't use gtk_widget_show(); that doesn't bring to
* front or give keyboard focus
* (gtk_window_present() does call gtk_widget_show() though) */
// don't use gtk_widget_show_all() as that will show all children, regardless of user settings
// don't use gtk_widget_show(); that doesn't bring to front or give keyboard focus
// (gtk_window_present() does call gtk_widget_show() though)
gtk_window_present(w->window);
}
@@ -119,8 +112,7 @@ uiUnixControlDefaultHide(uiWindow)
uiUnixControlDefaultEnabled(uiWindow)
uiUnixControlDefaultEnable(uiWindow)
uiUnixControlDefaultDisable(uiWindow)
/* TODO? */
// TODO?
uiUnixControlDefaultSetContainer(uiWindow)
char *uiWindowTitle(uiWindow *w)
-198
View File
@@ -1,198 +0,0 @@
/* 22 may 2015 */
#include "uipriv_windows.hpp"
struct uiDateTimePicker {
uiWindowsControl c;
HWND hwnd;
};
#ifndef DTM_GETIDEALSIZE
#define DTM_GETIDEALSIZE 0x100f
#endif
/* utility functions */
#define GLI(what, buf, n) GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT, what, buf, n)
/* The real date/time picker does a manual replacement of "yy" with "yyyy" for DTS_SHORTDATECENTURYFORMAT.
* Because we're also duplicating its functionality (see below), we have to do it too. */
static WCHAR *expandYear(WCHAR *dts, int n)
{
WCHAR *p = NULL;
int ny = 0;
/* allocate more than we need to be safe */
WCHAR *out = (WCHAR *) uiAlloc((n * 3) * sizeof (WCHAR), "WCHAR[]");
WCHAR *q = out;
for (p = dts; *p != L'\0'; p++)
{
/* first, if the current character is a y, increment the number of consecutive ys
* otherwise, stop counting, and if there were only two, add two more to make four */
if (*p != L'y') {
if (ny == 2) {
*q++ = L'y';
*q++ = L'y';
}
ny = 0;
} else
ny++;
/* next, handle quoted blocks
* we do this AFTER the above so yy'abc' becomes yyyy'abc' and not yy'abc'yy
* this handles the case of 'a''b' elegantly as well */
if (*p == L'\'') {
/* copy the opening quote */
*q++ = *p;
/* copy the contents */
for (;;) {
p++;
if (*p == L'\'')
break;
if (*p == L'\0')
implbug("unterminated quote in system-provided locale date string in expandYear()");
*q++ = *p;
}
/* and fall through to copy the closing quote */
}
/* copy the current character */
*q++ = *p;
}
/* handle trailing yy */
if (ny == 2) {
*q++ = L'y';
*q++ = L'y';
}
*q++ = L'\0';
return out;
}
/* Windows has no combined date/time prebuilt constant;
* we have to build the format string ourselves
* TODO use a default format if one fails */
static void setDateTimeFormat(HWND hwnd)
{
WCHAR *unexpandedDate, *date;
WCHAR *time;
WCHAR *datetime;
int ntime;
int ndate = GLI(LOCALE_SSHORTDATE, NULL, 0);
if (ndate == 0)
logLastError(L"error getting date string length");
date = (WCHAR *) uiAlloc(ndate * sizeof (WCHAR), "WCHAR[]");
if (GLI(LOCALE_SSHORTDATE, date, ndate) == 0)
logLastError(L"error geting date string");
unexpandedDate = date; /* so we can free it */
date = expandYear(unexpandedDate, ndate);
uiFree(unexpandedDate);
ntime = GLI(LOCALE_STIMEFORMAT, NULL, 0);
if (ndate == 0)
logLastError(L"error getting time string length");
time = (WCHAR *) uiAlloc(ntime * sizeof (WCHAR), "WCHAR[]");
if (GLI(LOCALE_STIMEFORMAT, time, ntime) == 0)
logLastError(L"error geting time string");
datetime = strf(L"%s %s", date, time);
if (SendMessageW(hwnd, DTM_SETFORMAT, 0, (LPARAM) datetime) == 0)
logLastError(L"error applying format string to date/time picker");
uiFree(datetime);
uiFree(time);
uiFree(date);
}
/* control implementation */
static void uiDateTimePickerDestroy(uiControl *c)
{
uiDateTimePicker *d = uiDateTimePicker(c);
uiWindowsUnregisterReceiveWM_WININICHANGE(d->hwnd);
uiWindowsEnsureDestroyWindow(d->hwnd);
uiFreeControl(uiControl(d));
}
uiWindowsControlAllDefaultsExceptDestroy(uiDateTimePicker)
/* the height returned from DTM_GETIDEALSIZE is unreliable; see http://stackoverflow.com/questions/30626549/what-is-the-proper-use-of-dtm-getidealsize-treating-the-returned-size-as-pixels
* from http://msdn.microsoft.com/en-us/library/windows/desktop/dn742486.aspx#sizingandspacing */
#define entryHeight 14
static void uiDateTimePickerMinimumSize(uiWindowsControl *c, int *width, int *height)
{
SIZE s;
uiWindowsSizing sizing;
uiDateTimePicker *d = uiDateTimePicker(c);
int y;
s.cx = 0;
s.cy = 0;
SendMessageW(d->hwnd, DTM_GETIDEALSIZE, 0, (LPARAM) (&s));
*width = s.cx;
y = entryHeight;
uiWindowsGetSizing(d->hwnd, &sizing);
uiWindowsSizingDlgUnitsToPixels(&sizing, NULL, &y);
*height = y;
}
static uiDateTimePicker *finishNewDateTimePicker(DWORD style)
{
uiDateTimePicker *d;
uiWindowsNewControl(uiDateTimePicker, d);
d->hwnd = uiWindowsEnsureCreateControlHWND(WS_EX_CLIENTEDGE,
DATETIMEPICK_CLASSW, L"",
style | WS_TABSTOP,
hInstance, NULL,
TRUE);
/* automatically update date/time format when user changes locale settings
* for the standard styles, this is in the date-time picker itself
* for our date/time mode, we do it in a subclass assigned in uiNewDateTimePicker() */
uiWindowsRegisterReceiveWM_WININICHANGE(d->hwnd);
return d;
}
static LRESULT CALLBACK datetimepickerSubProc(HWND hwnd, UINT uMsg, WPARAM wParam,
LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
{
switch (uMsg)
{
case WM_WININICHANGE:
// we can optimize this by only doing it when the real date/time picker does it
// unfortunately, I don't know when that is :/
// hopefully this won't hurt
setDateTimeFormat(hwnd);
return 0;
case WM_NCDESTROY:
if (RemoveWindowSubclass(hwnd, datetimepickerSubProc, uIdSubclass) == FALSE)
logLastError(L"error removing date-time picker locale change handling subclass");
break;
}
return DefSubclassProc(hwnd, uMsg, wParam, lParam);
}
uiDateTimePicker *uiNewDateTimePicker(void)
{
uiDateTimePicker *d = finishNewDateTimePicker(0);
setDateTimeFormat(d->hwnd);
if (SetWindowSubclass(d->hwnd, datetimepickerSubProc, 0, (DWORD_PTR) d) == FALSE)
logLastError(L"error subclassing date-time-picker to assist in locale change handling");
/* TODO set a suitable default in this case */
return d;
}
uiDateTimePicker *uiNewDatePicker(void)
{
return finishNewDateTimePicker(DTS_SHORTDATECENTURYFORMAT);
}
uiDateTimePicker *uiNewTimePicker(void)
{
return finishNewDateTimePicker(DTS_TIMEFORMAT);
}
-105
View File
@@ -1,105 +0,0 @@
/* 9 april 2015 */
#include "uipriv_windows.hpp"
WCHAR *windowTextAndLen(HWND hwnd, LRESULT *len)
{
WCHAR *text = NULL;
LRESULT n = SendMessageW(hwnd, WM_GETTEXTLENGTH, 0, 0);
if (len != NULL)
*len = n;
/* WM_GETTEXTLENGTH does not include the null terminator */
text = (WCHAR *) uiAlloc((n + 1) * sizeof (WCHAR), "WCHAR[]");
/* note the comparison: the size includes the
* null terminator, but the return does not */
if (GetWindowTextW(hwnd, text, n + 1) != n)
{
logLastError(L"error getting window text");
/* on error, return an empty string to be safe */
*text = L'\0';
if (len != NULL)
*len = 0;
}
return text;
}
WCHAR *windowText(HWND hwnd)
{
return windowTextAndLen(hwnd, NULL);
}
void setWindowText(HWND hwnd, WCHAR *wtext)
{
if (SetWindowTextW(hwnd, wtext) == 0)
logLastError(L"error setting window text");
}
void uiFreeText(char *text)
{
uiFree(text);
}
int uiWindowsWindowTextWidth(HWND hwnd)
{
LRESULT len;
HDC dc;
HFONT prevfont;
SIZE size;
WCHAR *text = windowTextAndLen(hwnd, &len);
size.cx = 0;
size.cy = 0;
if (len == 0) /* no text; nothing to do */
goto noTextOrError;
/* now we can do the calculations */
dc = GetDC(hwnd);
if (dc == NULL)
{
logLastError(L"error getting DC");
/* on any error, assume no text */
goto noTextOrError;
}
prevfont = (HFONT) SelectObject(dc, hMessageFont);
if (prevfont == NULL)
{
logLastError(L"error loading control font into device context");
ReleaseDC(hwnd, dc);
goto noTextOrError;
}
if (GetTextExtentPoint32W(dc, text, len, &size) == 0)
{
logLastError(L"error getting text extent point");
/* continue anyway, assuming size is 0 */
size.cx = 0;
size.cy = 0;
}
/* continue on errors; we got what we want */
if (SelectObject(dc, prevfont) != hMessageFont)
logLastError(L"error restoring previous font into device context");
if (ReleaseDC(hwnd, dc) == 0)
logLastError(L"error releasing DC");
uiFree(text);
return size.cx;
noTextOrError:
uiFree(text);
return 0;
}
char *uiWindowsWindowText(HWND hwnd)
{
WCHAR *wtext = windowText(hwnd);
char *text = toUTF8(wtext);
uiFree(wtext);
return text;
}
void uiWindowsSetWindowText(HWND hwnd, const char *text)
{
WCHAR *wtext = toUTF16(text);
setWindowText(hwnd, wtext);
uiFree(wtext);
}
-87
View File
@@ -1,87 +0,0 @@
/* 14 may 2015 */
#include "uipriv_windows.hpp"
#include "../../verbosity.h"
/* The utility window is a special window that performs certain tasks internal to libui.
* It is not a message-only window, and it is always hidden and disabled.
* Its roles:
* - It is the initial parent of all controls. When a control loses its parent, it also becomes that control's parent.
* - It handles WM_QUERYENDSESSION and console end session requests.
* - It handles WM_WININICHANGE and forwards the message to any child windows that request it.
* - It handles executing functions queued to run by uiQueueMain().
*/
#define utilWindowClass L"libui_utilWindowClass"
HWND utilWindow;
static LRESULT CALLBACK utilWindowWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
void (*qf)(void *);
LRESULT lResult;
if (handleParentMessages(hwnd, uMsg, wParam, lParam, &lResult) != FALSE)
return lResult;
switch (uMsg)
{
case WM_QUERYENDSESSION:
/* TODO block handler */
if (shouldQuit())
{
uiQuit();
return TRUE;
}
return FALSE;
case WM_WININICHANGE:
issueWM_WININICHANGE(wParam, lParam);
return 0;
case msgQueued:
qf = (void (*)(void *)) wParam;
(*qf)((void *) lParam);
return 0;
}
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
}
const char *initUtilWindow(HICON hDefaultIcon, HCURSOR hDefaultCursor)
{
WNDCLASSW wc;
ZeroMemory(&wc, sizeof (WNDCLASSW));
wc.lpszClassName = utilWindowClass;
wc.lpfnWndProc = utilWindowWndProc;
wc.hInstance = hInstance;
wc.hIcon = hDefaultIcon;
wc.hCursor = hDefaultCursor;
wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);
if (RegisterClass(&wc) == 0)
{
RARCH_ERR("Cannot register class.\n");
/* see init.cpp for an explanation of the =s */
return "=registering utility window class";
}
utilWindow = CreateWindowExW(0,
utilWindowClass, L"libui utility window",
WS_OVERLAPPEDWINDOW,
0, 0, 100, 100,
NULL, NULL, hInstance, NULL);
if (utilWindow == NULL)
{
RARCH_ERR("Cannot create window.\n");
return "=creating utility window";
}
/* and just to be safe */
EnableWindow(utilWindow, FALSE);
return NULL;
}
void uninitUtilWindow(void)
{
if (DestroyWindow(utilWindow) == 0)
logLastError(L"error destroying utility window");
if (UnregisterClass(utilWindowClass, hInstance) == 0)
logLastError(L"error unregistering utility window class");
}
-150
View File
@@ -1,150 +0,0 @@
/* This file contains some Vista SDK stuff that is missing from the current
mingw-w64 headers */
#ifndef WINEXTRA_H
#define WINEXTRA_H
/* winuser.h */
#if (_WIN32_WINNT >= 0x0600)
WINUSERAPI WINBOOL WINAPI SetProcessDPIAware(VOID);
WINUSERAPI WINBOOL WINAPI IsProcessDPIAware(VOID);
#endif
/* commctrl.h */
#ifndef NOTASKDIALOG
#if (NTDDI_VERSION >= NTDDI_VISTA)
#include <pshpack1.h>
#define TD_WARNING_ICON MAKEINTRESOURCEW(-1)
#define TD_ERROR_ICON MAKEINTRESOURCEW(-2)
#define TD_INFORMATION_ICON MAKEINTRESOURCEW(-3)
#define TD_SHIELD_ICON MAKEINTRESOURCEW(-4)
typedef HRESULT (CALLBACK *PFTASKDIALOGCALLBACK)(HWND hwnd,UINT uNotification,WPARAM wParam,LPARAM lParam,LONG_PTR dwRefData);
enum _TASKDIALOG_FLAGS {
TDF_ENABLE_HYPERLINKS = 0x0001,
TDF_USE_HICON_MAIN = 0x0002,
TDF_USE_HICON_FOOTER = 0x0004,
TDF_ALLOW_DIALOG_CANCELLATION = 0x0008,
TDF_USE_COMMAND_LINKS = 0x0010,
TDF_USE_COMMAND_LINKS_NO_ICON = 0x0020,
TDF_EXPAND_FOOTER_AREA = 0x0040,
TDF_EXPANDED_BY_DEFAULT = 0x0080,
TDF_VERIFICATION_FLAG_CHECKED = 0x0100,
TDF_SHOW_PROGRESS_BAR = 0x0200,
TDF_SHOW_MARQUEE_PROGRESS_BAR = 0x0400,
TDF_CALLBACK_TIMER = 0x0800,
TDF_POSITION_RELATIVE_TO_WINDOW = 0x1000,
TDF_RTL_LAYOUT = 0x2000,
TDF_NO_DEFAULT_RADIO_BUTTON = 0x4000,
TDF_CAN_BE_MINIMIZED = 0x8000,
TDIF_SIZE_TO_CONTENT = 0x1000000,
TDF_SIZE_TO_CONTENT = 0x1000000
};
typedef int TASKDIALOG_FLAGS;
enum _TASKDIALOG_COMMON_BUTTON_FLAGS {
TDCBF_OK_BUTTON = 0x01,
TDCBF_YES_BUTTON = 0x02,
TDCBF_NO_BUTTON = 0x04,
TDCBF_CANCEL_BUTTON = 0x08,
TDCBF_RETRY_BUTTON = 0x10,
TDCBF_CLOSE_BUTTON = 0x20
};
typedef int TASKDIALOG_COMMON_BUTTON_FLAGS;
typedef enum _TASKDIALOG_NOTIFICATIONS {
TDN_CREATED = 0,
TDN_NAVIGATED = 1,
TDN_BUTTON_CLICKED = 2,
TDN_HYPERLINK_CLICKED = 3,
TDN_TIMER = 4,
TDN_DESTROYED = 5,
TDN_RADIO_BUTTON_CLICKED = 6,
TDN_DIALOG_CONSTRUCTED = 7,
TDN_VERIFICATION_CLICKED = 8,
TDN_HELP = 9,
TDN_EXPANDO_BUTTON_CLICKED = 10
} TASKDIALOG_NOTIFICATIONS;
typedef enum _TASKDIALOG_MESSAGES {
TDM_NAVIGATE_PAGE = WM_USER + 101,
TDM_CLICK_BUTTON = WM_USER + 102,
TDM_SET_MARQUEE_PROGRESS_BAR = WM_USER + 103,
TDM_SET_PROGRESS_BAR_STATE = WM_USER + 104,
TDM_SET_PROGRESS_BAR_RANGE = WM_USER + 105,
TDM_SET_PROGRESS_BAR_POS = WM_USER + 106,
TDM_SET_PROGRESS_BAR_MARQUEE = WM_USER + 107,
TDM_SET_ELEMENT_TEXT = WM_USER + 108,
TDM_CLICK_RADIO_BUTTON = WM_USER + 110,
TDM_ENABLE_BUTTON = WM_USER + 111,
TDM_ENABLE_RADIO_BUTTON = WM_USER + 112,
TDM_CLICK_VERIFICATION = WM_USER + 113,
TDM_UPDATE_ELEMENT_TEXT = WM_USER + 114,
TDM_SET_BUTTON_ELEVATION_REQUIRED_STATE = WM_USER + 115,
TDM_UPDATE_ICON = WM_USER + 116
} TASKDIALOG_MESSAGES;
typedef enum _TASKDIALOG_ELEMENTS {
TDE_CONTENT,
TDE_EXPANDED_INFORMATION,
TDE_FOOTER,
TDE_MAIN_INSTRUCTION
} TASKDIALOG_ELEMENTS;
typedef enum _TASKDIALOG_ICON_ELEMENTS {
TDIE_ICON_MAIN,
TDIE_ICON_FOOTER
} TASKDIALOG_ICON_ELEMENTS;
typedef struct _TASKDIALOG_BUTTON {
int nButtonID;
PCWSTR pszButtonText;
} TASKDIALOG_BUTTON;
typedef struct _TASKDIALOGCONFIG {
UINT cbSize;
HWND hwndParent;
HINSTANCE hInstance;
TASKDIALOG_FLAGS dwFlags;
TASKDIALOG_COMMON_BUTTON_FLAGS dwCommonButtons;
PCWSTR pszWindowTitle;
__C89_NAMELESS union {
HICON hMainIcon;
PCWSTR pszMainIcon;
} DUMMYUNIONNAME;
PCWSTR pszMainInstruction;
PCWSTR pszContent;
UINT cButtons;
const TASKDIALOG_BUTTON *pButtons;
int nDefaultButton;
UINT cRadioButtons;
const TASKDIALOG_BUTTON *pRadioButtons;
int nDefaultRadioButton;
PCWSTR pszVerificationText;
PCWSTR pszExpandedInformation;
PCWSTR pszExpandedControlText;
PCWSTR pszCollapsedControlText;
__C89_NAMELESS union {
HICON hFooterIcon;
PCWSTR pszFooterIcon;
} DUMMYUNIONNAME2;
PCWSTR pszFooter;
PFTASKDIALOGCALLBACK pfCallback;
LONG_PTR lpCallbackData;
UINT cxWidth;
} TASKDIALOGCONFIG;
WINCOMMCTRLAPI HRESULT WINAPI TaskDialog(HWND hwndParent,HINSTANCE hInstance,PCWSTR pszWindowTitle,PCWSTR pszMainInstruction,PCWSTR pszContent,TASKDIALOG_COMMON_BUTTON_FLAGS dwCommonButtons,PCWSTR pszIcon,int *pnButton);
WINCOMMCTRLAPI HRESULT WINAPI TaskDialogIndirect(const TASKDIALOGCONFIG *pTaskConfig,int *pnButton,int *pnRadioButton,BOOL *pfVerificationFlagChecked);
#include <poppack.h>
#endif
#endif
/* dwmapi.h */
HRESULT WINAPI DwmFlush(VOID);
#endif
+91
View File
@@ -0,0 +1,91 @@
# 3 june 2016
list(APPEND _LIBUI_SOURCES
windows/alloc.cpp
windows/area.cpp
windows/areadraw.cpp
windows/areaevents.cpp
windows/areascroll.cpp
windows/areautil.cpp
windows/box.cpp
windows/button.cpp
windows/checkbox.cpp
windows/colorbutton.cpp
windows/colordialog.cpp
windows/combobox.cpp
windows/container.cpp
windows/control.cpp
windows/d2dscratch.cpp
windows/datetimepicker.cpp
windows/debug.cpp
windows/draw.cpp
windows/drawmatrix.cpp
windows/drawpath.cpp
windows/drawtext.cpp
windows/dwrite.cpp
windows/editablecombo.cpp
windows/entry.cpp
windows/events.cpp
windows/fontbutton.cpp
windows/fontdialog.cpp
windows/form.cpp
windows/graphemes.cpp
windows/grid.cpp
windows/group.cpp
windows/init.cpp
windows/label.cpp
windows/main.cpp
windows/menu.cpp
windows/multilineentry.cpp
windows/parent.cpp
windows/progressbar.cpp
windows/radiobuttons.cpp
windows/separator.cpp
windows/sizing.cpp
windows/slider.cpp
windows/spinbox.cpp
windows/stddialogs.cpp
windows/tab.cpp
windows/tabpage.cpp
windows/text.cpp
windows/utf16.cpp
windows/utilwin.cpp
windows/window.cpp
windows/winpublic.cpp
windows/winutil.cpp
windows/resources.rc
)
set(_LIBUI_SOURCES ${_LIBUI_SOURCES} PARENT_SCOPE)
list(APPEND _LIBUI_INCLUDEDIRS
windows
)
set(_LIBUI_INCLUDEDIRS _LIBUI_INCLUDEDIRS PARENT_SCOPE)
# Windows won't link resources in static libraries; we need to provide the libui.res file in this case.
set(_LIBUINAME libui PARENT_SCOPE)
if(NOT BUILD_SHARED_LIBS)
set(_LIBUI_STATIC_RES ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/libui.res PARENT_SCOPE)
endif()
macro(_handle_static)
# TODO this full path feels hacky
add_custom_command(
TARGET libui POST_BUILD
COMMAND
${CMAKE_COMMAND} -E copy $<TARGET_PROPERTY:libui,BINARY_DIR>/CMakeFiles/libui.dir/windows/resources.rc.* ${_LIBUI_STATIC_RES}
COMMENT "Copying libui.res")
endmacro()
# notice that usp10 comes before gdi32
# TODO prune this list
set(_LIBUI_LIBS
user32 kernel32 usp10 gdi32 comctl32 uxtheme msimg32 comdlg32 d2d1 dwrite ole32 oleaut32 oleacc uuid
PARENT_SCOPE)
if(NOT MSVC)
if(BUILD_SHARED_LIBS)
message(FATAL_ERROR
"Sorry, but libui for Windows can currently only be built as a static library with MinGW. You will need to either build as a static library or switch to MSVC."
)
endif()
endif()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -100,10 +100,11 @@ static void scroll(uiArea *a, int which, struct scrollParams *p, WPARAM wParam,
static void wheelscroll(uiArea *a, int which, struct scrollParams *p, WPARAM wParam, LPARAM lParam)
{
int delta;
int lines;
UINT scrollAmount;
int delta = GET_WHEEL_DELTA_WPARAM(wParam);
delta = GET_WHEEL_DELTA_WPARAM(wParam);
if (SystemParametersInfoW(p->wheelSPIAction, 0, &scrollAmount, 0) == 0)
// TODO use scrollAmount == 3 (for both v and h) instead?
logLastError(L"error getting area wheel scroll amount");
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+191
View File
@@ -0,0 +1,191 @@
// 22 may 2015
#include "uipriv_windows.hpp"
struct uiDateTimePicker {
uiWindowsControl c;
HWND hwnd;
};
// utility functions
#define GLI(what, buf, n) GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT, what, buf, n)
// The real date/time picker does a manual replacement of "yy" with "yyyy" for DTS_SHORTDATECENTURYFORMAT.
// Because we're also duplicating its functionality (see below), we have to do it too.
static WCHAR *expandYear(WCHAR *dts, int n)
{
WCHAR *out;
WCHAR *p, *q;
int ny = 0;
// allocate more than we need to be safe
out = (WCHAR *) uiAlloc((n * 3) * sizeof (WCHAR), "WCHAR[]");
q = out;
for (p = dts; *p != L'\0'; p++) {
// first, if the current character is a y, increment the number of consecutive ys
// otherwise, stop counting, and if there were only two, add two more to make four
if (*p != L'y') {
if (ny == 2) {
*q++ = L'y';
*q++ = L'y';
}
ny = 0;
} else
ny++;
// next, handle quoted blocks
// we do this AFTER the above so yy'abc' becomes yyyy'abc' and not yy'abc'yy
// this handles the case of 'a''b' elegantly as well
if (*p == L'\'') {
// copy the opening quote
*q++ = *p;
// copy the contents
for (;;) {
p++;
if (*p == L'\'')
break;
if (*p == L'\0')
implbug("unterminated quote in system-provided locale date string in expandYear()");
*q++ = *p;
}
// and fall through to copy the closing quote
}
// copy the current character
*q++ = *p;
}
// handle trailing yy
if (ny == 2) {
*q++ = L'y';
*q++ = L'y';
}
*q++ = L'\0';
return out;
}
// Windows has no combined date/time prebuilt constant; we have to build the format string ourselves
// TODO use a default format if one fails
static void setDateTimeFormat(HWND hwnd)
{
WCHAR *unexpandedDate, *date;
WCHAR *time;
WCHAR *datetime;
int ndate, ntime;
ndate = GLI(LOCALE_SSHORTDATE, NULL, 0);
if (ndate == 0)
logLastError(L"error getting date string length");
date = (WCHAR *) uiAlloc(ndate * sizeof (WCHAR), "WCHAR[]");
if (GLI(LOCALE_SSHORTDATE, date, ndate) == 0)
logLastError(L"error geting date string");
unexpandedDate = date; // so we can free it
date = expandYear(unexpandedDate, ndate);
uiFree(unexpandedDate);
ntime = GLI(LOCALE_STIMEFORMAT, NULL, 0);
if (ndate == 0)
logLastError(L"error getting time string length");
time = (WCHAR *) uiAlloc(ntime * sizeof (WCHAR), "WCHAR[]");
if (GLI(LOCALE_STIMEFORMAT, time, ntime) == 0)
logLastError(L"error geting time string");
datetime = strf(L"%s %s", date, time);
if (SendMessageW(hwnd, DTM_SETFORMAT, 0, (LPARAM) datetime) == 0)
logLastError(L"error applying format string to date/time picker");
uiFree(datetime);
uiFree(time);
uiFree(date);
}
// control implementation
static void uiDateTimePickerDestroy(uiControl *c)
{
uiDateTimePicker *d = uiDateTimePicker(c);
uiWindowsUnregisterReceiveWM_WININICHANGE(d->hwnd);
uiWindowsEnsureDestroyWindow(d->hwnd);
uiFreeControl(uiControl(d));
}
uiWindowsControlAllDefaultsExceptDestroy(uiDateTimePicker)
// the height returned from DTM_GETIDEALSIZE is unreliable; see http://stackoverflow.com/questions/30626549/what-is-the-proper-use-of-dtm-getidealsize-treating-the-returned-size-as-pixels
// from http://msdn.microsoft.com/en-us/library/windows/desktop/dn742486.aspx#sizingandspacing
#define entryHeight 14
static void uiDateTimePickerMinimumSize(uiWindowsControl *c, int *width, int *height)
{
uiDateTimePicker *d = uiDateTimePicker(c);
SIZE s;
uiWindowsSizing sizing;
int y;
s.cx = 0;
s.cy = 0;
SendMessageW(d->hwnd, DTM_GETIDEALSIZE, 0, (LPARAM) (&s));
*width = s.cx;
y = entryHeight;
uiWindowsGetSizing(d->hwnd, &sizing);
uiWindowsSizingDlgUnitsToPixels(&sizing, NULL, &y);
*height = y;
}
static uiDateTimePicker *finishNewDateTimePicker(DWORD style)
{
uiDateTimePicker *d;
uiWindowsNewControl(uiDateTimePicker, d);
d->hwnd = uiWindowsEnsureCreateControlHWND(WS_EX_CLIENTEDGE,
DATETIMEPICK_CLASSW, L"",
style | WS_TABSTOP,
hInstance, NULL,
TRUE);
// automatically update date/time format when user changes locale settings
// for the standard styles, this is in the date-time picker itself
// for our date/time mode, we do it in a subclass assigned in uiNewDateTimePicker()
uiWindowsRegisterReceiveWM_WININICHANGE(d->hwnd);
return d;
}
static LRESULT CALLBACK datetimepickerSubProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
{
switch (uMsg) {
case WM_WININICHANGE:
// we can optimize this by only doing it when the real date/time picker does it
// unfortunately, I don't know when that is :/
// hopefully this won't hurt
setDateTimeFormat(hwnd);
return 0;
case WM_NCDESTROY:
if (RemoveWindowSubclass(hwnd, datetimepickerSubProc, uIdSubclass) == FALSE)
logLastError(L"error removing date-time picker locale change handling subclass");
break;
}
return DefSubclassProc(hwnd, uMsg, wParam, lParam);
}
uiDateTimePicker *uiNewDateTimePicker(void)
{
uiDateTimePicker *d;
d = finishNewDateTimePicker(0);
setDateTimeFormat(d->hwnd);
if (SetWindowSubclass(d->hwnd, datetimepickerSubProc, 0, (DWORD_PTR) d) == FALSE)
logLastError(L"error subclassing date-time-picker to assist in locale change handling");
// TODO set a suitable default in this case
return d;
}
uiDateTimePicker *uiNewDatePicker(void)
{
return finishNewDateTimePicker(DTS_SHORTDATECENTURYFORMAT);
}
uiDateTimePicker *uiNewTimePicker(void)
{
return finishNewDateTimePicker(DTS_TIMEFORMAT);
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loaded 100 of 277 files, more files were not shown because too many files have changed in this diff. Show more