From 267d9c1b1258a267c52653f2cf13ee5005cafad3 Mon Sep 17 00:00:00 2001 From: Vincent Wei Date: Thu, 26 Oct 2017 13:34:57 +0800 Subject: [PATCH] merge from rel-3-0 branch --- AUTHORS | 2 + CMakeLists.txt | 46 +- COPYING | 674 +++++++++++++++++++++++ ChangeLog | 249 ++++++++- GNUmakefile | 4 +- LICENSE.POLICY | 22 +- LICENSE.POLICY.zh | 2 +- Makefile.am | 4 +- NEWS | 2 + README | 273 ++++++++++ Version | 6 +- cmake/minigui-private.cmake | 52 +- cmake_mgconfig.h.in | 6 + configs/config.in | 2 +- configure.in | 17 +- etc/MiniGUI.cfg.win32.in | 474 +++++++++++++++++ include/common.h | 6 +- include/control.h | 6 +- include/customial.h | 34 +- include/endianrw.h | 6 +- include/fixedmath.h | 6 +- include/gdi.h | 61 ++- include/minigui.h | 6 +- include/nucleus_pthread.h | 6 +- include/nucleus_semaphore.h | 6 +- include/ose_semaphore.h | 8 +- include/own_stdio.h | 6 +- include/psos.h | 10 +- include/psos_pthread.h | 6 +- include/psos_semaphore.h | 6 +- include/threadx_pthread.h | 6 +- include/threadx_semaphore.h | 6 +- include/ucos2_pthread.h | 6 +- include/ucos2_semaphore.h | 6 +- include/vcongui.h | 6 +- include/vxworks_pthread.h | 6 +- include/vxworks_semaphore.h | 6 +- include/window.h | 63 ++- include/xvfb.h | 8 +- make_tarball | 6 +- src/CMakeLists.txt | 74 ++- src/control/edit.c | 29 + src/control/static.c | 4 +- src/font/bitmapfont.c | 6 + src/font/devfont.c | 20 +- src/font/freetype2.c | 6 +- src/font/logfont.c | 13 +- src/gui/caret.c | 1 + src/gui/dialog.c | 35 +- src/gui/lf_manager.c | 4 + src/gui/lf_skin.c | 76 +-- src/gui/menu.c | 6 +- src/gui/window.c | 62 ++- src/ial/CMakeLists.txt | 2 +- src/ial/Makefile.am | 2 +- src/ial/auto.c | 25 +- src/ial/dummy.c | 6 +- src/ial/mgsock.c | 1 - src/ial/mgsock.h | 52 -- src/ial/pcxvfbial.c | 212 +++++++- src/include/Makefile.am | 2 +- src/include/dc.h | 4 +- src/include/devfont.h | 1 - src/include/fontname.h | 2 +- src/include/ial.h | 29 +- src/include/internals.h | 10 + src/include/memops.h | 3 +- src/include/mgsock.h | 141 ++--- src/include/msgstr.h | 44 +- src/kernel/cursor-procs.c | 22 +- src/kernel/cursor-sa.c | 22 +- src/kernel/cursor.c | 24 +- src/kernel/desktop-comm.c | 19 +- src/kernel/desktop-procs.c | 36 +- src/kernel/event.c | 82 ++- src/kernel/init-lite.c | 14 +- src/kernel/init.c | 9 +- src/kernel/timer.c | 26 + src/libc/vxworks_pprivate.h | 2 +- src/libc/vxworks_pthread.c | 76 ++- src/misc/license.c | 70 ++- src/misc/listenfd.c | 17 +- src/mybmp/png.c | 10 +- src/mybmp/winbmp.c | 11 +- src/newgal/CMakeLists.txt | 29 +- src/newgal/mlshadow/mlshadow-ths.c | 2 +- src/newgal/pcxvfb/pcxvfb-winfb.c | 13 +- src/newgal/pcxvfb/pcxvfb.c | 77 ++- src/newgal/pixels.c | 9 +- src/newgal/s3c6410/gal-s3c6410.c | 204 ++++++- src/newgal/s3c6410/gal-s3c6410.h | 22 +- src/newgal/shadow/shadow.c | 81 ++- src/newgal/stgfb/stgfb_video.c | 47 +- src/newgal/surface.c | 48 +- src/newgal/videomem-bucket.c | 61 ++- src/newgdi/bitmap.c | 93 ++-- src/newgdi/clip.c | 8 + src/newgdi/drawtext.c | 14 +- src/newgdi/gdi.c | 54 +- src/newgdi/glyph.c | 6 + src/newgdi/miarc.c | 15 + src/newgdi/mifillarc.h | 3 +- src/newgdi/pixel_ops.c | 6 - src/newgdi/readbmp.c | 15 +- src/newgdi/rect.c | 16 +- src/newgdi/rotatebmp.c | 9 +- src/standalone/standalone.c | 4 +- src/sysres/CMakeLists.txt | 7 +- src/sysres/font/_font_inner_res.c | 2 +- src/sysres/mgetc_win32.c | 828 +++++++++++++++++++++++++++++ src/sysres/mkinnerres.sh | 49 ++ src/sysres/resmgr.c | 4 +- src/textedit/mbtree.c | 2 +- src/textedit/mtextedit.c | 33 +- src/textedit/object.c | 2 +- src/textedit/object.h | 4 +- 116 files changed, 4333 insertions(+), 873 deletions(-) create mode 100644 AUTHORS create mode 100644 COPYING create mode 100644 NEWS create mode 100644 README create mode 100644 etc/MiniGUI.cfg.win32.in delete mode 100644 src/ial/mgsock.h create mode 100644 src/sysres/mgetc_win32.c create mode 100755 src/sysres/mkinnerres.sh diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 00000000..325eb14e --- /dev/null +++ b/AUTHORS @@ -0,0 +1,2 @@ +Beijing FMSoft Technologies Co., Ltd.. (http://www.fmsoft.cn) + diff --git a/CMakeLists.txt b/CMakeLists.txt index f2533500..de287a9f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,8 +11,8 @@ add_definitions (-D_GNU_SOURCE) # the version number. set (MINIGUI_MAJOR_VERSION 3) -set (MINIGUI_MINOR_VERSION 2) -set (MINIGUI_MICRO_VERSION 2) +set (MINIGUI_MINOR_VERSION 0) +set (MINIGUI_MICRO_VERSION 12) set (MINIGUI_NAME "minigui") set (MGLIB_SUFFIX "") @@ -30,10 +30,13 @@ include (minigui-private) __find_threadslib (MINIGUI_LIBRARIES_LIST MINIGUI_INCLUDE_LIST) __find_mlib (have_libm MINIGUI_LIBRARIES_LIST MINIGUI_INCLUDE_LIST) ############## check static lib ################ -set (output_lib_type "Dynamic") +mg_declare_option_and_set_value (_SHAREDLIB_OUTPUT output_sharedlib BOOL ON "whether output the shared lib") +if (_SHAREDLIB_OUTPUT) + set (output_lib_type " Dynamic") +endif (_SHAREDLIB_OUTPUT) mg_declare_option_and_set_value (_STATICLIB_OUTPUT output_staticlib BOOL OFF "whether output the static lib") if (_STATICLIB_OUTPUT) - set (output_lib_type "${output_lib_type} + Static") + set (output_lib_type "${output_lib_type} Static") endif(_STATICLIB_OUTPUT) ############## BASE ################ @@ -96,6 +99,16 @@ mg_declare_option_and_set_value (_MGGAL_CUSTOMGAL gal_custom BOOL OFF "inc mg_declare_option_and_set_value (_MGGAL_SIGMA8654 gal_sigma8654 BOOL OFF "include sigma8654 NEWGAL engine") mg_declare_option_and_set_value (_MGGAL_MSTAR gal_mstar BOOL OFF "include mstar NEWGAL engine") mg_declare_option_and_set_value (_MGGAL_HI3560A gal_hi3560a BOOL OFF "include hi3560a NEWGAL engine") +mg_declare_option_and_set_value (_MGGAL_GDL gal_gdl BOOL OFF "include gdl NEWGAL engine") +mg_declare_option_and_set_value (_MGGAL_ST7167 gal_ST7167 BOOL OFF "include NEWGAL engine for st7167") +mg_declare_option_and_set_value (_MGGAL_STGFB gal_STGFB BOOL OFF "include stgfb NEWGAL engine ST7105 ST7109") + +if (_MGGAL_STGFB) + add_definitions (-D_ST_OSLINUX) + add_definitions (-D_ST_7105) + add_definitions (-DARCHITECTURE_ST40) + add_definitions (-DDEFINED_BOOL) +endif (_MGGAL_STGFB) # if rtosxvfb enable, pcxvfb must disable mg_declare_option (gal_rtosxvfb BOOL OFF "include RTOS Virtual FrameBuffer NEWGAL engine. Note: you must disable pcxvfb, if you want to enable rtosxvfb") @@ -160,8 +173,10 @@ mg_declare_option (font_unicodesupport BOOL ON "include UNICODE (ISO- mg_declare_option (with_fontttfsupport STRING "none" "with_fontttfsupport=ft1/ft2/none") mg_declare_option (with_ft2includes PATH "" "where the FreeType2 includes are") mg_declare_option (font_ttfenablecache BOOL OFF "include ttf cache support") -mg_declare_option (font_ttfcachesize STRING "64" "font_ttfcachesize=64/128/256/512/1024") +mg_declare_option (font_ttfcachesize STRING "256" "font_ttfcachesize=64/128/256/512/1024") mg_declare_option (font_ttfcachenum STRING "10" "font_ttfcachenum=10/20/40") +mg_declare_option (font_ttfgrayadjust BOOL OFF "adjust ttf font bitmap gray_value(range(0~255))") +mg_declare_option (font_ttfgrayadjust_value STRING "50" "font_ttfcachesize range(0~255)") __find_freetype (with_fontttfsupport with_ft1includes with_ft2includes MINIGUI_LIBRARIES_LIST MINIGUI_INCLUDE_LIST) @@ -169,6 +184,12 @@ __find_freetype (with_fontttfsupport with_ft1includes with_ft2includes MINIGUI_L mg_set_value (_MGFONT_TTF ON IF with_fontttfsupport STREQUAL "ft1") mg_set_value (_MGFONT_FT2 ON IF with_fontttfsupport STREQUAL "ft2") +if (font_ttfgrayadjust) + mg_set_value (_MGFONT_TTF_GRAYADJUST ON) + set (_MGFONT_TTF_GRAYADJUST_VALUE ${font_ttfgrayadjust_value}) + message (FATAL ${font_ttfgrayadjust_value}) +endif (font_ttfgrayadjust) + if (with_fontttfsupport STREQUAL "none") else () # enable font_unicodesupport @@ -318,7 +339,7 @@ elseif (with_osname STREQUAL "vxworks") elseif (with_osname STREQUAL "win32") mg_set_value (WIN32 ON) mg_set_value (__NOUNIX__ ON) - add_definitions(-D__NOUNIX__) + add_definitions (-D__NOUNIX__) elseif (with_osname STREQUAL "darwin") mg_set_value (__DARWIN__ ON) elseif (with_osname STREQUAL "threadx") @@ -553,7 +574,18 @@ else () endif (MGLIB_MVFB) # etc -install (FILES "${etc_files}" DESTINATION etc) +IF (WIN32) + set (RESPATH "$ENV{PREFIX}/share/minigui/res/") + configure_file( + "${PROJECT_SOURCE_DIR}/etc/MiniGUI.cfg.win32.in" + "${PROJECT_BINARY_DIR}/etc/MiniGUI.cfg.win32" + ) + install (FILES ${PROJECT_BINARY_DIR}/etc/MiniGUI.cfg.win32 + DESTINATION etc + RENAME MiniGUI.cfg) +ELSE() + install (FILES "${etc_files}" DESTINATION etc) +ENDIF (WIN32) # include install (FILES "${PROJECT_BINARY_DIR}/mgconfig.h" diff --git a/COPYING b/COPYING new file mode 100644 index 00000000..94a9ed02 --- /dev/null +++ b/COPYING @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/ChangeLog b/ChangeLog index 4931d776..2f8025ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,18 +1,255 @@ ******************************************************************************* -What's new (V3.2.2): -10/24-2017 -CLEANUP: Remove some 'inline' definitions: +What's new (trunk): + +10/26 CLEANUP: svn merge -r 13673:13828 ^/branches/rel-3-0 + +10/24-2017 CLEANUP: Remove some 'inline' definitions: * GetIMEPos/SetIMEPos. * WndRect -> gui_WndRect. * WndClientRect -> gui_WndClientRect. -******************************************************************************* -What's new (V3.2.1): - 12/06. CLEANUP #11: Merge differences from rel-3-0, and remove unnecessary files. svn merge -r 12913:13673 ../branches/rel-3-0 (wanzheng) * ... ... +******************************************************************************* +What's new in rel-3-0 branch (3.0.12 OR, 2010/12/03 ~ ) + +07/29. ENHANCEMENT #11: Use Expand16CBitmapEx to contain the alpha component +for XorBits of cursor and reserve the alpha component of screen when showing +cursor. + * src/kernel/cursor.c + * src/kernel/cursor-sa.c + * src/kernel/cursor-procs.c + +07/29. ENHANCEMENT #10: Implement Expand16CBitmapEx, Expand256CBitmapEx, and +ExpandPart16CBitmap APIs, and define inline stubs for the old APIs. + * include/gdi.h + * src/newgdi/bitmap.c + +07/21. BUGFIXING #?: Fix the question of dead lock by screensaver_hide. Now send +message to active window and let active window to hide screensaver. (xwyan) + * src/include/internals.h + * src/gui/window.c + * src/misc/license.c + +07/06. BUGFIXING #?: Add macro control for we_heap.(xwyan) + * src/gui/lf_manager.c + +06/14. BUGFIXING #5640: fix bug of double click of event(houhh) + * src/kernel/event.c + +05/25. BUGFIXING #5606: fix bug of selectAll of mTextEdit (wanzheng) + * src/textedit/mtextedit.c + +05/20. BUGFIXING #5560: fixed bug of calc window client rect error in +calc_we_area().(houhh) + * src/mybmp/winbmp.c + +05/03. BUGFIXING #?: fixed bitmap BI_BITFIELDS format load problem.(humingming) + * src/mybmp/winbmp.c + +04/29. BUGFIXING #5534: fixed DrawText can't deal with the first char is '\n'.(humingming) + * src/newgdi/drawtext.c + +04/02. BUGFIXING #5527: Change MSG_KEYSYM/MSG_KEYLONGPRESS/MSG_KEYALWAYSPRESS +define value, Modfiy error position of __mg_msgstr2(houhh). + * src/include/msgstr.h + * include/window.h + +04/01. BUGFIXING #?: Make GetClipBox rect coordinate correct.(humingming) + * src/newgdi/clip.c + +03/25. BUGFIXING #?: After dialog created, we should update local hOwner variable +in DialogBoxIndirectParamEx. It can be avoid to create many model dialogs when +using HWND_DESKTOP as hOwner.(xwyan) + * src/gui/dialog.c + +03/22. BUGFIXING #?: Modify GetPalette() and fontGetTypeNameFromName() +prototype. (houhh) + * src/include/fontname.h + * include/gdi.h + +03/15. BUGFIXING #?: GetBoundRect() can't deal with an empty rect correctly. +(wanzheng) + * src/newgdi/rect.c + +03/07. BUGFIXING #?: Modify wndDrawNCButton to use input hdc when draw +scrollbar. (houhh) + * src/gui/window.c + * include/window.h + +03/04. BUGFIXING #?: Add FT_LOAD_FORCE_AUTOHINT style for ft2 font enigne when +open cache support. (houhh) + * src/font/freetype2.c + +03/04. ENHANCEMENT #9: Some enhancements for UXDemo. (CR department) + * 1) Eliminate accumulated error of timer. + 2) Add an API UpdateInvalidRect() to update the invalidate rect without + calling InvalidateRect(NULL) + 3) Improve S3C6410 GAL + 4) Make it able to create a hardware surface with different color format + from the screen surface. Attention, All GAL module are influenced. + 5) Initialize local-cutting-region (lcrgn) correctly when create a memory + DC. + 6) Used GetWindowElementPixelEx to replace GetWindowElementPixel, + specify dc. + * src/control/static.c + * src/gui/window.c + * src/kernel/timer.c + * src/newgal/pixels.c + * src/newgal/s3c6410/gal-s3c6410.c + * src/newgal/s3c6410/gal-s3c6410.h + * src/newgal/surface.c + * src/newgal/videomem-bucket.c + * src/newgdi/gdi.c + * src/sysres/font/_font_inner_res.c + +03/04. BUGFIXING #5408: GAL_revcpy should use 'cld' after using 'std'.(xwyan) + * src/include/memops.h + +03/02. BUGFIXING #5402: These is a mistake in del_all_devfonts(), and remove +it in font_DelDevFont(). (xhmao) + * src/font/devfont.c + * src/include/devfont.h + +03/01. BUGFIXING #5423: remove the restrict of the DC's max size when use +CreateSecondaryDC. (wangxubin) + * src/newgdi/gdi.c + * src/kernel/desktop-comm.c + * src/kernel/desktop-procs.c + * src/gui/window.c + +03/01: BUGFIXING #?: Fix a memory leak issue on arcCache. (wanzheng) + * src/kernel/init.c + * src/newgdi/miarc.c + * src/newgdi/mifillarc.h + +02/25: ENHANCEMENT #8: Add _MGFONT_TTF_GRAYADJUST for ttf font to adjust the gray +bitmap that return by font engine. (houhh) + * src/newgdi/glyph.c + * CMakeLists.txt + * cmake_mgconfig.h.in + +02/21: ENHANCEMENT #7: Enhance PCXVFB IAL, add IAL_RECORD_MANUAL_START support, +makes recording started after was pressed. (dengmin) + * src/ial/pcxvfbial.c + +02/18: ENHANCEMENT #6: Enhance AUTO IAL, let it replay IAL record automatically +if environment value 'MG_ENV_IAL_AUTO_REPLY' is specified. +(dengmin) + * src/ial/auto.c + +02/17: ENHANCEMENT #5: Enhance PCXVFB IAL, let MiniGUI can record IAL while +using PCXVFB GAL engine. (dengmin) + * src/ial/pcxvfbial.c + +02/15. BUGFIXING#5401: Fix compiling error. (wanzheng) + * src/kernel/cursor.c + +01/21. BUGFIXING#5373: Fix the bug of copy text to ES_UPPERCASE or ES_LOWERCASE +style edit control.(humingming) + * src/control/edit.c + * src/textedit/mtextedit.c + +01/19. BUGFIXING#?: Fix memory leak in ReleaseDC when do MAKE_REGION_INFINITE, we +should EmptyClipRgn it before exit gui or reinit rgn.(houhh) + * src/newgdi/gdi.c + +01/12. ENHANCEMENT #?: Add missing options in CMakeLists.txt and configure.in. +change the time of display splash to 1s. change the event of screensaver.(wangxubin) + * src/kernel/event.c + * src/misc/license.c + * src/newgal/CMakeLists.txt + * CMakeLists.txt + * configure.in + +01/11. BUGFIXING #?: Fix bug of core dump when MiniGUI uses Bitmap Font with alpha mask +(ZhaolinHu) + * src/gui/caret.c + * src/gui/window.c + * src/gui/lf_skin.c + * src/font/bitmapfont.c + * src/newgal/surface.c + * src/newgdi/rotatebmp.c + * src/newgdi/readbmp.c + * src/newgdi/bitmap.c + * include/gdi.h + +01/11. BUGFIXING #?: Fix bug of using stack in vxworks.(xwyan) + * src/libc/vxworks_pprivate.h + * src/libc/vxworks_pthread.c + +01/07. ENHANCEMENT #4: Add mgetc_win32.c for Windows. (wanzheng) + * src/sysres/mgetc_win32.c + * src/sysres/CMakeLists.txt + +01/05. BUGFIXING #?: Fix bug of GetClipBox, Add IntersectRect with DevRC.(houhh) + * src/newgdi/clip.c + +01/05. BUGFIXING #5342: Fix bug of shadow engine, sometimes core dump +in start and quit.(wangxubin) + * src/newgal/shadow/shadow.c + +01/05. CLEANUP #3: Update the description of MSG_ERASEBKGND. (wanzheng) + * include/window.h + +12/29. BUGFIXING #?: Fix bug of new textedit calc mulit-charset length not +correct in some borad.(humingming) + * src/textedit/mtextedit.c + +12/28. CLEANUP #2: Resolve compiling issues on Windows. (wanzheng) + +12/23. BUGFIXING #?: Fix bug of GetSubDC, you can specify off_x/off_y < 0 if +dcType is memdc.(houhh) + * src/newgdi/gdi.c + +12/23. BUGFIXING #?: Fix bug of drawing and fill hline, can not limited in +screen area.(houhh) + * src/newgdi/pixel_ops.c + * _dc_draw_hline_clip, _dc_fill_hline_clip. + +12/20: ENHANCEMENT #3: Enhance stgfb GAL support 32bit and 255 alpha pixel format. +(humingming) + * src/newgal/stgfb/stgfb_video.c + +12/14: ENHANCEMENT #2: Enhance PCXVFB GAL engine, let MiniGUI quit if the VFB +didn't come for a long time. (wanzheng) + * src/newgal/pcxvfb/pcxvfb.c + +12/14: BUGFIXING #5(new-bugzilla): Do not destroy the znode of screensaver +until EndSession. (wanzheng) + * src/kernel/desktop-comm.c + * src/kernel/desktop-procs.c + * src/kernel/init.c + * src/kernel/init-lite.c + +12/09: BUGFIXING #5340: Close Menu when ESCAPE pressed. (wanzheng) + * src/gui/menu.c + +12/09: ENHANCEMENT #1: PCXVFB GAL: Change the group id of the VFB process, so +that we can interrupt the application when debugging. (wanzheng) + * src/kernel/init.c + * src/kernel/init-lite.c + * src/newgal/pcxvfb/pcxvfb.c + +12/07: CLEANUP #1: Corrected the spelling mistake `ncsParseConstrcutParams'. +(wanzheng) + * src/textedit/mbtree.c + * src/textedit/mtextedit.c + * src/textedit/object.c + * src/textedit/object.h + +12/06: BUGFIXING #?: Fixed the bug of own_overlapped_bitblit. (humingming) + * src/newgal/surface.c + +******************************************************************************* +What's new in this branch (3.0.10 OR, 2010/08/06 ~ 2010/12/03) + +12/01: BUGFIXING #5337: Fixed bug of RecalcScrollInfo when hide scrollar ,it +should me call ShowScrollBar to hide. (houhh) + * src/gui/window.c + 07/28. BUGFIXING: region cause the minigui crash. CLIPRECT's next member can be NULL, but many functions didnot check it when they use the code like "while(r1) { .... r1 = r1->next}" (dongjunjie) diff --git a/GNUmakefile b/GNUmakefile index 8ce03afd..9b0d4afd 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1,6 +1,6 @@ MAJOR_VERSION = 3 -MINOR_VERSION = 2 -MICRO_VERSION = 1 +MINOR_VERSION = 0 +MICRO_VERSION = 13 EXTRAVERSION = MINIGUI_RELEASE=$(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)$(EXTRAVERSION) diff --git a/LICENSE.POLICY b/LICENSE.POLICY index 3781c7a5..06b77ab3 100644 --- a/LICENSE.POLICY +++ b/LICENSE.POLICY @@ -12,9 +12,8 @@ and if yours is also 100% GPL, then you never have to pay us for the licences. In all other instances, you are better served by our commercial licence. Read the details below! - Licensing -======== +========= MiniGUI software is licensed under the GPL license. The formal terms of the GPL license can be found in the GNU General Public License @@ -23,7 +22,7 @@ section of the MiniGUI User Manual, or the file named "COPYING". MiniGUI is also available under commercial non-GPL license. For pricing and ordering information, visit our web page: - http://www.minigui.com/product/index.shtml + http://www.fmsoft.cn/ 1. Free use for those who are 100% GPL @@ -61,17 +60,21 @@ a commercial license to the MiniGUI software in question. More specifically: - a) If you link MiniGUI in your non-GPL application, you need a commercial + a) If you want to use MiniGUI on an operating system which is not + compatible with GPL (most commercial RTOSes, such as VxWorks and + ThreadX), you need a commercial license for the MiniGUI library. + + b) If you link MiniGUI in your non-GPL application, you need a commercial licence for the MiniGUI library. Using MiniGUI with non-GPL operating systems (proprietary OSes, like VxWorks, ThreadX, uC/OS-II) falls into this situation. Linking MiniGUI with your non-GPL application and proprietary libarires also falls into this situation. - b) If you use MiniGUI library within your organisation and you don't want + c) If you use MiniGUI library within your organisation and you don't want to risk it falling under the GPL license, you are welcome to purchase a commercial license. - c) Many users opt for the commercial licence simply because under it + d) Many users opt for the commercial licence simply because under it FMSoft takes responsibility for its products. Under the GPL licence, there are no warranties or representations from the developer (i.e. from FMSoft). @@ -126,8 +129,13 @@ If you have any questions on MiniGUI licensing, feel free to contact us: mailto: sales@minigui.com +Patents +======= + +MiniGUI is also protected by patents (200810111336.X and so on). +The owner of these patents is Beijing FMSoft technologies Co., Ltd.. GPL = Gnu General Public License, http://www.gnu.org/copyleft/gpl.html LGPL = GNU General Public License, http://www.gnu.org/copyleft/lgpl.html -FMSoft = Beijing FMSoft Technologies Co., Ltd., http://www.minigui.com +FMSoft = Beijing FMSoft technologies Co., Ltd., http://www.fmsoft.cn diff --git a/LICENSE.POLICY.zh b/LICENSE.POLICY.zh index 4164ee08..20335e21 100644 --- a/LICENSE.POLICY.zh +++ b/LICENSE.POLICY.zh @@ -176,5 +176,5 @@ MiniGUI GPL = GNU General Public License, http://www.gnu.org/copyleft/gpl.html LGPL = GNU General Public License, http://www.gnu.org/copyleft/lgpl.html -FMSoft = Beijing FMSoft Technologies Co., Ltd., http://www.minigui.com +FMSoft = FMSoft, http://www.fmsoft.cn diff --git a/Makefile.am b/Makefile.am index 589fb436..8eb23397 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,11 +1,9 @@ -AUTOMAKE_OPTIONS=foreign - SUBDIRS = src 3rd-party include rtos etc m4 cmake build EXTRA_DIST = \ GNUmakefile makefile.ng makefile.msvc rules.make \ Version README INSTALL \ - LICENSE.POLICY LICENSE.POLICY.zh + COPYING LICENSE.POLICY minigui.pc.in # The directory where the include files will be installed diff --git a/NEWS b/NEWS new file mode 100644 index 00000000..2eb7c665 --- /dev/null +++ b/NEWS @@ -0,0 +1,2 @@ +2012-01-16: + MiniGUI GPL Version 3.0.12 released. diff --git a/README b/README new file mode 100644 index 00000000..1841548a --- /dev/null +++ b/README @@ -0,0 +1,273 @@ +NAME + MiniGUI - a mature cross-platform windowing system and GUI system + for real-time embedded systems. + + +TABLE OF CONTENTS + 1. Introduction + 2. The runtime modes of MiniGUI + 3. New features of this version + 4. History + 5. About the authors + 6. If you have a problem + 7. A little FAQ + 8. Copying + + +1. INTRODUCTION + + MiniGUI is a mature cross-platform windowing system and GUI (Graphics + User Interface) support system for real-time embedded systems. This + is version 3.2 released by Feynman Software (http://www.minigui.com). + + MiniGUI aims to provide a fast, stable, full-featured, and cross-platform + windowing and GUI support system, which is especially fit for + real-time embedded systems based-on Linux/uClinux, eCos, and other + tranditional RTOSes, such as VxWorks, ThreadX, Nucleus, pSOS, uC/OS-II, + and OSE. + + This is the MiniGUI core source tarball, which provides windowing + and graphics interfaces as well as a lot of standard controls. + + Besides MiniGUI core, Feynman Software also provides some components + for the developers to develop application much easier: + + o mGi: An input method component for MiniGUI. This component provides + some typical input methods (such as softkey, hand-writing, and predict + text input for mobile phone) for MiniGUI applications. + + o mGp: A printing component for MiniGUI. By using mGp, you can print + out the graphics created by MiniGUI application to general-purpose priters. + + o mG3d: A simple three-dimension component for MiniGUI. This component + provides a simple 3D API for application. You can use mG3d to create + 3D UI. + + o mGUtils: A MiniGUI component which contains miscellaneous utilities + like ColorSelectionDialogBox, FileOpenDialogBox, and so on. + + o mGPlus: A MiniGUI component which provides support for advanced graphics + functions like path, gradient, anti-aliase stretch, and color combination. + + MiniGUI also is a free software project. In December 1998, the initiator of + Feynman Software, Wei Yongming, began to develop MiniGUI under the + GNU General Public License (GPL). In September 2002, the core developers of + MiniGUI founded Feynman Software and started the commercial marketing with + the free software. By now, Feynman Software still continues to release MiniGUI + as a free software project. + + You can download the source of GPL'd MiniGUI versions from the site: + + http://www.minigui.org + + +2. THE RUNTIME MODES OF MINIGUI + + You can configure and compile MiniGUI as one of three runtime modes: + + * `MiniGUI-Threads': A program running on MiniGUI-Threads can create + multiple cascaded windows in different threads, and all the windows + belong to a single process. MiniGUI-Threads is fit for some real-time + systems on Linux/uClinux, eCos, uC/OS-II, VxWorks, pSOS, ThreadX, + and OSE. + + * `MiniGUI-Processes': A program running on MiniGUI-Processes is + an independent process, which can also create multiple windows. + MiniGUI-Processes is fit for some complex embedded systems, such as + PDAs, Thin-Clients or STBs. This mode is only useful for full-featured + UNIX-like operating systems, like Linux. + + * `MiniGUI-Standalone': A single process version of MiniGUI. This mode + is useful for some systems which lack of PThread support, like some + buggy uClinux systems. + + The original MiniGUI (version 1.0) run in MiniGUI-Threads mode. + It is based on POSIX-compliant thread library. And this thread-based + architecture of MiniGUI is very fit for most traditional embedded + operating systems, such as eCos, uC/OS-II, and VxWorks. However, + if you use embedded Linux, the architecture like X Window will have + better stability and scalability, because of the independent memory + address space of every process. + + Since version 2.0, we provides a new runtime mode called MiniGUI-Processes. + You can use MiniGUI-Processes to run more than one MiniGUI-based + program in the form of UNIX process at the same time. MiniGUI-Processes + is a full-featured multi-process version of original MiniGUI -- You + can run a program based on MiniGUI-Processes from a program called + 'mginit'. Just like X Window, the former process is called a client, + and the latter the server. + + Clients connect to the server via UNIX domain socket, and the server + receives and responses requests from clients. The server provides shared + resources for clients, manage window objects, and sends mouse + (or touch screen) and keyboard events to the active top-most client. + If a client exits or dies for some reasons, it will not damage other + clients and the server. + + +3. NEW FEATURES OF THIS VERSION + + For more information, please refer to ReleaesNotes-3.2.x.pdf file in + the product CD-ROM (in the 'docs/' directory). + + +4. HISTORY + + About ten years have pasted since MiniGUI was initially created at + the end of 1998, and now it becomes much reliable and stable. + During the past years, many remarkable changes have taken place in + the MiniGUI project. + + At the original, the version 0.2.xx was based on SVGALib and PThread + (LinuxThreads). Then the version 0.3.xx had many enhanced features + including Graphics Abstract Layer (GAL), Input Abstract Layer (IAL), + and the support for multiple charsets and multiple fonts. + + In version 1.0.00, we designed MiniGUI-Lite, which was more fit for + some complex embedded systems, such as PDAs, Thin-Clients, or STBs. + MiniGUI-Lite made the embedded systems more stable and efficient. + The version 1.0.00 provided the native fbcon engine based on Linux + FrameBuffer device directly as well. + + In the development of version 1.1.00, we re-wrote the GAL and GDI + interfaces, and provided some advanced video features, such as raster + operation, transparent blitting, alpha blending, and video hardware + acceleration. We also provided some important GDI functions, such as + Ellipse, Arc, Polygon, and FloodFill. + + In the development of version 1.6.0, we added advanced 2D graphics + functions to MiniGUI. It provides the abstract logical pen and brush + objects, and can be used to render advanced graphics objects. + + In the development of version 2.0.x, we developed MiniGUI-Processes. + + In the development of version 3.0.x, we introduced Look & Feel Renderer, + BIDI text support, No-rectagular window, double-buffer window, and + other main featuers. + + In the development of version 3.2.x, we enhanced MiniGUI to support Gtk+ + v2.16.x smoothly. + + A brief history description of the developement progress lay below: + + 0) 1994 ~ 1996: MiniGUI DOS version. + 1) Dec, 1998: Began to write. + 2) Apr, 1999: The skeleton of MiniGUI, windowing sub-system + and basic graphics device interfaces. + 3) May, 1999: Timer, menu, and the sekleton of control sub-system. + 4) Jun, 1999: Chinese input method (by Kang Xiaoning). + 5) July, 1999: GIF and JPG loading support (by LI Zhuo). + 6) Aug, 1999: Some standard controls (Portion by Zhao Jianghua). + 7) Sep, 1999: Dialog boxes and message boxes. + 8) Sep, 1999: Snapshot of screen or window. + 9) Jan., 2000: VCOnGUI (Virtual Console on MiniGUI) version 0.2.02. + 10) Mar., 2000: Linux distribution installer based-on MiniGUI for + HappyLinux 1.0. + 11) Jun., 2000: Began to develop version 1.0.xx. + 12) Sep., 2000: MiniGUI version 0.3.06 released. + 13) Oct., 2000: MiniGUI version 0.9.00 released. + 14) Nov., 2000: MiniGUI version 0.9.96 released. + 15) Jan., 2001: MiniGUI version 0.9.98 released. You can build + MiniGUI-Lite from this version. + 16) Jan., 2001: MiniGUI version 1.0.00Beta1 released. + 17) Feb., 2001: MiniGUI version 1.0.00Pre1 released. + 18) Apr., 2001: MiniGUI version 1.0.00 released (2001/04/16). + 18) Sep., 2001: MiniGUI version 1.1.0Pre1 released (2001/09/12). + 19) Sep., 2001: MiniGUI version 1.0.9 released (2001/09/17), + this will be the last version of + source branch 1.0.x. + 20) Oct., 2001: MiniGUI version 1.1.0Pre4 released (2001/10/22). + This version have new GAL and GDI interfaces. + 21) Mar., 2002: MiniGUI official version 1.1.0 released + (2002/03/08). + MiniGUI API Reference documentation + version 0.9 released. + 22) Mar., 2002: MiniGUI API Reference documentation + version 1.0 released. + 23) Apr., 2002: MiniGUI the new stable version 1.2.0 released + (2002/04/11). + 24) Sep., 2002: The main developers of MiniGUI founded a + new software corporation: Beijing Feynman Software + Technology Co., Ltd.. And the development and + maintenance of MiniGUI changes from + loosely-knit team to business organization. + 25) Mar., 2003: MiniGUI official version 1.2.5 released + (2003/03/23). + 25) May., 2003: MiniGUI official version 1.2.6 released + (2003/05/18). + 26) Sep., 2003: MiniGUI official version 1.3.1 released + (2003/09/11). + 27) Jan., 2004: MiniGUI official version 1.5.1 released + (2004/01/18). + 28) Feb., 2004: MiniGUI tested on eCos and uC/OS-II. + 29) Jun., 2004: MiniGUI tested on VxWorks. + 30) Jan., 2005: MiniGUI tested on ThreadX and pSOS. + 31) Feb., 2005: MiniGUI official version 1.6.1 released. + 32) Aug., 2005: MiniGUI beta version 2.0.0 released. + 33) Sep., 2005: MiniGUI official version 1.6.8 released. + 34) Oct., 2005: MiniGUI official version 2.0.2 released. + 35) Jun., 2006: MiniGUI provides support for OSE. + 36) Jul., 2006: MiniGUI official version 2.0.3/1.6.9 released. + 37) Nov., 2007: MiniGUI official version 2.0.4/1.6.10 released. + 38) Apr., 2009: MiniGUI official version 3.0.2 released. + 39) Oct., 2009: MiniGUI official version 3.0.4 released. + 40) Jan., 2010: MiniGUI official version 3.0.6 released. + 41) May., 2010: MiniGUI official version 3.0.8 released. + 42) May., 2010: MiniGUI official version 3.2.0 released. + 43) Oct., 2010: MiniGUI official version 3.0.10 released. + + +5. ABOUT THE AUTHORS + + The original author of MiniGUI is Wei Yongming, and now MiniGUI is + maintained by Feynman Software. For more information, please browse + our home page: + + http://www.minigui.com + + The GPL'd versions and dependent libraries of MiniGUI can be found at: + + http://www.minigui.org + + +6. IF YOU HAVE A PROBLEM + + If you have any technical problem, advice or comment, please send + messages to consult@minigui.com. + + If you are interested in the commercial MiniGUI products and licensing, + please write to sales@minigui.com. + + +7. A LITTLE FAQ + + Q: Is GPL'd MiniGUI free for commercial use? + + A: Simply no. Feynman Software release some versions of MiniGUI under + GPL license. It is free for those who are 100% GPL and those who + never copy, modify and distribute MiniGUI. But if you want to use + these GPL'd versions for commerce, you should get the commercial + license from Feynman Software first. + + Q: Which operating system does MiniGUI support? + + A: MiniGUI can run on Linux/uClinux, uC/OS-II, eCos, ThreadX, pSOS, + VxWorks, ThreadX, OSE, and even Win32. Any other real-time OSes can + be supported theoretically. + + Q: Which architecture does MiniGUI support? + + A: Intel x86, ARM (ARM7/AMR9/StrongARM/xScale), PowerPC, MIPS, + DragonBall, ColdFire, Blackfin, and so on. + + Q: Does MiniGUI offer the support for grey LCD with 4bpp (bits per pixel)? + + A: Yes, it offers. It even offers the support for 1bpp and 2bpp LCD. + + +8. COPYING + + Copyright (C) 2002~2010, Beijing FMSoft Technology Co., Ltd. + + All rights reserved. + diff --git a/Version b/Version index 0c38ba67..6090d5ee 100644 --- a/Version +++ b/Version @@ -1,9 +1,9 @@ -Version 3.2.2 (the official release) +Version 3.0.13 (2017/10/26) This release needs the following resource packages: - * minigui-res-3.0.10.tar.gz + * minigui-res-3.0.12.tar.gz The latest samples package is: - * mg-samples-3.0.10.tar.gz + * mg-samples-3.0.13.tar.gz diff --git a/cmake/minigui-private.cmake b/cmake/minigui-private.cmake index 15a26bc2..be676c87 100644 --- a/cmake/minigui-private.cmake +++ b/cmake/minigui-private.cmake @@ -34,14 +34,23 @@ endmacro (__find_mlib) # macro (__find_pnglib _image_pngsupport _lib_list _include_list) if (${_image_pngsupport}) - find_package (PNG REQUIRED) + INCLUDE (FindPkgConfig) + PKG_CHECK_MODULES (PNG libpng) if (PNG_FOUND) - #mg_seperate_string (${ZLIB_LIBRARY}) - set (${_lib_list} "${${_lib_list}} -l${ZLIB_LIBRARY_NAME}") - # message ("${PNG_PNG_INCLUDE_DIR} ${PNG_LIBRARY}") - #mg_seperate_string (${PNG_LIBRARY}) - set (${_lib_list} "${${_lib_list}} -L${PNG_LIBRARY_DIR} -l${PNG_LIBRARY_NAME}") - set (${_include_list} "${${_include_list}} -I${PNG_INCLUDE_DIR}") + foreach (i ${PNG_INCLUDE_DIRES}) + set (${_include_list} "${${_include_list}} -I${i}") + endforeach (i ${PNG_INCLUDE_DIRES}) + + foreach (L ${PNG_LIBRARY_DIRS}) + set (${_lib_list} "${${_lib_list}} -L${L}") + endforeach (L ${PNG_LIBRARY_DIRS}) + + foreach (l ${PNG_LIBRARIES}) + set (${_lib_list} "${${_lib_list}} -l${l}") + endforeach (l ${PNG_LIBRARIES}) + + link_directories (${PNG_LIBRARY_DIRS}) + include_directories (${PNG_INCLUDE_DIRS}) else () set (${_image_pngsupport} OFF) endif (PNG_FOUND) @@ -77,20 +86,23 @@ if (${_with_fontttfsupport} STREQUAL "ft1") # endif (${_with_ft1includes} STREQUAL "") set (${_with_fontttfsupport} "none") elseif (${_with_fontttfsupport} STREQUAL "ft2") - # specify if have own FreeType2 library - # check for FreeType2 library - find_package (FREETYPE REQUIRED) + INCLUDE (FindPkgConfig) + PKG_CHECK_MODULES (FREETYPE freetype2) if (FREETYPE_FOUND) - if (${_with_ft2includes} STREQUAL "") - # message ("${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}") - include_directories (${FREETYPE_INCLUDE_DIR}) - #mg_seperate_string (${FREETYPE_LIBRARY}) - set (${_lib_list} "${${_lib_list}} -L${FREETYPE_LIBRARY_DIR} -l${FREETYPE_LIBRARY_NAME}") - set (${_include_list} "${${_include_list}} -I${FREETYPE_INCLUDE_DIR_ft2build} -I${FREETYPE_INCLUDE_DIR_freetype2}") - else () - include_directories (${${_with_ft2includes}}) - set (${_include_list} "${${_with_ft2includes}}") - endif (${_with_ft2includes} STREQUAL "") + foreach (i ${FREETYPE_INCLUDE_DIRES}) + set (${_include_list} "${${_include_list}} -I${i}") + endforeach (i ${FREETYPE_INCLUDE_DIRES}) + + foreach (L ${FREETYPE_LIBRARY_DIRS}) + set (${_lib_list} "${${_lib_list}} -L${L}") + endforeach (L ${FREETYPE_LIBRARY_DIRS}) + + foreach (l ${FREETYPE_LIBRARIES}) + set (${_lib_list} "${${_lib_list}} -l${l}") + endforeach (l ${FREETYPE_LIBRARIES}) + + link_directories (${FREETYPE_LIBRARY_DIRS}) + include_directories (${FREETYPE_INCLUDE_DIRS}) else () set (${_with_fontttfsupport} "none") endif (FREETYPE_FOUND) diff --git a/cmake_mgconfig.h.in b/cmake_mgconfig.h.in index b4533184..5eb29d97 100644 --- a/cmake_mgconfig.h.in +++ b/cmake_mgconfig.h.in @@ -407,6 +407,12 @@ /* Define if compile max ttf cahce number for 10 (default value) */ #cmakedefine _MGMAX_TTF_CACHE @_MGMAX_TTF_CACHE@ +/* Define if include ttf grayadjust*/ +#cmakedefine _MGFONT_TTF_GRAYADJUST 1 + +/* Define if ttf gray adjust value(50 default value) */ +#cmakedefine _MGFONT_TTF_GRAYADJUST_VALUE @_MGFONT_TTF_GRAYADJUST_VALUE@ + /* Define if support UPF font */ #cmakedefine _MGFONT_UPF 1 diff --git a/configs/config.in b/configs/config.in index d1f9cd83..9742fe0e 100644 --- a/configs/config.in +++ b/configs/config.in @@ -185,7 +185,7 @@ mainmenu_option next_comment comment 'Look and Feel options' choice 'LF reference' \ "Skin CONFIG_LF_SKIN \ - Flat CONFIG_LF_FLAT + Flat CONFIG_LF_FLAT " none endmenu diff --git a/configure.in b/configure.in index 7e41b884..3e1ae29f 100644 --- a/configure.in +++ b/configure.in @@ -3,7 +3,7 @@ AC_PREREQ(2.52) dnl ======================================================================== dnl Put the name and version of the package here -AC_INIT([libminigui], [3.2.2]) +AC_INIT([libminigui], [3.0.13]) AC_CONFIG_SRCDIR([src/main/main.c]) dnl Set various version strings - taken gratefully from the SDL sources @@ -18,8 +18,8 @@ dnl Set various version strings - taken gratefully from the SDL sources # set MINIGUI_BINARY_AGE and MINIGUI_INTERFACE_AGE to 0. # MiniGUI_MAJOR_VERSION=3 -MiniGUI_MINOR_VERSION=2 -MiniGUI_MICRO_VERSION=1 +MiniGUI_MINOR_VERSION=0 +MiniGUI_MICRO_VERSION=13 MiniGUI_INTERFACE_AGE=0 MiniGUI_BINARY_AGE=0 MiniGUI_VERSION=$MiniGUI_MAJOR_VERSION.$MiniGUI_MINOR_VERSION.$MiniGUI_MICRO_VERSION @@ -47,7 +47,7 @@ AC_CANONICAL_SYSTEM dnl ======================================================================== dnl Init automake -AM_INIT_AUTOMAKE([foreign no-define]) +AM_INIT_AUTOMAKE([no-define]) AC_CONFIG_HEADER(mgconfig.h) dnl ======================================================================== @@ -1141,8 +1141,8 @@ CheckST7167Video() if test x$video_st7167 = xyes; then AC_DEFINE(_MGGAL_ST7167, 1, [Define if include NEWGAL engine for ST7167]) - VIDEO_SUBDIRS="$VIDEO_SUBDIRS st7167" - VIDEO_DRIVERS="$VIDEO_DRIVERS st7167/libvideo_st7167.la" + VIDEO_SUBDIRS="$VIDEO_SUBDIRS dfb" + VIDEO_DRIVERS="$VIDEO_DRIVERS dfb/libvideo_st7167.la" LIBS="$LIBS -ldirectfb" fi fi @@ -1410,7 +1410,6 @@ fi if test "x$build_dlcustom_ial_engine" = "xyes"; then AC_DEFINE(_MGIAL_DLCUSTOM, 1, [Define if include dlcustom engine for customer's board]) - SYSTEM_LIBS="$SYSTEM_LIBS -ldl" fi @@ -1843,6 +1842,7 @@ fi if test "x$build_tslib_ial_engine" = "xyes"; then AC_DEFINE(_MGIAL_TSLIB, 1, [Define if include IAL engine for TSLIB]) + SYSTEM_LIBS="$SYSTEM_LIBS -lts" fi if test "x$build_console_ial_engine" = "xyes"; then @@ -2541,8 +2541,7 @@ echo "Going to generate license pictures ..." cd src/sysres/license/ ./runme.sh $LICENSE_PICTURE > /dev/null if [[ $? -ne 0 ]]; then - echo "Fatal: failed to generate license pictures." - exit 1 + echo "WARNING: failed to generate license pictures." else echo "Done." fi diff --git a/etc/MiniGUI.cfg.win32.in b/etc/MiniGUI.cfg.win32.in new file mode 100644 index 00000000..b1ded6b4 --- /dev/null +++ b/etc/MiniGUI.cfg.win32.in @@ -0,0 +1,474 @@ +# This configuration file is for MiniGUI V3.0.x +# +# Copyright (C) 2002~2008 Feynman Software +# Copyright (C) 1998~2002 Wei Yongming. +# +# Web: http://www.minigui.com +# +# This configuration file must be installed in /etc, +# /usr/local/etc or your home directory. When you install it in your +# home directory, it should be named ".MiniGUI.cfg". +# +# The priority of above configruation files is ~/.MiniGUI.cfg, +# /usr/local/etc/MiniGUI.cfg, and then /etc/MiniGUI.cfg. +# +# If you change the install path of MiniGUI resource, you should +# modify this file to meet your configuration. +# +# NOTE: +# The format of this configuration file has changed since the last release. +# Please DONT forget to provide the latest MiniGUI.cfg file for your MiniGUI. +# + +[system] +# GAL engine and default options +gal_engine=pc_xvfb +defaultmode=800x600-16bpp + +# IAL engine +ial_engine=pc_xvfb +mdev=/dev/input/mice +mtype=IMPS2 + +[fbcon] +defaultmode=1024x768-16bpp + +[qvfb] +defaultmode=640x480-16bpp +display=0 + +#{{ifdef _MGGAL_PCXVFB +[pc_xvfb] +defaultmode=800x600-16bpp +window_caption=XVFB-for-MiniGUI-3.0-(Gtk-Version) +exec_file=gvfb +#}} + +[rtos_xvfb] +defaultmode=800x600-16bpp + +#{{ifdef _MGGAL_SHADOW +[shadow] +real_engine=pc_xvfb +defaultmode=800x600-16bpp +rotate_screen=normal +#}} + +#{{ifdef _MGGAL_MLSHADOW +[mlshadow] +real_engine=qvfb +defaultmode=800x600-16bpp +def_bgcolor=0x00FF00 +double_buffer=enable +#}} + +# The first system font must be a logical font using RBF device font. +[systemfont] +font_number=5 +font0=rbf-FixedSys-rrncnn-8-16-ISO8859-1 +font1=*-FixedSys-rrncnn-*-16-ISO8859-1 +font2=*-Courier-rrncnn-*-16-ISO8859-1 +font3=*-SansSerif-rrncnn-*-16-ISO8859-1 +font4=*-System-rrncnn-*-16-ISO8859-1 + +default=0 +wchar_def=4 +fixed=1 +caption=4 +menu=2 +control=3 + +[rawbitmapfonts] +font_number=0 + +[varbitmapfonts] +font_number=0 + +[upf] +font_number=0 + +[qpf] +font_number=0 + +[truetypefonts] +font_number=0 + +[mouse] +dblclicktime=300 + +[event] +timeoutusec=300000 +repeatusec=50000 + +[cursorinfo] +# Edit following line to specify cursor files path +cursorpath=@RESPATH@/cursor/ +cursornumber=23 +cursor0=d_arrow.cur +cursor1=d_beam.cur +cursor2=d_pencil.cur +cursor3=d_cross.cur +cursor4=d_move.cur +cursor5=d_sizenwse.cur +cursor6=d_sizenesw.cur +cursor7=d_sizewe.cur +cursor8=d_sizens.cur +cursor9=d_uparrow.cur +cursor10=d_none.cur +cursor11=d_help.cur +cursor12=d_busy.cur +cursor13=d_wait.cur +cursor14=g_rarrow.cur +cursor15=g_col.cur +cursor16=g_row.cur +cursor17=g_drag.cur +cursor18=g_nodrop.cur +cursor19=h_point.cur +cursor20=h_select.cur +cursor21=ho_split.cur +cursor22=ve_split.cur + +[resinfo] +respath=@RESPATH@ + +[classic] +# Note that max number defined in source code is 5. +iconnumber=5 +icon0=form.ico +icon1=failed.ico +icon2=help.ico +icon3=warning.ico +icon4=excalmatory.ico + +# default icons for new OpenFileDialogBox +dir=folder.ico +file=textfile.ico + +# default icons for TreeView control +treefold=fold.ico +treeunfold=unfold.ico + +# bitmap used by BUTTON control +radiobutton=classic_radio_button.bmp +checkbutton=classic_check_button.bmp + +# background picture, use your favirate photo +bgpicture=none +bgpicpos=center +# bgpicpos=upleft +# bgpicpos=downleft +# bgpicpos=upright +# bgpicpos=downright +# bgpicpos=upcenter +# bgpicpos=downcenter +# bgpicpos=vcenterleft +# bgpicpos=vcenterright +# bgpicpos=none + +#window element metrics +caption=20 +menu=25 +border=2 +scrollbar=16 + +#window element colors +fgc_active_caption=0xFFFFFFFF +bgca_active_caption=0xFF6A240A +bgcb_active_caption=0xFF6A240A + +fgc_menu=0xFF000000 +bgc_menu=0xFFCED3D6 + + +fgc_msgbox=0xFF000000 + +fgc_tip=0xFF000000 +bgc_tip=0xFFE7FFFF + +fgc_active_border=0xFFCED3D6 +fgc_inactive_border=0xFFCED3D6 + +fgc_inactive_caption=0xFFC8D0D4 +bgca_inactive_caption=0xFF808080 +bgcb_inactive_caption=0xFF808080 + +fgc_window=0xFF000000 +bgc_window=0xFFFFFFFF + +fgc_3dbox=0xFF000000 +mainc_3dbox=0xFFCED3D6 + +fgc_selected_item=0xFFFFFFFF +bgc_selected_item=0xFF6B2408 +bgc_selected_lostfocus=0xFFBDA69C + +fgc_disabled_item=0xFF848284 +bgc_disabled_item=0xFFCED3D6 + +fgc_hilight_item=0xFFFFFFFF +bgc_hilight_item=0xFF6B2408 + +fgc_significant_item=0xFFFFFFFF +bgc_significant_item=0xFF6B2408 + +bgc_desktop=0xFFC08000 + +#{{ifdef _MGLF_RDR_FLAT +[flat] +# Note that max number defined in source code is 5. +iconnumber=5 +icon0=form-flat.ico +icon1=failed-flat.ico +icon2=help-flat.ico +icon3=warning-flat.ico +icon4=excalmatory-flat.ico + +# default icons for new OpenFileDialogBox +dir=folder-flat.ico +file=textfile-flat.ico + +# default icons for TreeView control +treefold=fold-flat.ico +treeunfold=unfold-flat.ico + +# bitmap used by BUTTON control +radiobutton=flat_radio_button.bmp +checkbutton=flat_check_button.bmp + +# background picture, use your favirate photo +bgpicture=none +bgpicpos=center + +#window element metrics +caption=20 +menu=25 +border=1 +scrollbar=16 + +#window element colors +fgc_active_caption=0xFFFFFFFFF +bgca_active_caption=0xFF000000 +bgcb_active_caption=0xFF000000 + +fgc_inactive_caption=0xFF000000 +bgca_inactive_caption=0xFFFFFFFF +bgcb_inactive_caption=0xFFFFFFFF + +fgc_menu=0xFF000000 +bgc_menu=0xFFD8D8D8 + +fgc_msgbox=0xFF000000 + +fgc_tip=0xFF000000 +bgc_tip=0xFFE7FFFF + +fgc_active_border=0xFF000000 +fgc_inactive_border=0xFF848284 + +fgc_window=0xFF000000 +bgc_window=0xFFFFFFFF + +fgc_3dbox=0xFF000000 +mainc_3dbox=0xFFFFFFFF + +fgc_selected_item=0xFFFFFFFF +bgc_selected_item=0xFF000000 +bgc_selected_lostfocus=0xFFBDA69C + +fgc_disabled_item=0xFF848284 +bgc_disabled_item=0xFF000000 + +fgc_hilight_item=0xFFFFFFFF +bgc_hilight_item=0xFF664E4A + +fgc_significant_item=0xFFFFFFFF +bgc_significant_item=0xFF000000 + +bgc_desktop=0xFFC08000 + +flat_tab_normal_color=0xFFC6D2CF +#}} + +#{{ifdef _MGLF_RDR_SKIN +[skin] +# Note that max number defined in source code is 5. +iconnumber=5 +icon0=form.ico +icon1=failed.ico +icon2=help.ico +icon3=warning.ico +icon4=excalmatory.ico + +# default icons for new OpenFileDialogBox +dir=folder.ico +file=textfile.ico + +# default icons for TreeView control +treefold=fold.ico +treeunfold=unfold.ico + +# background picture, use your favirate photo +bgpicture=none +bgpicpos=center + +#window element metrics +caption=25 +menu=25 +border=1 +scrollbar=17 + +fgc_active_caption=0xFFFFFFFF +bgca_active_caption=0xFFE35400 +bgcb_active_caption=0xFF686868 + +fgc_menu=0xFF000000 +bgc_menu=0xFFD4D6FF + +fgc_msgbox=0xFF000000 + +fgc_tip=0xFF000000 +bgc_tip=0xFFFFFFFF + +fgc_active_border=0xFFC8D0D4 +fgc_inactive_border=0xFFC8D0D4 + +fgc_inactive_caption=0xFFF8E4D8 +bgca_inactive_caption=0xFFDF967A +bgcb_inactive_caption=0xFF686868 + +fgc_window=0xFF000000 +bgc_window=0xFFFFFFFF + +fgc_3dbox=0xFF000000 +mainc_3dbox=0xFFD8E9EC + +fgc_selected_item=0xFFFFFFFF +bgc_selected_item=0xFFC56A31 +bgc_selected_lostfocus=0xFFD8E9EC + +fgc_disabled_item=0xFF99A8AC +bgc_disabled_item=0xFFFFFFFF + +fgc_hilight_item=0xFFFFFFFF +bgc_hilight_item=0xFFC56A31 + +fgc_significant_item=0xFFFFFFFF +bgc_significant_item=0xFFC56A31 + +bgc_desktop=0xFF984E00 + +skin_bkgnd=skin_bkgnd.bmp +skin_caption=skin_caption.gif +skin_caption_btn=skin_cpn_btn.gif + +#for scrollbar +skin_scrollbar_hshaft=skin_sb_hshaft.bmp +skin_scrollbar_vshaft=skin_sb_vshaft.bmp +skin_scrollbar_hthumb=skin_sb_hthumb.bmp +skin_scrollbar_vthumb=skin_sb_vthumb.bmp +skin_scrollbar_arrows=skin_sb_arrows.bmp + +#for border +skin_tborder=skin_tborder.bmp +skin_bborder=skin_bborder.bmp +skin_lborder=skin_lborder.bmp +skin_rborder=skin_rborder.bmp + +skin_arrows=skin_arrows.gif +skin_arrows_shell=skin_arrows_shell.bmp + +skin_pushbtn=skin_pushbtn.gif +skin_radiobtn=skin_radiobtn.gif +skin_checkbtn=skin_checkbtn.bmp + +#for treeview +skin_tree=skin_tree.bmp + +skin_header=skin_header.bmp +skin_tab=skin_tab.gif + +#for trackbar +skin_tbslider_h=skin_tbslider_h.gif +skin_tbslider_v=skin_tbslider_v.gif +skin_trackbar_horz=skin_tb_horz.gif +skin_trackbar_vert=skin_tb_vert.gif + +#for progressbar +skin_progressbar_htrack=skin_pb_htrack.gif +skin_progressbar_vtrack=skin_pb_vtrack.gif +skin_progressbar_hchunk=skin_pb_htruck.bmp +skin_progressbar_vchunk=skin_pb_vtruck.bmp +#}} + + +[fashion] +# Note that max number defined in source code is 5. +iconnumber=5 +icon0=form.ico +icon1=failed.ico +icon2=help.ico +icon3=warning.ico +icon4=excalmatory.ico + +# default icons for new OpenFileDialogBox +dir=folder.ico +file=textfile.ico + +# default icons for TreeView control +treefold=fold.ico +treeunfold=unfold.ico + +# bitmap used by BUTTON control +radiobutton=fashion_radio_btn.bmp +checkbutton=fashion_check_btn.bmp + +# background picture, use your favirate photo +bgpicture=none +bgpicpos=center + +#window element metrics +caption=25 +menu=25 +border=1 +scrollbar=17 + +fgc_active_caption=0xFFFFFFFF +bgca_active_caption=0xFFE35400 +bgcb_active_caption=0xFFFF953D + +fgc_menu=0xFF000000 +bgc_menu=0xFFFFE4BF + +fgc_msgbox=0xFF000000 + +fgc_tip=0xFF000000 +bgc_tip=0xFFFFFFFF + +fgc_active_border=0xFFC8D0D4 +fgc_inactive_border=0xFFC8D0D4 + +fgc_inactive_caption=0xFFF8E4D8 +bgca_inactive_caption=0xFFDF967A +bgcb_inactive_caption=0xFFEBB99D + +fgc_window=0xFF000000 +bgc_window=0xFFEBB99D + +fgc_3dbox=0xFF000000 +mainc_3dbox=0xFFD8E9EC + +fgc_selected_item=0xFFFFFFFF +bgc_selected_item=0xFFC56A31 +bgc_selected_lostfocus=0xFFD8E9EC + +fgc_disabled_item=0xFF99A8AC +bgc_disabled_item=0xFFFFFFFF + +fgc_hilight_item=0xFFFFFFFF +bgc_hilight_item=0xFFC56A31 + +fgc_significant_item=0xFFFFFFFF +bgc_significant_item=0xFFC56A31 + +bgc_desktop=0xFF984E00 + diff --git a/include/common.h b/include/common.h index 052f9045..d72a312c 100644 --- a/include/common.h +++ b/include/common.h @@ -8,10 +8,10 @@ * \verbatim - Copyright (C) 2002-2009 Feynman Software. + Copyright (C) 2002-2012 FMSoft. Copyright (C) 1998-2002 Wei Yongming. - All rights reserved by Feynman Software. + All rights reserved by FMSoft (http://www.fmsoft.cn). This file is part of MiniGUI, a compact cross-platform Graphics User Interface (GUI) support system for real-time embedded systems. @@ -25,7 +25,7 @@ * MiniGUI for Linux/uClinux, eCos, uC/OS-II, VxWorks, * pSOS, ThreadX, NuCleus, OSE, and Win32. * - * Copyright (C) 2002-2009 Feynman Software. + * Copyright (C) 2002-2012 FMSoft. * Copyright (C) 1998-2002 Wei Yongming. * * The definitions of some data types and byte order macros diff --git a/include/control.h b/include/control.h index 1d3cf0a7..b91289fe 100644 --- a/include/control.h +++ b/include/control.h @@ -7,10 +7,10 @@ * \verbatim - Copyright (C) 2002-2009 Feynman Software. + Copyright (C) 2002-2012 FMSoft. Copyright (C) 1998-2002 Wei Yongming. - All rights reserved by Feynman Software. + All rights reserved by FMSoft (http://www.fmsoft.cn). This file is part of MiniGUI, a compact cross-platform Graphics User Interface (GUI) support system for real-time embedded systems. @@ -24,7 +24,7 @@ * MiniGUI for Linux/uClinux, eCos, uC/OS-II, VxWorks, * pSOS, ThreadX, NuCleus, OSE, and Win32. * - * Copyright (C) 2002-2009 Feynman Software. + * Copyright (C) 2002-2012 FMSoft. * Copyright (C) 1999-2002 Wei Yongming. */ diff --git a/include/customial.h b/include/customial.h index 5fbae672..c9dddea6 100644 --- a/include/customial.h +++ b/include/customial.h @@ -1,12 +1,30 @@ +/** + * \file customial.h + * \author Wei Yongming + * \date 2007/06/06 + * + * This file is the head file for Custom IAL Engine. + * + \verbatim + + Copyright (C) 2007-2012 FMSoft. + + All rights reserved by FMSoft (http://www.fmsoft.cn). + + This file is part of MiniGUI, a compact cross-platform Graphics + User Interface (GUI) support system for real-time embedded systems. + + \endverbatim + */ + /* -** $Id: customial.h 11349 2009-03-02 05:00:43Z weiym $ -** -** custom.h:. the head file for Custom IAL Engine. -** -** Copyright (C) 2007 ~ 2009 Feynman Software. -** -** Created by Wei YongMing, 2007/06/06 -*/ + * $Id: customial.h 11349 2009-03-02 05:00:43Z weiym $ + * + * MiniGUI for Linux/uClinux, eCos, uC/OS-II, VxWorks, + * pSOS, ThreadX, NuCleus, OSE, and Win32. + * + * Copyright (C) 2007-2012 FMSoft. + */ #ifndef GUI_IAL_CUSTOM_H #define GUI_IAL_CUSTOM_H diff --git a/include/endianrw.h b/include/endianrw.h index 225bc202..b25bf232 100644 --- a/include/endianrw.h +++ b/include/endianrw.h @@ -10,10 +10,10 @@ * \verbatim - Copyright (C) 2002-2009 Feynman Software. + Copyright (C) 2002-2012 FMSoft. Copyright (C) 1998-2002 Wei Yongming. - All rights reserved by Feynman Software. + All rights reserved by FMSoft. This file is part of MiniGUI, a compact cross-platform Graphics User Interface (GUI) support system for real-time embedded systems. @@ -27,7 +27,7 @@ * MiniGUI for Linux/uClinux, eCos, uC/OS-II, VxWorks, * pSOS, ThreadX, NuCleus, OSE, and Win32. * - * Copyright (C) 2002-2009 Feynman Software. + * Copyright (C) 2002-2012 FMSoft. * Copyright (C) 1998-2002 Wei Yongming. * * The idea comes from LGPL'ed SDL by Sam Lantinga. diff --git a/include/fixedmath.h b/include/fixedmath.h index 4c5e7e99..c4943f9c 100644 --- a/include/fixedmath.h +++ b/include/fixedmath.h @@ -7,10 +7,10 @@ * \verbatim - Copyright (C) 2002-2009 Feynman Software. + Copyright (C) 2002-2012 FMSoft. Copyright (C) 1998-2002 Wei Yongming. - All rights reserved by Feynman Software. + All rights reserved by FMSoft (http://www.fmsoft.cn). This file is part of MiniGUI, a compact cross-platform Graphics User Interface (GUI) support system for real-time embedded systems. @@ -24,7 +24,7 @@ * MiniGUI for Linux/uClinux, eCos, uC/OS-II, VxWorks, * pSOS, ThreadX, NuCleus, OSE, and Win32. * - * Copyright (C) 2002-2009 Feynman Software. + * Copyright (C) 2002-2012 FMSoft. * Copyright (C) 1998-2002 Wei Yongming. * * Fixed-point math routins come from Allegro (a gift software) diff --git a/include/gdi.h b/include/gdi.h index 4a0e0e63..9ce6d487 100644 --- a/include/gdi.h +++ b/include/gdi.h @@ -7,10 +7,10 @@ * \verbatim - Copyright (C) 2002-2009 Feynman Software. + Copyright (C) 2002-2012 FMSoft. Copyright (C) 1998-2002 Wei Yongming. - All rights reserved by Feynman Software. + All rights reserved by FMSoft (http://www.fmsoft.cn). This file is part of MiniGUI, a compact cross-platform Graphics User Interface (GUI) support system for real-time embedded systems. @@ -24,7 +24,7 @@ * MiniGUI for Linux/uClinux, eCos, uC/OS-II, VxWorks, * pSOS, ThreadX, NuCleus, OSE, and Win32. * - * Copyright (C) 2002-2009 Feynman Software. + * Copyright (C) 2002-2012 FMSoft. * Copyright (C) 1998-2002 Wei Yongming. */ @@ -2311,7 +2311,7 @@ MG_EXPORT int GUIAPI SetRasterOperation (HDC hdc, int rop); * * \sa SetPalette */ -MG_EXPORT BOOL GUIAPI GetPalette (HDC hdc, int start, int len, GAL_Color* cmap); +MG_EXPORT int GUIAPI GetPalette (HDC hdc, int start, int len, GAL_Color* cmap); /** * \fn BOOL GUIAPI SetPalette (HDC hdc, int start, int len, GAL_Color* cmap) @@ -7419,6 +7419,9 @@ struct _BITMAP /*void* bmAlphaPixelFormat;*/ /** The Alpha Mask array of the bitmap */ Uint8* bmAlphaMask; + + /** The Alpha Pitch of the bitmap */ + Uint32 bmAlphaPitch; }; /** @} end of bmp_struct */ @@ -8018,6 +8021,11 @@ MG_EXPORT void GUIAPI ExpandMonoBitmap (HDC hdc, BYTE* bits, Uint32 pitch, const BYTE* my_bits, Uint32 my_pitch, Uint32 w, Uint32 h, DWORD flags, Uint32 bg, Uint32 fg); +MG_EXPORT void GUIAPI Expand16CBitmapEx (HDC hdc, BYTE* bits, Uint32 pitch, + const BYTE* my_bits, Uint32 my_pitch, + Uint32 w, Uint32 h, DWORD flags, + const RGB* pal, BYTE use_pal_alpha, BYTE alpha); + /** * \fn void GUIAPI Expand16CBitmap (HDC hdc, BYTE* bits, Uint32 pitch, * const BYTE* my_bits, Uint32 my_pitch, @@ -8039,12 +8047,21 @@ MG_EXPORT void GUIAPI ExpandMonoBitmap (HDC hdc, BYTE* bits, Uint32 pitch, * * \sa ExpandMonoBitmap, Expand256CBitmap */ -MG_EXPORT void GUIAPI Expand16CBitmap (HDC hdc, BYTE* bits, Uint32 pitch, +static inline void GUIAPI Expand16CBitmap (HDC hdc, BYTE* bits, Uint32 pitch, const BYTE* my_bits, Uint32 my_pitch, - Uint32 w, Uint32 h, DWORD flags, const RGB* pal); - + Uint32 w, Uint32 h, DWORD flags, const RGB* pal) +{ + Expand16CBitmapEx (hdc, bits, pitch, my_bits, my_pitch, + w, h, flags, pal, FALSE, 0xFF); +} + +MG_EXPORT void GUIAPI Expand256CBitmapEx (HDC hdc, BYTE* bits, Uint32 pitch, + const BYTE* my_bits, Uint32 my_pitch, + Uint32 w, Uint32 h, DWORD flags, + const RGB* pal, BYTE use_pal_alpha, BYTE alpha, + CB_DRAW_PIXEL cb_draw, MYBITMAP_CONTXT* mybmp); /** - * \fn void GUIAPI Expand16CBitmap (HDC hdc, BYTE* bits, Uint32 pitch, + * \fn void GUIAPI Expand256CBitmap (HDC hdc, BYTE* bits, Uint32 pitch, * const BYTE* my_bits, Uint32 my_pitch, * Uint32 w, Uint32 h, DWORD flags, const RGB* pal, * CB_DRAW_PIXEL cb_draw, MYBITMAP_CONTXT* mybmp); @@ -8067,10 +8084,14 @@ MG_EXPORT void GUIAPI Expand16CBitmap (HDC hdc, BYTE* bits, Uint32 pitch, * * \sa ExpandMonoBitmap, Expand16CBitmap */ -MG_EXPORT void GUIAPI Expand256CBitmap (HDC hdc, BYTE* bits, Uint32 pitch, +static inline void GUIAPI Expand256CBitmap (HDC hdc, BYTE* bits, Uint32 pitch, const BYTE* my_bits, Uint32 my_pitch, - Uint32 w, Uint32 h, DWORD flags, const RGB* pal, - CB_DRAW_PIXEL cb_draw, MYBITMAP_CONTXT* mybmp); + Uint32 w, Uint32 h, DWORD flags, const RGB* pal, + CB_DRAW_PIXEL cb_draw, MYBITMAP_CONTXT* mybmp) +{ + Expand256CBitmapEx (hdc, bits, pitch, my_bits, my_pitch, + w, h, flags, pal, FALSE, 0xFF, cb_draw, mybmp); +} /** * \fn void GUIAPI CompileRGBABitmap (HDC hdc, BYTE* bits, Uint32 pitch, \ @@ -8125,9 +8146,21 @@ MG_EXPORT void GUIAPI ExpandPartMonoBitmap (HDC hdc, BYTE* bits, Uint32 pitch, const BYTE* my_bits, Uint32 my_pitch, Uint32 w, Uint32 h, DWORD flags, Uint32 bg, Uint32 fg, int stepx, CB_DRAW_PIXEL cb_draw, MYBITMAP_CONTXT* mybmp); -MG_EXPORT void GUIAPI ExpandPart16CBitmap (HDC hdc, BYTE* bits, Uint32 pitch, const BYTE* my_bits, - Uint32 my_pitch, Uint32 w, Uint32 h, DWORD flags, const RGB* pal, - int stepx, CB_DRAW_PIXEL cb_draw, MYBITMAP_CONTXT* mybmp); + +MG_EXPORT void GUIAPI ExpandPart16CBitmapEx (HDC hdc, BYTE* bits, Uint32 pitch, + const BYTE* my_bits, Uint32 my_pitch, + Uint32 w, Uint32 h, DWORD flags, + const RGB* pal, BYTE use_pal_alpha, BYTE alpha, + int stepx, CB_DRAW_PIXEL cb_draw, MYBITMAP_CONTXT* mybmp); + +static inline void GUIAPI ExpandPart16CBitmap (HDC hdc, BYTE* bits, Uint32 pitch, + const BYTE* my_bits, Uint32 my_pitch, + Uint32 w, Uint32 h, DWORD flags, const RGB* pal, + int stepx, CB_DRAW_PIXEL cb_draw, MYBITMAP_CONTXT* mybmp) +{ + ExpandPart16CBitmapEx (hdc, bits, pitch, my_bits, my_pitch, + w, h, flags, pal, FALSE, 0xFF, stepx, cb_draw, mybmp); +} #endif diff --git a/include/minigui.h b/include/minigui.h index 85584a24..d0a992ab 100644 --- a/include/minigui.h +++ b/include/minigui.h @@ -7,10 +7,10 @@ * \verbatim - Copyright (C) 2002-2009 Feynman Software. + Copyright (C) 2002-2012 FMSoft. Copyright (C) 1998-2002 Wei Yongming. - All rights reserved by Feynman Software. + All rights reserved by FMSoft (http://www.fmsoft.cn). This file is part of MiniGUI, a compact cross-platform Graphics User Interface (GUI) support system for real-time embedded systems. @@ -24,7 +24,7 @@ * MiniGUI for Linux/uClinux, eCos, uC/OS-II, VxWorks, * pSOS, ThreadX, NuCleus, OSE, and Win32. * - * Copyright (C) 2002-2009 Feynman Software. + * Copyright (C) 2002-2012 FMSoft. * Copyright (C) 1998-2002 Wei Yongming. */ diff --git a/include/nucleus_pthread.h b/include/nucleus_pthread.h index 041d7d0e..0fe0cff6 100644 --- a/include/nucleus_pthread.h +++ b/include/nucleus_pthread.h @@ -12,9 +12,9 @@ * \verbatim - Copyright (C) 2005~2009 Feynman Software. + Copyright (C) 2005-2012 FMSoft. - All rights reserved by Feynman Software. + All rights reserved by FMSoft (http://www.fmsoft.cn). This file is part of MiniGUI, a compact cross-platform Graphics User Interface (GUI) support system for real-time embedded systems. @@ -38,7 +38,7 @@ * MiniGUI for Linux/uClinux, eCos, uC/OS-II, VxWorks, * pSOS, ThreadX, NuCleus, OSE, and Win32. * - * Copyright (C) 2005~2009 Feynman Software. + * Copyright (C) 2005-2012 FMSoft. */ #ifndef FMNU_PTHREAD_H diff --git a/include/nucleus_semaphore.h b/include/nucleus_semaphore.h index a3086831..bb9a5e67 100644 --- a/include/nucleus_semaphore.h +++ b/include/nucleus_semaphore.h @@ -12,9 +12,9 @@ * \verbatim - Copyright (C) 2005~2009 Feynman Software. + Copyright (C) 2005~2012 FMSoft. - All rights reserved by Feynman Software. + All rights reserved by FMSoft (http://www.fmsoft.cn). This file is part of MiniGUI, a compact cross-platform Graphics User Interface (GUI) support system for real-time embedded systems. @@ -37,7 +37,7 @@ * MiniGUI for Linux/uClinux, eCos, uC/OS-II, VxWorks, * pSOS, ThreadX, NuCleus, OSE, and Win32. * - * Copyright (C) 2005~2009 Feynman Software. + * Copyright (C) 2005~2012 FMSoft. */ #ifndef FMNU_SEMAPHORE_H diff --git a/include/ose_semaphore.h b/include/ose_semaphore.h index e1a101e7..04183ee1 100644 --- a/include/ose_semaphore.h +++ b/include/ose_semaphore.h @@ -1,6 +1,6 @@ /* * \file ose_semaphore.h - * \author Qingzhou Long + * \author Wei Yongming * \date 2006/05/19 * * Description: @@ -12,9 +12,9 @@ * \verbatim - Copyright (C) 2005-2009 Feynman Software. + Copyright (C) 2005-2012 FMSoft. - All rights reserved by Feynman Software. + All rights reserved by FMSoft (http://www.fmsoft.cn). This file is part of MiniGUI, a compact cross-platform Graphics User Interface (GUI) support system for real-time embedded systems. @@ -37,7 +37,7 @@ * MiniGUI for Linux/uClinux, eCos, uC/OS-II, VxWorks, * pSOS, ThreadX, NuCleus, OSE, and Win32. * - * Copyright (C) 2005-2009 Feynman Software. + * Copyright (C) 2005-2012 FMSoft. */ #ifndef FMOSE_SEMAPHORE_H diff --git a/include/own_stdio.h b/include/own_stdio.h index 27cd578a..1b3b5567 100644 --- a/include/own_stdio.h +++ b/include/own_stdio.h @@ -7,10 +7,10 @@ * \verbatim - Copyright (C) 2002-2009 Feynman Software. + Copyright (C) 2002-2012 FMSoft. Copyright (C) 1998-2002 Wei Yongming. - All rights reserved by Feynman Software. + All rights reserved by FMSoft (http://www.fmsoft.cn). This file is part of MiniGUI, a compact cross-platform Graphics User Interface (GUI) support system for real-time embedded systems. @@ -24,7 +24,7 @@ * MiniGUI for Linux/uClinux, eCos, uC/OS-II, VxWorks, * pSOS, ThreadX, NuCleus, OSE, and Win32. * - * Copyright (C) 2002-2009 Feynman Software. + * Copyright (C) 2002-2012 FMSoft. * Copyright (C) 1998-2002 Wei Yongming. */ diff --git a/include/psos.h b/include/psos.h index 2bb6f0ef..8c017150 100644 --- a/include/psos.h +++ b/include/psos.h @@ -10,9 +10,9 @@ * \verbatim - Copyright (C) 2008-2009 Feynman Software. + Copyright (C) 2008-2012 FMSoft. - All rights reserved by Feynman Software. + All rights reserved by FMSoft (http://www.fmsoft.cn). This file is part of MiniGUI, a compact cross-platform Graphics User Interface (GUI) support system for real-time embedded systems. @@ -21,14 +21,14 @@ */ /* - * $Id: psos_pthread.h 7183 2007-05-16 08:19:34Z weiym $ + * $Id: psos.h 7183 2007-05-16 08:19:34Z weiym $ * - * This is the pSOS+ header file () written by Feynman Software. + * This is the pSOS+ header file () written by FMSoft. * * MiniGUI for Linux/uClinux, eCos, uC/OS-II, VxWorks, * pSOS, ThreadX, NuCleus, OSE, and Win32. * - * Copyright (C) 2008-2009 Feynman Software. + * Copyright (C) 2008-2012 FMSoft. */ #ifndef _PSOS_H diff --git a/include/psos_pthread.h b/include/psos_pthread.h index 7ae3b5df..4beef032 100644 --- a/include/psos_pthread.h +++ b/include/psos_pthread.h @@ -12,9 +12,9 @@ * \verbatim - Copyright (C) 2008-2009 Feynman Software. + Copyright (C) 2008-2012 FMSoft. - All rights reserved by Feynman Software. + All rights reserved by FMSoft (http://www.fmsoft.cn). This file is part of MiniGUI, a compact cross-platform Graphics User Interface (GUI) support system for real-time embedded systems. @@ -37,7 +37,7 @@ * MiniGUI for Linux/uClinux, eCos, uC/OS-II, VxWorks, * pSOS, ThreadX, NuCleus, OSE, and Win32. * - * Copyright (C) 2008-2009 Feynman Software. + * Copyright (C) 2008-2012 FMSoft. */ #ifndef FM_PSOS_PTHREAD_H diff --git a/include/psos_semaphore.h b/include/psos_semaphore.h index 3cae67b8..6d0a2b2f 100644 --- a/include/psos_semaphore.h +++ b/include/psos_semaphore.h @@ -12,9 +12,9 @@ * \verbatim - Copyright (C) 2008-2009 Feynman Software. + Copyright (C) 2008-2012 FMSoft. - All rights reserved by Feynman Software. + All rights reserved by FMSoft (http://www.fmsoft.cn). This file is part of MiniGUI, a compact cross-platform Graphics User Interface (GUI) support system for real-time embedded systems. @@ -37,7 +37,7 @@ * MiniGUI for Linux/uClinux, eCos, uC/OS-II, VxWorks, * pSOS, ThreadX, NuCleus, OSE, and Win32. * - * Copyright (C) 2008-2009 Feynman Software. + * Copyright (C) 2008-2012 FMSoft. */ #ifndef FM_PSOS_SEMAPHORE_H diff --git a/include/threadx_pthread.h b/include/threadx_pthread.h index b40e79f3..da07e9b3 100644 --- a/include/threadx_pthread.h +++ b/include/threadx_pthread.h @@ -12,9 +12,9 @@ * \verbatim - Copyright (C) 2005~2009 Feynman Software. + Copyright (C) 2005~2012 FMSoft. - All rights reserved by Feynman Software. + All rights reserved by FMSoft (http://www.fmsoft.cn). This file is part of MiniGUI, a compact cross-platform Graphics User Interface (GUI) support system for real-time embedded systems. @@ -37,7 +37,7 @@ * MiniGUI for Linux/uClinux, eCos, uC/OS-II, VxWorks, * pSOS, ThreadX, NuCleus, OSE, and Win32. * - * Copyright (C) 2005~2009 Feynman Software. + * Copyright (C) 2005~2012 FMSoft. */ #ifndef FMTX_PTHREAD_H diff --git a/include/threadx_semaphore.h b/include/threadx_semaphore.h index c673a261..3eca7abb 100644 --- a/include/threadx_semaphore.h +++ b/include/threadx_semaphore.h @@ -12,9 +12,9 @@ * \verbatim - Copyright (C) 2005-2009 Feynman Software. + Copyright (C) 2005-2012 FMSoft. - All rights reserved by Feynman Software. + All rights reserved by FMSoft (http://www.fmsoft.cn). This file is part of MiniGUI, a compact cross-platform Graphics User Interface (GUI) support system for real-time embedded systems. @@ -37,7 +37,7 @@ * MiniGUI for Linux/uClinux, eCos, uC/OS-II, VxWorks, * pSOS, ThreadX, NuCleus, OSE, and Win32. * - * Copyright (C) 2005-2009 Feynman Software. + * Copyright (C) 2005-2012 FMSoft. */ #ifndef FMTX_SEMAPHORE_H diff --git a/include/ucos2_pthread.h b/include/ucos2_pthread.h index 21af139b..ec8a8ee9 100644 --- a/include/ucos2_pthread.h +++ b/include/ucos2_pthread.h @@ -8,9 +8,9 @@ * \verbatim - Copyright (C) 2004~2009 Feynman Software. + Copyright (C) 2004~2012 FMSoft. - All rights reserved by Feynman Software. + All rights reserved by FMSoft (http://www.fmsoft.cn). This file is part of MiniGUI, a compact cross-platform Graphics User Interface (GUI) support system for real-time embedded systems. @@ -24,7 +24,7 @@ * MiniGUI for Linux/uClinux, eCos, uC/OS-II, VxWorks, * pSOS, ThreadX, NuCleus, OSE, and Win32. * - * Copyright (C) 2004-2009 Feynman Software. + * Copyright (C) 2004-2012 FMSoft. */ #ifndef UCOSII_PTHREAD_H diff --git a/include/ucos2_semaphore.h b/include/ucos2_semaphore.h index 37526283..4b4ab05d 100644 --- a/include/ucos2_semaphore.h +++ b/include/ucos2_semaphore.h @@ -8,9 +8,9 @@ * \verbatim - Copyright (C) 2004~2009 Feynman Software. + Copyright (C) 2004~2012 FMSoft. - All rights reserved by Feynman Software. + All rights reserved by FMSoft (http://www.fmsoft.cn). This file is part of MiniGUI, a compact cross-platform Graphics User Interface (GUI) support system for real-time embedded systems. @@ -24,7 +24,7 @@ * MiniGUI for Linux/uClinux, eCos, uC/OS-II, VxWorks, * pSOS, ThreadX, NuCleus, OSE, and Win32. * - * Copyright (C) 2004-2009 Feynman Software. + * Copyright (C) 2004-2012 FMSoft. */ #ifndef UCOSII_SEMAPHORE_H diff --git a/include/vcongui.h b/include/vcongui.h index d55dca24..792887ee 100644 --- a/include/vcongui.h +++ b/include/vcongui.h @@ -8,10 +8,10 @@ * \verbatim - Copyright (C) 2002-2009 Feynman Software. + Copyright (C) 2002-2012 FMSoft. Copyright (C) 1998-2002 Wei Yongming. - All rights reserved by Feynman Software. + All rights reserved by FMSoft (http://www.fmsoft.cn). This file is part of MiniGUI, a compact cross-platform Graphics User Interface (GUI) support system for real-time embedded systems. @@ -25,7 +25,7 @@ * MiniGUI for Linux/uClinux, eCos, uC/OS-II, VxWorks, * pSOS, ThreadX, NuCleus, OSE, and Win32. * - * Copyright (C) 2002-2009 Feynman Software. + * Copyright (C) 2002-2012 FMSoft. * Copyright (C) 1998-2002 Wei Yongming. * * Some idea and source come from CCE (Console Chinese Environment) diff --git a/include/vxworks_pthread.h b/include/vxworks_pthread.h index 8c8a772b..8e138b26 100644 --- a/include/vxworks_pthread.h +++ b/include/vxworks_pthread.h @@ -11,9 +11,9 @@ * \verbatim - Copyright (C) 2005~2009 Feynman Software. + Copyright (C) 2005~2012 FMSoft. - All rights reserved by Feynman Software. + All rights reserved by FMSoft (http://www.fmsoft.cn). This file is part of MiniGUI, a compact cross-platform Graphics User Interface (GUI) support system for real-time embedded systems. @@ -37,7 +37,7 @@ * MiniGUI for Linux/uClinux, eCos, uC/OS-II, VxWorks, * pSOS, ThreadX, NuCleus, OSE, and Win32. * - * Copyright (C) 2005~2009 Feynman Software. + * Copyright (C) 2005~2012 FMSoft. */ #ifndef FMVX_PTHREAD_H diff --git a/include/vxworks_semaphore.h b/include/vxworks_semaphore.h index aa10186f..83701baf 100644 --- a/include/vxworks_semaphore.h +++ b/include/vxworks_semaphore.h @@ -12,9 +12,9 @@ * \verbatim - Copyright (C) 2005~2009 Feynman Software. + Copyright (C) 2005~2012 FMSoft. - All rights reserved by Feynman Software. + All rights reserved by FMSoft (http://www.fmsoft.cn). This file is part of MiniGUI, a compact cross-platform Graphics User Interface (GUI) support system for real-time embedded systems. @@ -37,7 +37,7 @@ * MiniGUI for Linux/uClinux, eCos, uC/OS-II, VxWorks, * pSOS, ThreadX, NuCleus, OSE, and Win32. * - * Copyright (C) 2005-2009 Feynman Software. + * Copyright (C) 2005-2012 FMSoft. */ #ifndef FMVX_SEMAPHORE_H diff --git a/include/window.h b/include/window.h index 940294ea..78b5cce8 100644 --- a/include/window.h +++ b/include/window.h @@ -7,10 +7,10 @@ * \verbatim - Copyright (C) 2002-2009 Feynman Software. + Copyright (C) 2002-2012 FMSoft. Copyright (C) 1998-2002 Wei Yongming. - All rights reserved by Feynman Software. + All rights reserved by FMSoft (http://www.fmsoft.cn). This file is part of MiniGUI, a compact cross-platform Graphics User Interface (GUI) support system for real-time embedded systems. @@ -24,7 +24,7 @@ * MiniGUI for Linux/uClinux, eCos, uC/OS-II, VxWorks, * pSOS, ThreadX, NuCleus, OSE, and Win32. * - * Copyright (C) 2002-2009 Feynman Software. + * Copyright (C) 2002-2012 FMSoft. * Copyright (C) 1998-2002 Wei Yongming. */ @@ -491,6 +491,27 @@ extern "C" { */ #define MSG_SYSKEYUP 0x0015 + +/* keyboard longpress supported */ + +/** + * \def MSG_KEYLONGPRESS + * \brief A key is long pressed. + * + * This message is sent when a key is pressed exceed user-defined long + * time value. + */ +#define MSG_KEYLONGPRESS 0x0016 + +/** + * \def MSG_KEYALWAYSPRESS + * \brief A key is always pressed. + * + * This message is sent when a key is pressed to exceed user-defined + * always time value. + */ +#define MSG_KEYALWAYSPRESS 0x0017 + /** * \def MSG_KEYSYM * \brief A key symbol translated from MSG_KEYDOWN messages. @@ -516,27 +537,7 @@ extern "C" { * * \sa MSG_SYSCHAR, TranslateMessage, key_defs */ -#define MSG_KEYSYM 0x0016 - -/* keyboard longpress supported */ - -/** - * \def MSG_KEYLONGPRESS - * \brief A key is long pressed. - * - * This message is sent when a key is pressed exceed user-defined long - * time value. - */ -#define MSG_KEYLONGPRESS 0x0017 - -/** - * \def MSG_KEYALWAYSPRESS - * \brief A key is always pressed. - * - * This message is sent when a key is pressed to exceed user-defined - * always time value. - */ -#define MSG_KEYALWAYSPRESS 0x0018 +#define MSG_KEYSYM 0x0018 /** * \def DEF_LPRESS_TIME @@ -1266,9 +1267,11 @@ extern unsigned int __mg_interval_time; * * \code * MSG_ERASEBKGND + * HDC hdc = (HDC)wParam; * const RECT* inv_rect = (const RECT*)lParam; * \endcode * + * \param hdc The device context. * \param inv_rect The pointer to a RECT structure contains the rectangle * should be erase. The rectangle is in client coordinates system. * If it is NULL, the whole client area should be erased. @@ -1293,6 +1296,17 @@ extern unsigned int __mg_interval_time; /** * \def MSG_NCPAINT * \brief Indicates that paints non-client area. + * + * \code + * MSG_NCPAINT + * HDC hdc = (HDC)wParam; + * const RECT* inv_rect = (const RECT*)lParam; + * \endcode + * + * \param hdc The device context. + * \param inv_rect The pointer to a RECT structure contains the rectangle + * should be paint. The rectangle is in client coordinates system. + * If it is NULL, the whole nc client area should be paint. */ #define MSG_NCPAINT 0x00B2 @@ -1504,7 +1518,6 @@ extern unsigned int __mg_interval_time; #define MSG_DT_KEYUP 0x00EA #define MSG_DT_SYSKEYDOWN 0x00EB - #define MSG_DT_SYSKEYUP 0x00ED #define MSG_DT_SYSCHAR 0x00EC diff --git a/include/xvfb.h b/include/xvfb.h index e6cc1963..081f381e 100644 --- a/include/xvfb.h +++ b/include/xvfb.h @@ -1,16 +1,16 @@ /** * \file xvfb.h - * \author Feynman Software + * \author FMSoft * \date 2007/10/25 * * This file includes global and miscellaneous interfaces of xVFB for MiniGUI. * \verbatim - Copyright (C) 2002-2009 Feynman Software. + Copyright (C) 2002-2012 FMSoft. Copyright (C) 1998-2002 Wei Yongming. - All rights reserved by Feynman Software. + All rights reserved by FMSoft (http://www.fmsoft.cn). This file is part of MiniGUI, a compact cross-platform Graphics User Interface (GUI) support system for real-time embedded systems. @@ -24,7 +24,7 @@ * MiniGUI for Linux/uClinux, eCos, uC/OS-II, VxWorks, * pSOS, ThreadX, NuCleus, OSE, and Win32. * - * Copyright (C) 2002-2009 Feynman Software. + * Copyright (C) 2002-2012 FMSoft. * Copyright (C) 1998-2002 Wei Yongming. */ diff --git a/make_tarball b/make_tarball index a5b199ba..0df1a720 100755 --- a/make_tarball +++ b/make_tarball @@ -1,12 +1,12 @@ #!/bin/bash -SOURCE_DIR=libminigui-3.0.10 -DEST_DIR=libminigui-3.0.10 +SOURCE_DIR=libminigui-3.0.12 +DEST_DIR=libminigui-3.0.12 . .config if [ "$PACK_OS_LINUX" = "n" ]; then - DEST_DIR=libminigui-3.0.10 + DEST_DIR=libminigui-3.0.12 fi [ -f ".config" ] || { diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 93545997..bb246752 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -75,15 +75,9 @@ endif () if (ZLIB_FOUND) include_directories ("${ZLIB_INCLUDE_DIR}") endif () -if (PNG_FOUND) - include_directories ("${PNG_INCLUDE_DIR}") -endif () if (JPEG_FOUND) include_directories ("${JPEG_INCLUDE_DIR}") endif () -if (FREETYPE_FOUND) - include_directories ("${FREETYPE_INCLUDE_DIR_ft2build}" "${FREETYPE_INCLUDE_DIR_freetype2}") -endif () # license picture IF (license_splash OR license_screensaver OR license_productid) @@ -104,9 +98,38 @@ ENDIF (license_splash OR license_screensaver OR license_productid) # add minigui library set (MINIGUI_LIBNAME ${MINIGUI_NAME}_${MGLIB_SUFFIX}) -add_library (${MINIGUI_LIBNAME} SHARED ${_source_list_}) -set_target_properties (${MINIGUI_LIBNAME} PROPERTIES VERSION ${MINIGUI_VERSION} SOVERSION ${MINIGUI_SOVERSION}) -set_target_properties (${MINIGUI_LIBNAME} PROPERTIES CLEAN_DIRECT_OUTPUT 1) +################################# target ################################### +# !!! to install dynamic library (.DLL) and import library (.lib) !!! +# !!! in WIN32 we should use !!! +# !!! *RUNTIME* and *ARCHIVE* to set the DESTINATION of the lib !!! +if (_SHAREDLIB_OUTPUT) + add_library (${MINIGUI_LIBNAME} SHARED ${_source_list_}) + set_target_properties (${MINIGUI_LIBNAME} PROPERTIES VERSION ${MINIGUI_VERSION} SOVERSION ${MINIGUI_SOVERSION}) + set_target_properties (${MINIGUI_LIBNAME} PROPERTIES CLEAN_DIRECT_OUTPUT 1) + if (WIN32) + if (PTHREAD_FOUND) + target_link_libraries(${MINIGUI_LIBNAME} "${PTHREAD_LIBRARY}") + endif () + if (ZLIB_FOUND) + target_link_libraries(${MINIGUI_LIBNAME} "${ZLIB_LIBRARY}") + endif () + if (PNG_FOUND) + target_link_libraries(${MINIGUI_LIBNAME} ${PNG_LIBRARIES}) + endif () + if (JPEG_FOUND) + target_link_libraries(${MINIGUI_LIBNAME} "${JPEG_LIBRARY}") + endif () + if (FREETYPE_FOUND) + target_link_libraries(${MINIGUI_LIBNAME} ${FREETYPE_LIBRARIES}) + endif () + endif (WIN32) + + install (TARGETS ${MINIGUI_LIBNAME} + LIBRARY DESTINATION lib # for .so (dynamic library) + ARCHIVE DESTINATION lib # for .lib (import library) + RUNTIME DESTINATION bin # for .dll (dynamic library) + ) +endif (_SHAREDLIB_OUTPUT) if (_STATICLIB_OUTPUT) add_library (${MINIGUI_LIBNAME}_static ${_source_list_}) @@ -114,39 +137,8 @@ if (_STATICLIB_OUTPUT) set_target_properties (${MINIGUI_LIBNAME}_static PROPERTIES OUTPUT_NAME ${MINIGUI_LIBNAME}) endif(NOT WIN32) set_target_properties (${MINIGUI_LIBNAME}_static PROPERTIES CLEAN_DIRECT_OUTPUT 1) -endif(_STATICLIB_OUTPUT) -if (WIN32) - if (PTHREAD_FOUND) - target_link_libraries(${MINIGUI_LIBNAME} "${PTHREAD_LIBRARY}") - endif () - if (ZLIB_FOUND) - target_link_libraries(${MINIGUI_LIBNAME} "${ZLIB_LIBRARY}") - endif () - if (PNG_FOUND) - target_link_libraries(${MINIGUI_LIBNAME} "${PNG_LIBRARY}") - endif () - if (JPEG_FOUND) - target_link_libraries(${MINIGUI_LIBNAME} "${JPEG_LIBRARY}") - endif () - if (FREETYPE_FOUND) - target_link_libraries(${MINIGUI_LIBNAME} "${FREETYPE_LIBRARY}") - endif () -endif (WIN32) - -################################# target to install ################################### -# !!! to install dynamic library (.DLL) and import library (.lib) !!! -# !!! in WIN32 we should use !!! -# !!! *RUNTIME* and *ARCHIVE* to set the DESTINATION of the lib !!! -install (TARGETS ${MINIGUI_LIBNAME} - DESTINATION lib # for all below - # LIBRARY DESTINATION lib # for .so (dynamic library) - # RUNTIME DESTINATION lib # for .DLL (dynamic library) - # ARCHIVE DESTINATION lib # for .lib (import library) - ) - -if (_STATICLIB_OUTPUT) install (TARGETS ${MINIGUI_LIBNAME}_static ARCHIVE DESTINATION lib ) -endif (_STATICLIB_OUTPUT) +endif(_STATICLIB_OUTPUT) diff --git a/src/control/edit.c b/src/control/edit.c index a492be52..3e298b05 100644 --- a/src/control/edit.c +++ b/src/control/edit.c @@ -827,6 +827,28 @@ sleInsertText_refresh (HWND hWnd, return 0; } +static int sleCaseText (char* txt, BOOL bupper) +{ + char *str; + char (*tocase)(char); + + if (NULL == txt) + return -1; + + if (bupper) + tocase = (char(*)(char))toupper; + else + tocase = (char(*)(char))tolower; + + str = txt; + while (*str != '\0') { + str[0] = tocase(str[0]); + str ++; + } + + return 0; +} + #ifdef _MGHAVE_CLIPBOARD static int sleInsertCbText (HWND hWnd, PSLEDITDATA sled) { @@ -840,6 +862,13 @@ static int sleInsertCbText (HWND hWnd, PSLEDITDATA sled) inserting = GetClipBoardDataLen (CBNAME_TEXT); txtBuffer = ALLOCATE_LOCAL (inserting); GetClipBoardData (CBNAME_TEXT, txtBuffer, inserting); + txtBuffer[inserting]=0; + + if (GetWindowStyle(hWnd) & ES_UPPERCASE) + sleCaseText((char *)txtBuffer, TRUE); + else if (GetWindowStyle(hWnd) & ES_LOWERCASE) + sleCaseText((char *)txtBuffer, FALSE); + sleInsertText (hWnd, sled, (char *)txtBuffer, inserting); DEALLOCATE_LOCAL(txtBuffer); diff --git a/src/control/static.c b/src/control/static.c index edfa98c9..dbf22dfe 100644 --- a/src/control/static.c +++ b/src/control/static.c @@ -94,9 +94,9 @@ StaticControlProc (HWND hwnd, int message, WPARAM wParam, LPARAM lParam) GetClientRect (hwnd, &rcClient); dwStyle = GetWindowStyle (hwnd); if (dwStyle & WS_DISABLED) - SetTextColor (hdc, GetWindowElementPixel (hwnd, WE_FGC_DISABLED_ITEM)); + SetTextColor (hdc, GetWindowElementPixelEx (hwnd, hdc, WE_FGC_DISABLED_ITEM)); else - SetTextColor (hdc, GetWindowElementPixel (hwnd, WE_FGC_WINDOW)); + SetTextColor (hdc, GetWindowElementPixelEx (hwnd, hdc, WE_FGC_WINDOW)); // DK[11/01/2010]: For fix bug 4336 switch (dwStyle & SS_TYPEMASK) diff --git a/src/font/bitmapfont.c b/src/font/bitmapfont.c index 42950f4f..043d1dcb 100644 --- a/src/font/bitmapfont.c +++ b/src/font/bitmapfont.c @@ -240,6 +240,7 @@ get_glyph_prbitmap (LOGFONT* logfont, DEVFONT* devfont, bmp->bmColorKey = 0; bmp->bmAlpha = 0; bmp->bmAlphaMask = NULL; + bmp->bmAlphaPitch = 0; bmp->bmBits = def_glyph; bmp->bmWidth = 0; bmp->bmHeight = 0; @@ -265,6 +266,11 @@ get_glyph_prbitmap (LOGFONT* logfont, DEVFONT* devfont, bmp->bmBits += node->glyph_width * (glyph_value - node->min) * node->data->bmBytesPerPixel; + if(node->data->bmAlphaMask) { + bmp->bmAlphaMask = node->data->bmAlphaMask + node->glyph_width * (glyph_value - node->min); + bmp->bmAlphaPitch = node->data->bmAlphaPitch; + } + _MG_PRINTF ("FONT>Bitmap: bmp's bytes/pixel = %d\n", node->data->bmBytesPerPixel); _MG_PRINTF ("FONT>Bitmap: bmp->bmWidth = %d, bmp->bmHeight = %d.\n", bmp->bmWidth, bmp->bmHeight); diff --git a/src/font/devfont.c b/src/font/devfont.c index 7ab0dc2c..fb4dbc84 100644 --- a/src/font/devfont.c +++ b/src/font/devfont.c @@ -33,6 +33,8 @@ #include "varbitmap.h" #include "misc.h" +static void font_DelDevFont (const char* font_name); + /**************************** Global data ************************************/ static DEVFONT* sb_dev_font_head = NULL; static DEVFONT* mb_dev_font_head = NULL; @@ -337,9 +339,9 @@ void font_DelMBDevFont (DEVFONT* dev_font) tmp = mb_dev_font_head; while (tmp != NULL) { if (tmp == dev_font) { - if (prev != NULL) + if (prev != NULL) prev->next = tmp->next; - else + else mb_dev_font_head = tmp->next; nr_mb_dev_fonts --; @@ -616,6 +618,7 @@ BOOL font_TerminateIncoreFonts (void) } /* if font_name == NULL, delete all devfont */ +/* static void del_all_devfonts (void) { DEVFONT* tmp; @@ -625,9 +628,9 @@ static void del_all_devfonts (void) head = sb_dev_font_head; one_list: cur = head; - while (head) { - tmp = head; - head = tmp->next; + while (cur) { + tmp = cur; + cur = tmp->next; if (!tmp->relationship && tmp->need_unload) tmp->font_ops->unload_font_data (tmp->data); @@ -644,6 +647,7 @@ one_list: nr_sb_dev_fonts = 0; nr_mb_dev_fonts = 0; } +*/ static inline void del_devfont_from_list(const char* font_name, BOOL is_mbc_list) @@ -698,11 +702,11 @@ static inline void del_devfont_from_list(const char* font_name, BOOL is_mbc_list sb_dev_font_head = head; } -/*if font_name == NULL, delete all devfont*/ -void font_DelDevFont (const char* font_name) +static void font_DelDevFont (const char* font_name) { if (font_name == NULL) { - del_all_devfonts (); + /*if font_name == NULL, delete all devfont*/ + /*del_all_devfonts ();*/ return; } diff --git a/src/font/freetype2.c b/src/font/freetype2.c index d731e513..d9b6b42c 100644 --- a/src/font/freetype2.c +++ b/src/font/freetype2.c @@ -752,9 +752,13 @@ new_instance (LOGFONT* logfont, DEVFONT* devfont, BOOL need_sbc_font) ft_inst_info->image_type.width = logfont->size; ft_inst_info->image_type.height = logfont->size; ft_inst_info->image_type.face_id = (FTC_FaceID)ft_inst_info->ft_face_info; + + /* houhh 20110304, AUTOHINT will be get more clear + * and thin glyph. */ ft_inst_info->image_type.flags = FT_LOAD_DEFAULT | FT_LOAD_NO_BITMAP | - FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH | FT_LOAD_TARGET_NORMAL; + FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH | FT_LOAD_TARGET_NORMAL |FT_LOAD_FORCE_AUTOHINT; + //FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH | FT_LOAD_TARGET_NORMAL; /* if unmask non-cache and no rotation */ if (!(logfont->style & FS_OTHER_TTFNOCACHE) && diff --git a/src/font/logfont.c b/src/font/logfont.c index b372b186..e9f0a27a 100644 --- a/src/font/logfont.c +++ b/src/font/logfont.c @@ -64,9 +64,18 @@ static PLOGFONT gdiCreateLogFont (const char* type, const char* family, return INV_LOGFONT; } - if ((log_font = malloc (sizeof (LOGFONT))) == NULL) + /* + * fix "Invalid read of size 4" in mgncs + */ + //if ((log_font = (malloc (sizeof (LOGFONT))) == NULL) + if ((log_font = (PLOGFONT)malloc (sizeof (FONT_RES))) == NULL) return INV_LOGFONT; - + + /* + * fix "Invalid read of size 4" in mgncs + */ + ((FONT_RES *)log_font)->key = -1; + log_font->style = style; if (type) { diff --git a/src/gui/caret.c b/src/gui/caret.c index bb406b38..94c854fc 100644 --- a/src/gui/caret.c +++ b/src/gui/caret.c @@ -47,6 +47,7 @@ BOOL GUIAPI CreateCaret (HWND hWnd, PBITMAP pBitmap, int nWidth, int nHeight) pWin->pCaretInfo->caret_bmp.bmWidth = nWidth; pWin->pCaretInfo->caret_bmp.bmHeight = nHeight; pWin->pCaretInfo->caret_bmp.bmAlphaMask = NULL; + pWin->pCaretInfo->caret_bmp.bmAlphaPitch = 0; pWin->pCaretInfo->nBytesNr = GAL_GetBoxSize (__gal_screen, nWidth, nHeight, &pWin->pCaretInfo->caret_bmp.bmPitch); diff --git a/src/gui/dialog.c b/src/gui/dialog.c index ddc11eb5..335e25d9 100644 --- a/src/gui/dialog.c +++ b/src/gui/dialog.c @@ -147,38 +147,6 @@ int GUIAPI DialogBoxIndirectParamEx (PDLGTEMPLATE pDlgTemplate, int retCode = IDCANCEL; MSG Msg; -#if 0 - HWND hFocus; - MAINWINCREATE CreateInfo; - - if (pDlgTemplate->controlnr > 0 && !pDlgTemplate->controls) - return -1; - - hOwner = GetMainWindowHandle (hOwner); - - CreateInfo.dwReserved = (DWORD)pDlgTemplate; - - CreateInfo.dwStyle = pDlgTemplate->dwStyle & ~WS_VISIBLE; - CreateInfo.dwStyle |= WS_DLGFRAME; - CreateInfo.dwExStyle = pDlgTemplate->dwExStyle; - CreateInfo.spCaption = pDlgTemplate->caption; - CreateInfo.hMenu = pDlgTemplate->hMenu; - CreateInfo.hCursor = GetSystemCursor (IDC_ARROW); - CreateInfo.hIcon = pDlgTemplate->hIcon; - CreateInfo.MainWindowProc = DlgProc; - CreateInfo.lx = pDlgTemplate->x; - CreateInfo.ty = pDlgTemplate->y; - CreateInfo.rx = pDlgTemplate->x + pDlgTemplate->w; - CreateInfo.by = pDlgTemplate->y + pDlgTemplate->h; - CreateInfo.iBkColor = - GetWindowElementPixel (hOwner, WE_MAINC_THREED_BODY); - CreateInfo.dwAddData = (DWORD)pDlgTemplate->dwAddData; - CreateInfo.hHosting = hOwner; - - hDlg = CreateMainWindowEx (&CreateInfo, - werdr_name, we_attrs, window_name, layer_name); - -#endif if(hOwner && hOwner != HWND_INVALID && hOwner != HWND_DESKTOP) hOwner = GetMainWindowHandle(hOwner); @@ -190,6 +158,9 @@ int GUIAPI DialogBoxIndirectParamEx (PDLGTEMPLATE pDlgTemplate, if (hDlg == HWND_INVALID) return -1; + //MiniGUI maybe change dialog owner in CreateMainWindow, so we + //should update its owner by GetHosting. + hOwner = GetHosting (hDlg); SetWindowAdditionalData2 (hDlg, (DWORD)(&retCode)); if (hOwner && hOwner != HWND_DESKTOP) { diff --git a/src/gui/lf_manager.c b/src/gui/lf_manager.c index ec9493c3..30ab0745 100644 --- a/src/gui/lf_manager.c +++ b/src/gui/lf_manager.c @@ -842,8 +842,10 @@ BOOL mg_InitLFManager (void) } } +#ifdef WE_HEAP /** initialize window element block data heap.*/ init_we_heap(); +#endif return TRUE; } @@ -864,6 +866,8 @@ void mg_TerminateLFManager (void) #ifdef _MGRM_THREADS pthread_mutex_destroy (&gRendererMmutex); #endif +#ifdef WE_HEAP destroy_we_heap (); +#endif } diff --git a/src/gui/lf_skin.c b/src/gui/lf_skin.c index 0b02b20c..55e7e82c 100644 --- a/src/gui/lf_skin.c +++ b/src/gui/lf_skin.c @@ -316,13 +316,14 @@ static PBITMAP get_sub_bitmap (HDC hdc, const LFSKIN_BMPINFO *bmp_info) if (sub_bmp->bmType & BMP_TYPE_ALPHA_MASK) { pitch = ((w+3) & ~3); sub_bmp->bmAlphaMask = calloc(1, h * pitch); + sub_bmp->bmAlphaPitch = pitch; start_bits = full_bmp->bmAlphaMask - + h * bmp_info->idx_line * ((full_bmp->bmWidth+3)&~3) + + h * bmp_info->idx_line * full_bmp->bmAlphaPitch + w * bmp_info->idx_col; for (i = 0; i < h; i++) { memcpy (sub_bmp->bmAlphaMask + pitch*i, start_bits, w); - start_bits += ((full_bmp->bmWidth+3)&~3); + start_bits += full_bmp->bmAlphaPitch; } } @@ -1851,8 +1852,11 @@ static int calc_we_area (HWND hWnd, int which, RECT* we_area) cap_h = get_window_caption(hWnd); we_area->left = 0; we_area->right = win_w; - we_area->top = 0; - we_area->bottom = we_area->top + cap_h/* + border*/; + if (win_info->dwStyle & WS_CAPTION) + we_area->top = 0; + else + we_area->top = border; + we_area->bottom = we_area->top + cap_h; return 0; case HT_CLOSEBUTTON: @@ -1869,7 +1873,10 @@ static int calc_we_area (HWND hWnd, int which, RECT* we_area) menu_h = get_window_menubar(hWnd); we_area->left = border; - we_area->top = cap_h; + if (win_info->dwStyle & WS_CAPTION) + we_area->top = cap_h; + else + we_area->top = cap_h + border; we_area->right = win_w - border; we_area->bottom = we_area->top + menu_h; return 0; @@ -1879,10 +1886,10 @@ static int calc_we_area (HWND hWnd, int which, RECT* we_area) cap_h = get_window_caption (hWnd); menu_h = get_window_menubar (hWnd); - if (IsControl(hWnd)) - we_area->top = border + cap_h + menu_h; + if (win_info->dwStyle & WS_CAPTION) + we_area->top = cap_h + menu_h; else - we_area->top =/* border +*/ cap_h + menu_h; + we_area->top = border + cap_h + menu_h; we_area->bottom = win_h - border - get_window_scrollbar(hWnd, FALSE); @@ -2248,36 +2255,22 @@ static void draw_border (HWND hWnd, HDC hdc, BOOL is_active) bmp_info.flip = FALSE; bmp_info.style = LFSKIN_FILL_STRETCH; - if (border == 0) { - border += 3; - } + if (border == 0) border += 3; if (is_active) bmp_info.idx_line = 0; else bmp_info.idx_line = 1; - /************top*********************/ if (win_info->dwStyle & WS_CAPTION) cap_h = GetWindowElementAttr (hWnd, WE_METRICS_CAPTION); - else { - if (bitmaptop) - { - bmp_info.bmp = bitmaptop; - area.right = rect.right; - area.left = rect.left; - area.top = rect.top; - area.bottom = area.top + border; - draw_area_from_bitmap (hdc, &area, &bmp_info, FALSE); - } - } /*************left********************/ - if (bitmapleft){ + if (bitmapleft) { bmp_info.bmp = bitmapleft; area.left = rect.left; if (win_info->dwStyle & WS_CAPTION) - area.top = rect.top +/* border + */cap_h; + area.top = rect.top + cap_h; else area.top = rect.top + border + cap_h; area.right = area.left + border; @@ -2285,21 +2278,40 @@ static void draw_border (HWND hWnd, HDC hdc, BOOL is_active) draw_area_from_bitmap (hdc, &area, &bmp_info, FALSE); } /*************right*******************/ - if (bitmapright) - { + if (bitmapright) { bmp_info.bmp = bitmapright; area.right = rect.right; - area.left = area.right - border -1; + area.left = area.right - border; if (win_info->dwStyle & WS_CAPTION) - area.top = rect.top +/* border +*/ cap_h; + area.top = rect.top + cap_h; else area.top = rect.top + border + cap_h; area.bottom = rect.bottom - border; draw_area_from_bitmap (hdc, &area, &bmp_info, FALSE); } + + /************top*********************/ + if (!(win_info->dwStyle & WS_CAPTION) && bitmaptop) { + bmp_info.bmp = bitmaptop; + + bmp_info.nr_line = 2; + bmp_info.nr_col = 1; + bmp_info.idx_col = 0; + bmp_info.margin1 = 5; + bmp_info.margin2 = 5; + bmp_info.direct = FALSE; + bmp_info.flip = FALSE; + bmp_info.style = LFSKIN_FILL_TILE; + + area.right = rect.right; + area.left = rect.left; + area.top = rect.top; + area.bottom = area.top + border; + draw_area_from_bitmap (hdc, &area, &bmp_info, FALSE); + } + /************bottom*******************/ - if (bitmapbottom) - { + if (bitmapbottom) { bmp_info.bmp = bitmapbottom; bmp_info.nr_line = 2; @@ -2314,7 +2326,7 @@ static void draw_border (HWND hWnd, HDC hdc, BOOL is_active) area.right = rect.right; area.left = rect.left; area.bottom = rect.bottom; - area.top = area.bottom - border - 1; + area.top = area.bottom - border; draw_area_from_bitmap (hdc, &area, &bmp_info, FALSE); } diff --git a/src/gui/menu.c b/src/gui/menu.c index 0e782b04..770372a9 100644 --- a/src/gui/menu.c +++ b/src/gui/menu.c @@ -3568,9 +3568,12 @@ static void mnuTrackMenuWithKey (PTRACKMENUINFO ptmi, break; case SCANCODE_ESCAPE: - if (pprevtmi) + if (pprevtmi) { SendMessage (HWND_DESKTOP, MSG_ENDTRACKMENU, 0, (LPARAM)pcurtmi); + }else{ + SendMessage (HWND_DESKTOP, MSG_CLOSEMENU, 0, 1); + } break; case SCANCODE_CURSORBLOCKLEFT: @@ -3934,7 +3937,6 @@ static int mnuTrackMenuOnButtonDown (PTRACKMENUINFO ptmi, pcurtmi = mnuHitTestMenu (plast, x, y); if (pcurtmi == NULL) { // close menu. - if (phead->pmb) { barItem = MenuBarHitTest (phead->hwnd, x, y); if (barItem == phead->barPos) diff --git a/src/gui/window.c b/src/gui/window.c index db641845..8a05c0f5 100644 --- a/src/gui/window.c +++ b/src/gui/window.c @@ -101,6 +101,12 @@ static void RecalcClientArea (HWND hWnd) DeleteSecondaryDC (hWnd); pWin->secondaryDC = CreateSecondaryDC ((HWND)pWin); + if (pWin->secondaryDC == HDC_INVALID) { + /* remove the flag of WS_EX_AUTOSECONDARYDC */ + pWin->dwExStyle = pWin->dwExStyle | WS_EX_AUTOSECONDARYDC; + pWin->secondaryDC = 0; + } + /* update the privCDC of pWin and child window. */ if (pWin->dwExStyle & WS_EX_USEPRIVATECDC) { PCONTROL pNext; @@ -838,15 +844,21 @@ static void ShrinkScrollbarClipRect(HWND hWnd, HDC hdc, const WINDOWINFO *_info, memcpy(p_scrollbar_info_old, p_scrollbar_info_new, sizeof(scrollbar_info_bak)); } -static BOOL wndDrawNCButton (PMAINWIN pWin, int downCode, int status) +#define wndDrawNCButton(pWin, downCode, status) wndDrawNCButtonEx(pWin, 0, downCode, status) + +static BOOL wndDrawNCButtonEx (PMAINWIN pWin, HDC hdc, int downCode, int status) { - HDC hdc; + BOOL fGetDC = FALSE; const WINDOWINFO *info = GetWindowInfo ((HWND)pWin); static int _status = SBS_PRESSED_LTUP | SBS_PRESSED_BTDN | SBS_PRESSED_THUMB | SBS_HILITE_LTUP | SBS_HILITE_BTDN | SBS_HILITE_THUMB; - hdc = get_valid_dc (pWin, FALSE); + if(hdc == 0) + { + hdc = get_valid_dc (pWin, FALSE); + fGetDC = TRUE; + } switch (downCode) { case HT_ICON: @@ -1077,7 +1089,8 @@ static BOOL wndDrawNCButton (PMAINWIN pWin, int downCode, int status) draw_secondary_nc_area (pWin, info->we_rdr, hdc, downCode); } - release_valid_dc (pWin, hdc); + if(fGetDC) + release_valid_dc (pWin, hdc); pWin->hscroll.status &= ~_status; pWin->vscroll.status &= ~_status; @@ -2331,11 +2344,11 @@ static void wndDrawNCFrame(MAINWIN* pWin, HDC hdc, const RECT* prcInvalid) } if (!(pWin->hscroll.status & SBS_HIDE)) { - wndDrawNCButton (pWin, HT_HSCROLL, 0); + wndDrawNCButtonEx (pWin, hdc, HT_HSCROLL, 0); } if (!(pWin->vscroll.status & SBS_HIDE)) { - wndDrawNCButton (pWin, HT_VSCROLL, 0); + wndDrawNCButtonEx (pWin, hdc, HT_VSCROLL, 0); } if (rdr->draw_custom_hotspot) @@ -2616,6 +2629,12 @@ int PreDefMainWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) return DefaultControlMsgHandler(pWin, message, wParam, lParam); else if (message >= MSG_FIRSTSYSTEMMSG && message <= MSG_LASTSYSTEMMSG) return DefaultSystemMsgHandler(pWin, message, wParam, lParam); +#if (defined(_MG_ENABLE_SCREENSAVER) || defined(_MG_ENABLE_WATERMARK)) && defined(_MGRM_THREADS) + else if (message == MSG_CANCELSCREENSAVER) { + screensaver_hide(); + SendNotifyMessage (HWND_DESKTOP, MSG_PAINT, 0, 0); + } +#endif return 0; } @@ -3939,6 +3958,35 @@ void GUIAPI UpdateWindow (HWND hWnd, BOOL fErase) #endif } +MG_EXPORT void GUIAPI UpdateInvalidRect (HWND hWnd, BOOL bErase); +void GUIAPI UpdateInvalidRect (HWND hWnd, BOOL fErase) +{ + MG_CHECK (MG_IS_NORMAL_WINDOW(hWnd)); + + if (fErase) + SendAsyncMessage (hWnd, MSG_CHANGESIZE, 0, 0); + + SendAsyncMessage (hWnd, MSG_NCPAINT, 0, 0); + + /* a new implementation only check the window and its children. */ + { + PMAINWIN pWin, winStartToUpdate; + + winStartToUpdate = pWin = (PMAINWIN) hWnd; + while (pWin != pWin->pMainWin) { + if ((pWin->dwExStyle & WS_EX_TRANSPARENT)) { + winStartToUpdate = (PMAINWIN) pWin->hParent; + } + pWin = (PMAINWIN) pWin->hParent; + } + + while ((hWnd = kernel_CheckInvalidRegion (winStartToUpdate))) { + pWin = (PMAINWIN) hWnd; + SendMessage (hWnd, MSG_PAINT, 0, (LPARAM)(&pWin->InvRgn.rgn)); + } + } +} + /* ** this function show window in behavious by specified iCmdShow. ** if the window was previously visible, the return value is nonzero. @@ -5796,7 +5844,7 @@ static RECT4MASK* CalcXYBannedRects (HDC hdc, const void* mask, int * rect_size, BITMAP* bmp = (BITMAP*)mask; int x = ((p - bmp->bmBits)%bmp->bmPitch); int y = ((p - bmp->bmBits)/bmp->bmPitch); - int pitch = (bmp->bmWidth + 3) & (~3); + int pitch = bmp->bmAlphaPitch; sA = bmp->bmAlphaMask[y * pitch + x/bmp->bmBytesPerPixel]; DISEMBLE_RGB (p, bpp, pixfmt, pixel, sR, sG, sB); } diff --git a/src/ial/CMakeLists.txt b/src/ial/CMakeLists.txt index aafcfeac..a74a5cd2 100644 --- a/src/ial/CMakeLists.txt +++ b/src/ial/CMakeLists.txt @@ -20,7 +20,7 @@ list(APPEND ial_sources 2440.c 2440.h davinci6446.c davinci6446.h random.c random.h - pcxvfbial.c pcxvfb.h mgsock.c mgsock.h + pcxvfbial.c pcxvfb.h mgsock.c rtos_xvfb.c rtos_xvfb.h comminput.c comminput.h ipaq-h3600.c ipaq-h3600.h diff --git a/src/ial/Makefile.am b/src/ial/Makefile.am index f89a87ac..617b0a25 100644 --- a/src/ial/Makefile.am +++ b/src/ial/Makefile.am @@ -34,7 +34,7 @@ SHANDONG_LIDE_SRCS = lide.c lide.h 2440_SRCS = 2440.c 2440.h DAVINCI6446_SRCS=davinci6446.c davinci6446.h RANDOM_SRCS = random.c random.h -PCXVFB_SRCS = pcxvfbial.c pcxvfb.h mgsock.c mgsock.h +PCXVFB_SRCS = pcxvfbial.c pcxvfb.h mgsock.c RTOSXVFB_SRCS = rtos_xvfb.c rtos_xvfb.h COMMINPUT_SRCS = comminput.c comminput.h IPAQ_H3600_SRCS = ipaq-h3600.c ipaq-h3600.h diff --git a/src/ial/auto.c b/src/ial/auto.c index 5cc28d98..9cb0b132 100644 --- a/src/ial/auto.c +++ b/src/ial/auto.c @@ -1,5 +1,5 @@ /* -** $Id: auto.c 13674 2010-12-06 06:45:01Z wanzheng $ +** $Id: auto.c 13830 2017-10-26 05:27:43Z weiym $ ** ** auto.c: Automatic Input Engine ** @@ -108,8 +108,26 @@ static int get_auto_event(void) } else { - if (read(fd_script, &event, sizeof(event)) != sizeof(event)) - { + int n_read = read (fd_script, &event, sizeof (event)); + + if (n_read != sizeof (event)) { + + if (errno != EAGAIN) { + /* reach EOF */ + + char* loop = getenv ("MG_ENV_IAL_AUTO_REPLAY"); + + if (loop) { /* try to replay */ + time_started = 0; /* reset time_started */ + lseek (fd_script, 0, SEEK_SET); + + n_read = read (fd_script, &event, sizeof(event)); + if (n_read == sizeof (event) ) { + goto got; + } + } + } + if (errno != EAGAIN) { close(fd_script); @@ -136,6 +154,7 @@ got: event.u.mouse_event.y = ArchSwapLE32(event.u.mouse_event.y); event.u.mouse_event.buttons = ArchSwapLE32(event.u.mouse_event.buttons); } + return 1; } diff --git a/src/ial/dummy.c b/src/ial/dummy.c index 424e8ace..be114754 100644 --- a/src/ial/dummy.c +++ b/src/ial/dummy.c @@ -1,5 +1,5 @@ /* -** $Id: dummy.c 11147 2008-11-19 10:08:31Z weiym $ +** $Id: dummy.c 13830 2017-10-26 05:27:43Z weiym $ ** ** dummy.c: The dummy IAL engine. ** @@ -71,10 +71,10 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex if (!in) { in = &rfds; - FD_ZERO (in); + mg_fd_zero (in); } - e = select (maxfd + 1, in, out, except, timeout) ; + e = mg_select (maxfd + 1, in, out, except, timeout) ; if (e < 0) { return -1; diff --git a/src/ial/mgsock.c b/src/ial/mgsock.c index 823b1d67..58105dba 100644 --- a/src/ial/mgsock.c +++ b/src/ial/mgsock.c @@ -50,4 +50,3 @@ void win_closesock(int s) } #endif /*WIN32*/ - diff --git a/src/ial/mgsock.h b/src/ial/mgsock.h deleted file mode 100644 index 96aaae5b..00000000 --- a/src/ial/mgsock.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef _MGSOCK_H -#define _MSSOCK_H - -#ifndef WIN32 - -#define mg_fd_set(fd, set) FD_SET(fd, set) -#define mg_fd_clr(fd, set) FD_CLR(fd, set) -#define mg_fd_isset(fd, set) FD_ISSET(fd, set) -#define mg_fd_zero(set) FD_ZERO(set) -#define mg_select(nfds, readfds, writefds, exceptfds, timeout) \ - select(nfds, readfds, writefds, exceptfds, timeout) -#define FD_READ(s, buf, len) read(s, buf, len) -#define FD_WRITE(s, buf, len) write(s, buf, len) - -#else - -#define mg_fd_set(fd, set) win_fd_set(fd, set) -#define mg_fd_clr(fd, set) win_fd_clr(fd, set) -#define mg_fd_isset(fd, set) win_fd_isset(fd, set) -#define mg_fd_zero(set) win_fd_zero(set) -#define mg_select(nfds, readfds, writefds, exceptfds, timeout) \ - win_select(nfds, readfds, writefds, exceptfds, timeout) -#define FD_READ(s, buf, len) win_readsock(s, buf, len, 0) -#define FD_WRITE(s, buf, len) win_writesock(s, buf, len, 0) - -#endif /* WIN32 */ - -#ifndef FD_SETSIZE -#define FD_SETSIZE 64 -#endif /* FD_SETSIZE */ - -#ifdef WIN32 -typedef struct __fd_set { - unsigned int fd_count; /* how many are SET? */ - int fd_array[FD_SETSIZE]; /* an array of SOCKETs */ -} _fd_set; -#endif - -#ifdef WIN32 -int win_fd_setsize; -int win_fd_set (int fd, void *set); -int win_fd_clr (int fd, void *set); -int win_fd_isset (int fd, void *set); -int win_fd_zero (void *set); -int win_select (int nfds, void *readfds, void *writefds, void *exceptfds, const struct timeval *timeout); -int win_readsock (int s, char *buf, int len, int flags); -int win_writesock (int s, char *buf, int len, int flags); -void win_closesock (int s); - -#endif - -#endif /* _MGSOCK_H */ diff --git a/src/ial/pcxvfbial.c b/src/ial/pcxvfbial.c index 128b6b82..d7ba8424 100644 --- a/src/ial/pcxvfbial.c +++ b/src/ial/pcxvfbial.c @@ -1,5 +1,5 @@ /* -** $Id: pcxvfbial.c 13674 2010-12-06 06:45:01Z wanzheng $ +** $Id: pcxvfbial.c 13830 2017-10-26 05:27:43Z weiym $ ** ** pcxvfb.c: Input Engine for PCX Virtual FrameBuffer ** @@ -34,22 +34,23 @@ #include #include -#else #endif #include "minigui.h" #include "gdi.h" #include "window.h" +#include "mgsock.h" #include "misc.h" #define __NONEED_FD_SET_TYPE #include "ial.h" #include "pcxvfb.h" -#include "mgsock.h" #endif #include "license.h" +#include "auto-protocol.h" + #ifdef __ECOS__ #define O_RDONLY CYG_HAL_SYS_O_RDONLY @@ -95,6 +96,18 @@ static unsigned char read_mouse_result = 0; static unsigned char kbd_state [NR_KEYS]; +/* for ial record */ +#define IAL_RECORD_MANUAL_START + +static int record_fd = -1; +static long long int record_time_start = 0; + +#ifdef IAL_RECORD_MANUAL_START +#define IAL_RECORD_START_KEY SCANCODE_F5 + +static BOOL record_started = FALSE; +#endif + static void (*set_ime_text)(void*,const char*); static void *ime_text_callback_data; @@ -122,9 +135,9 @@ void VFBSetCaption(const char* caption) if(__mg_pcxvfb_client_sockfd == -1) return ; - /*one XVFBCaptionEventData struct costs 8 bytes, - * change that '8' below if the struct is changed*/ - FD_WRITE(__mg_pcxvfb_client_sockfd, ced, sizeof(int)*2+len); + /*one XVFBCaptionEventData struct costs 8 bytes, + * change that '8' below if the struct is changed*/ + mg_writesocket(__mg_pcxvfb_client_sockfd, ced, 8+len); } void VFBOpenIME(int bOpen) @@ -136,7 +149,7 @@ void VFBOpenIME(int bOpen) if(__mg_pcxvfb_client_sockfd == -1) return ; - FD_WRITE(__mg_pcxvfb_client_sockfd, &ime, sizeof(ime)); + mg_writesocket(__mg_pcxvfb_client_sockfd, &ime, sizeof(ime)); } void VFBShowWindow(int show) @@ -147,7 +160,7 @@ void VFBShowWindow(int show) }; if(__mg_pcxvfb_client_sockfd == -1) return ; - FD_WRITE(__mg_pcxvfb_client_sockfd, info, sizeof(info)); + mg_writesocket(__mg_pcxvfb_client_sockfd, info, sizeof(info)); } void VFBAtExit(void (*callback)(void)) @@ -209,20 +222,106 @@ static void default_cb(void *user_data, const char* str) /******************** Low Level Input Operations ******************/ +static BOOL if_record_ial () +{ +#ifdef WIN32 + /* TODO: */ + return FALSE; +#else + return (record_fd >= 0); +#endif +} + +static long long int getcurtime() +{ +#ifdef WIN32 + /* TODO: */ + return 0; +#else + struct timeval tv; + gettimeofday( &tv, NULL ); + return (long long int)tv.tv_sec * 1000 + (long long int)tv.tv_usec / 1000; +#endif +} + +static void open_rec (const char* path) +{ +#ifdef WIN32 + /* TODO: */ +#else + record_fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644); +#endif +} + +static void write_rec (const void* buf, size_t n) +{ +#ifdef WIN32 + /* TODO: */ +#else + write(record_fd, buf, n); +#endif +} + +static void flush_rec () +{ +#ifdef WIN32 + /* TODO: */ +#else + fsync(record_fd); +#endif +} + + +static void do_record(AUTO_IAL_INPUT_EVENT *event) +{ +#define MAX_COUNT 50 +#define MAX_TIME 3000 + static int record_count = 0; + static long long int record_last_time = 0; + + if (! record_started) { + /* adjuge if recording should be started */ + if (0 == event->type && IAL_RECORD_START_KEY == event->u.key_event.scancode) { + /* to start recording */ + record_started = TRUE; + } + else { + /* do nothing */ + return; + } + } + +#if MGUI_BYTEORDER == MGUI_BIG_ENDIAN + event->timestamp = ArchSwap64(event->timestamp); + if (event->type == 0) + { + event->u.key_event.scancode = ArchSwap32(event->u.key_event.scancode); + event->u.key_event.type = ArchSwap32(event->u.key_event.type); + } + else + { + event->u.mouse_event.x = ArchSwap32(event->u.mouse_event.x); + event->u.mouse_event.y = ArchSwap32(event->u.mouse_event.y); + event->u.mouse_event.buttons = ArchSwap32(event->u.mouse_event.buttons); + } + event->type = ArchSwap32(event->type); +#endif + + + write_rec (event, sizeof(*event)); + + if (record_count++ >= MAX_COUNT || (event->timestamp - record_last_time) >= MAX_TIME) + { + record_count = 0; + record_last_time = event->timestamp; + flush_rec (); + } +} + /* * Mouse operations -- Event */ -static int mouse_update (void) -{ - cur_retvalue = 0; -#ifndef WIN32 - return read_mouse_result; -#else - return 1; -#endif -} - static void mouse_getxy (int *x, int* y) { *x = s_pcxvfb_event_mouse.data.mouse.x; @@ -235,7 +334,7 @@ static void mouse_setxy (int x, int y) if(__mg_pcxvfb_client_sockfd == -1) return ; - FD_WRITE(__mg_pcxvfb_client_sockfd, &mouse_event, sizeof(XVFBEVENT)); + mg_writesocket(__mg_pcxvfb_client_sockfd, &mouse_event, sizeof(XVFBEVENT)); } static int mouse_getbutton (void) @@ -252,6 +351,27 @@ static int mouse_getbutton (void) return buttons; } +static int mouse_update (void) +{ + cur_retvalue = 0; +#ifndef WIN32 + + if (if_record_ial ()) { + AUTO_IAL_INPUT_EVENT event; + event.timestamp = getcurtime() - record_time_start; + event.type = 1; + mouse_getxy(&event.u.mouse_event.x, &event.u.mouse_event.y); + event.u.mouse_event.buttons = mouse_getbutton(); + do_record(&event); + } + + return read_mouse_result; +#else + return 1; +#endif +} + + static int keyboard_update (void) { unsigned char scancode; @@ -277,6 +397,16 @@ static int keyboard_update (void) if (unicode == 0 && !press) { kbd_state [last] = 0; + + if (if_record_ial ()) { + AUTO_IAL_INPUT_EVENT event; + event.timestamp = getcurtime() - record_time_start; + event.type = 0; + event.u.key_event.scancode = last; + event.u.key_event.type = press ? 1 : 0; + do_record(&event); + } + } else { scancode = unicode; @@ -284,6 +414,16 @@ static int keyboard_update (void) kbd_state [scancode] = press; if (press) last = scancode; + + if (if_record_ial ()) { + AUTO_IAL_INPUT_EVENT event; + event.timestamp = getcurtime() - record_time_start; + event.type = 0; + event.u.key_event.scancode = scancode; + event.u.key_event.type = press ? 1 : 0; + do_record(&event); + } + } return NR_KEYS; @@ -299,7 +439,7 @@ static int read_event(int fd, XVFBEVENT *pcxvfb_event) int ret; int event_type; - if ((ret = FD_READ (fd, &event_type, sizeof(event_type))) <= 0) + if ((ret = mg_readsocket (fd, &event_type, sizeof(event_type))) <= 0) { #ifdef __NOUNIX__ if (1) { @@ -308,7 +448,13 @@ static int read_event(int fd, XVFBEVENT *pcxvfb_event) #endif ExitGUISafely (-1); return -1; + +#ifdef __NOUNIX__ } +#else + } +#endif + } else if(ret != sizeof(event_type)) { return -1; } @@ -316,7 +462,7 @@ static int read_event(int fd, XVFBEVENT *pcxvfb_event) switch (event_type) { case MOUSE_TYPE: { - if (FD_READ (fd, &pcxvfb_event->data, sizeof(pcxvfb_event->data)) + if (mg_readsocket (fd, &pcxvfb_event->data, sizeof(pcxvfb_event->data)) != sizeof(pcxvfb_event->data)) { return -1; } @@ -333,7 +479,7 @@ static int read_event(int fd, XVFBEVENT *pcxvfb_event) } case KB_TYPE: { - if (FD_READ (fd, &pcxvfb_event->data, sizeof(pcxvfb_event->data)) + if (mg_readsocket (fd, &pcxvfb_event->data, sizeof(pcxvfb_event->data)) != sizeof(pcxvfb_event->data)) { return -1; } @@ -345,13 +491,13 @@ static int read_event(int fd, XVFBEVENT *pcxvfb_event) { int size; unsigned char szBuff[1024]; - if(FD_READ (fd, &size, sizeof(size)) != sizeof(size)) { + if(mg_readsocket (fd, &size, sizeof(size)) != sizeof(size)) { return 0; } if(size <= 0) { return 0; } - if(FD_READ (fd, szBuff, size) == size) { + if(mg_readsocket (fd, szBuff, size) == size) { /* int i; for (i = 0; i < size; ++i) @@ -488,6 +634,24 @@ BOOL InitPCXVFBInput (INPUT* input, const char* mdev, const char* mtype) VFBSetIMETextCallback(default_cb, 0); + { + char path[PATH_MAX], *template; + template = getenv("MG_ENV_RECORD_IAL"); + if (template) + { +#if 0 + snprintf(path, sizeof(path), "%s%ld", template, time(NULL)); +#else + snprintf(path, sizeof(path), "%s", template); +#endif + path[sizeof(path)/sizeof(path[0])-1] = 0; + + open_rec (path); + record_time_start = getcurtime(); + } + } + + return TRUE; } diff --git a/src/include/Makefile.am b/src/include/Makefile.am index 443e016f..f9a8a34f 100644 --- a/src/include/Makefile.am +++ b/src/include/Makefile.am @@ -6,4 +6,4 @@ noinst_HEADERS = \ readbmp.h icon.h blockheap.h \ ourhdr.h client.h server.h sharedres.h sockio.h drawsemop.h \ gal.h newgal.h memops.h incoreres.h sysres.h clipboard.h \ - md5.h glyph.h license.h + md5.h glyph.h license.h mgsock.h diff --git a/src/include/dc.h b/src/include/dc.h index ee822eee..8498e48f 100644 --- a/src/include/dc.h +++ b/src/include/dc.h @@ -572,8 +572,8 @@ leave_drawing: #endif // #if MGUI_BYTEORDER == MGUI_LIL_ENDIAN -HDC GetSecondarySubDC (HDC secondary_dc, HWND hwnd_child, BOOL client); -void ReleaseSecondarySubDC (HDC secondary_subdc); +MG_EXPORT HDC GetSecondarySubDC (HDC secondary_dc, HWND hwnd_child, BOOL client); +MG_EXPORT void ReleaseSecondarySubDC (HDC secondary_subdc); static inline HDC get_valid_dc (PMAINWIN pWin, BOOL client) { diff --git a/src/include/devfont.h b/src/include/devfont.h index f0532770..22112f04 100644 --- a/src/include/devfont.h +++ b/src/include/devfont.h @@ -54,7 +54,6 @@ unsigned short font_GetBestScaleFactor (int height, int expect); /* Add for bitmap font interface */ void font_DelSBDevFont (DEVFONT* dev_font); void font_DelMBDevFont (DEVFONT* dev_font); -void font_DelDevFont (const char* font_name); #ifdef _DEBUG void dbg_dumpDevFonts (void); diff --git a/src/include/fontname.h b/src/include/fontname.h index 28e53586..a272fcde 100644 --- a/src/include/fontname.h +++ b/src/include/fontname.h @@ -21,7 +21,7 @@ extern "C" { #define NR_LOOP_FOR_CHARSET 5 int fontGetFontTypeFromName (const char* name); -int fontGetTypeNameFromName (const char* name, char* type); +BOOL fontGetTypeNameFromName (const char* name, char* type); int fontConvertFontType (const char* type); BOOL fontGetFamilyFromName (const char* name, char* family); diff --git a/src/include/ial.h b/src/include/ial.h index 9c02db31..9a01c5a3 100644 --- a/src/include/ial.h +++ b/src/include/ial.h @@ -12,29 +12,24 @@ #ifndef GUI_IAL_H #define GUI_IAL_H - #ifndef WIN32 -#ifndef HAVE_SYS_TIME_H +# ifndef HAVE_SYS_TIME_H +# define fd_set void +# else -#define fd_set void +# ifdef __OSE__ +# define fd_set void +# endif -#else - -#ifdef __OSE__ -#define fd_set void +# ifndef __NONEED_FD_SET_TYPE +# include +# include +# include +# endif +# endif #endif -#ifndef __NONEED_FD_SET_TYPE -#include -#include -#include -#endif - -#endif -#else #include "mgsock.h" -#endif - #include "misc.h" #include "gal.h" #include "customial.h" diff --git a/src/include/internals.h b/src/include/internals.h index 81936bdc..fdb3f63a 100644 --- a/src/include/internals.h +++ b/src/include/internals.h @@ -14,6 +14,16 @@ /******************* Internal data *******************************************/ +/* Internal window message. */ +#if (defined(_MG_ENABLE_SCREENSAVER) || defined(_MG_ENABLE_WATERMARK)) && defined(_MGRM_THREADS) +#define MSG_CANCELSCREENSAVER 0x0201 + +#if defined(__GNUC__) && (__GNUC__ >= 4) +__attribute__ ((visibility ("hidden"))) void screensaver_hide(void); +#else +void screensaver_hide(void); +#endif +#endif /* Internal use extended style. */ #define WS_EX_MODALDISABLED 0x10000000L diff --git a/src/include/memops.h b/src/include/memops.h index 35d4346d..66bc2810 100644 --- a/src/include/memops.h +++ b/src/include/memops.h @@ -54,10 +54,11 @@ do { \ __asm__ __volatile__ ( \ "std\n\t" \ "rep ; movsl\n\t" \ + "cld " \ : "=&c" (u0), "=&D" (u1), "=&S" (u2) \ : "0" (n >> 2), \ "1" (dstp+(n-4)), "2" (srcp+(n-4)) \ - : "memory" ); \ + : "memory"); \ } \ switch (n & 3) { \ case 3: dstp[2] = srcp[2]; \ diff --git a/src/include/mgsock.h b/src/include/mgsock.h index e56a12f8..21ba0c79 100644 --- a/src/include/mgsock.h +++ b/src/include/mgsock.h @@ -1,90 +1,51 @@ -#ifndef _MGSOCK_H -#define _MGSOCK_H - -#ifndef WIN32 - -#define mg_fd_set(fd, set) FD_SET(fd, set) -#define mg_fd_clr(fd, set) FD_CLR(fd, set) -#define mg_fd_isset(fd, set) FD_ISSET(fd, set) -#define mg_fd_zero(set) FD_ZERO(set) -#define mg_select(nfds, readfds, writefds, exceptfds, timeout) \ - select(nfds, readfds, writefds, exceptfds, timeout) -#define FD_READ(s, buf, len) read(s, buf, len) -#define FD_WRITE(s, buf, len) write(s, buf, len) - -#else - -#define mg_fd_set(fd, set) win_fd_set(fd, set) -#define mg_fd_clr(fd, set) win_fd_clr(fd, set) -#define mg_fd_isset(fd, set) win_fd_isset(fd, set) -#define mg_fd_zero(set) win_fd_zero(set) -#define mg_select(nfds, readfds, writefds, exceptfds, timeout) \ - win_select(nfds, readfds, writefds, exceptfds, timeout) -#define FD_READ(s, buf, len) win_readsock(s, buf, len, 0) -#define FD_WRITE(s, buf, len) win_writesock(s, buf, len, 0) - -#endif /* WIN32 */ - -#ifndef FD_SETSIZE -#define FD_SETSIZE 64 -#endif /* FD_SETSIZE */ - -#ifdef WIN32 -typedef unsigned int u_int; -typedef int SOCKET; -typedef struct __fd_set { - u_int fd_count; /* how many are SET? */ - int fd_array[FD_SETSIZE]; /* an array of SOCKETs */ -} _fd_set; -typedef struct __fd_set fd_set; - -#define FAR - -#define FD_CLR(fd, set) do { \ - u_int __i; \ - for (__i = 0; __i < ((fd_set FAR *)(set))->fd_count ; __i++) { \ - if (((fd_set FAR *)(set))->fd_array[__i] == fd) { \ - while (__i < ((fd_set FAR *)(set))->fd_count-1) { \ - ((fd_set FAR *)(set))->fd_array[__i] = \ - ((fd_set FAR *)(set))->fd_array[__i+1]; \ - __i++; \ - } \ - ((fd_set FAR *)(set))->fd_count--; \ - break; \ - } \ - } \ -} while(0) - -#define FD_SET(fd, set) do { \ - if (((fd_set FAR *)(set))->fd_count < FD_SETSIZE) \ - ((fd_set FAR *)(set))->fd_array[((fd_set FAR *)(set))->fd_count++]=(fd);\ -} while(0) - -#define FD_ZERO(set) (((fd_set FAR *)(set))->fd_count=0) - -static inline int __WSAFDIsSet(int fd, fd_set * set){ - int i; - if(!set || fd <= 0) - return 0; - for(i = 0; i < set->fd_count; i ++) - if(set->fd_array[i] == fd) - return 1; - return 0; -} - -#define FD_ISSET(fd, set) __WSAFDIsSet((SOCKET)(fd), (fd_set FAR *)(set)) -#endif - -#ifdef WIN32 -int win_fd_setsize; -int win_fd_set (int fd, void *set); -int win_fd_clr (int fd, void *set); -int win_fd_isset (int fd, void *set); -int win_fd_zero (void *set); -int win_select (int nfds, void *readfds, void *writefds, void *exceptfds, const struct timeval *timeout); -int win_readsock (int s, char *buf, int len, int flags); -int win_writesock (int s, char *buf, int len, int flags); -void win_closesock (int s); -#endif - -#endif /* _MGSOCK_H */ +#ifndef _MGSOCK_H +#define _MGSOCK_H + +#ifndef WIN32 + +#define mg_fd_set(fd, set) FD_SET(fd, set) +#define mg_fd_clr(fd, set) FD_CLR(fd, set) +#define mg_fd_isset(fd, set) FD_ISSET(fd, set) +#define mg_fd_zero(set) FD_ZERO(set) +#define mg_select(nfds, readfds, writefds, exceptfds, timeout) \ + select(nfds, readfds, writefds, exceptfds, timeout) +#define mg_readsocket(s, buf, len) read(s, buf, len) +#define mg_writesocket(s, buf, len) write(s, buf, len) + +#else + +#define mg_fd_set(fd, set) win_fd_set(fd, set) +#define mg_fd_clr(fd, set) win_fd_clr(fd, set) +#define mg_fd_isset(fd, set) win_fd_isset(fd, set) +#define mg_fd_zero(set) win_fd_zero(set) +#define mg_select(nfds, readfds, writefds, exceptfds, timeout) \ + win_select(nfds, readfds, writefds, exceptfds, timeout) +#define mg_readsocket(s, buf, len) win_readsock(s, buf, len, 0) +#define mg_writesocket(s, buf, len) win_writesock(s, buf, len, 0) + +#endif /* WIN32 */ + +#ifdef WIN32 +# ifndef FD_SETSIZE +# define FD_SETSIZE 64 +typedef unsigned int u_int; +typedef int SOCKET; +typedef struct __fd_set { + u_int fd_count; /* how many are SET? */ + int fd_array[FD_SETSIZE]; /* an array of SOCKETs */ +} _fd_set; +typedef struct __fd_set fd_set; +# endif /* FD_SETSIZE */ + +int win_fd_setsize; +int win_fd_set (int fd, void *set); +int win_fd_clr (int fd, void *set); +int win_fd_isset (int fd, void *set); +int win_fd_zero (void *set); +int win_select (int nfds, void *readfds, void *writefds, void *exceptfds, const struct timeval *timeout); +int win_readsock (int s, char *buf, int len, int flags); +int win_writesock (int s, char *buf, int len, int flags); +void win_closesock (int s); +#endif + +#endif /* _MGSOCK_H */ diff --git a/src/include/msgstr.h b/src/include/msgstr.h index 6fa11964..ff346255 100644 --- a/src/include/msgstr.h +++ b/src/include/msgstr.h @@ -35,9 +35,9 @@ const char *__mg_msgstr1 [] = "MSG_SYSKEYDOWN ", // 0x0013 "MSG_SYSCHAR ", // 0x0014 "MSG_SYSKEYUP ", // 0x0015 - "MSG_KEYSYM ", // 0x0016 - "MSG_KEYLONGPRESS ", // 0x0017 - "MSG_KEYALWAYSPRESS ", // 0x0018 + "MSG_KEYLONGPRESS ", // 0x0016 + "MSG_KEYALWAYSPRESS ", // 0x0017 + "MSG_KEYSYM ", // 0x0018 "", // 0x0019 "", // 0x001A "", // 0x001B @@ -201,26 +201,26 @@ char * __mg_msgstr2 [] = "", // 0x00DB "", // 0x00DC "", // 0x00DD - "", // 0x00DE - "", // 0x00DF - - "MSG_ERASEDESKTOP ", // 0x00E0 - "MSG_PAINTDESKTOP ", // 0x00E1 - "MSG_DT_LBUTTONDOWN ", // 0x00E2 - "MSG_DT_LBUTTONUP ", // 0x00E3 - "MSG_DT_LBUTTONDBLCLK ", // 0x00E4 - "MSG_DT_MOUSEMOVE ", // 0x00E5 - "MSG_DT_RBUTTONDOWN ", // 0x00E6 - "MSG_DT_RBUTTONUP ", // 0x00E7 - "MSG_DT_RBUTTONDBLCLK ", // 0x00E8 - "", // 0x00E9 - "MSG_DT_KEYDOWN ", // 0x00EA - "MSG_DT_CHAR ", // 0x00EB - "MSG_DT_KEYUP ", // 0x00EC - "MSG_DT_SYSKEYDOWN ", // 0x00ED - "MSG_DT_SYSCHAR ", // 0x00EE - "MSG_DT_SYSKEYUP ", // 0x00EF + "MSG_ERASEDESKTOP ", // 0x00DE + "MSG_PAINTDESKTOP ", // 0x00DF + "MSG_DT_LBUTTONDOWN ", // 0x00E0 + "MSG_DT_LBUTTONUP ", // 0x00E1 + "MSG_DT_LBUTTONDBLCLK ", // 0x00E2 + "MSG_DT_MOUSEMOVE ", // 0x00E3 + "MSG_DT_RBUTTONDOWN ", // 0x00E4 + "MSG_DT_RBUTTONUP ", // 0x00E5 + "MSG_DT_RBUTTONDBLCLK ", // 0x00E6 + "", // 0x00E7 + "MSG_DT_KEYDOWN ", // 0x00E8 + "MSG_DT_CHAR ", // 0x00E9 + "MSG_DT_KEYUP ", // 0x00EA + "MSG_DT_SYSKEYDOWN ", // 0x00EB + "MSG_DT_SYSCHAR ", // 0x00EC + "MSG_DT_SYSKEYUP ", // 0x00ED + "MSG_DT_KEYLONGPRESS ", // 0x00EE + "MSG_DT_KEYALWAYSPRESS ", // 0x00EF + "MSG_ADDNEWMAINWIN ", // 0x00F0 "MSG_REMOVEMAINWIN ", // 0x00F1 "MSG_MOVETOTOPMOST ", // 0x00F2 diff --git a/src/kernel/cursor-procs.c b/src/kernel/cursor-procs.c index 0e0c15ec..2a2a2c1b 100644 --- a/src/kernel/cursor-procs.c +++ b/src/kernel/cursor-procs.c @@ -117,20 +117,20 @@ static HCURSOR srvCreateCursor (int xhotspot, int yhotspot, int w, int h, if (colornum == 1) { ExpandMonoBitmap (HDC_SCREEN_SYS, pcsr->AndBits, __mg_csrimgpitch, pANDBits, MONOPITCH, w, h, MYBMP_FLOW_UP, - RGB2Pixel (HDC_SCREEN_SYS, 0, 0, 0), - RGB2Pixel (HDC_SCREEN_SYS, 0xFF, 0xFF, 0xFF)); + RGBA2Pixel (HDC_SCREEN_SYS, 0, 0, 0, 0xFF), + RGBA2Pixel (HDC_SCREEN_SYS, 0xFF, 0xFF, 0xFF, 0xFF)); ExpandMonoBitmap (HDC_SCREEN_SYS, pcsr->XorBits, __mg_csrimgpitch, pXORBits, MONOPITCH, w, h, MYBMP_FLOW_UP, - RGB2Pixel (HDC_SCREEN_SYS, 0, 0, 0), - RGB2Pixel (HDC_SCREEN_SYS, 0xFF, 0xFF, 0xFF)); + RGBA2Pixel (HDC_SCREEN_SYS, 0, 0, 0, 0x00), + RGBA2Pixel (HDC_SCREEN_SYS, 0xFF, 0xFF, 0xFF, 0x00)); } else if (colornum == 4) { ExpandMonoBitmap (HDC_SCREEN_SYS, pcsr->AndBits, __mg_csrimgpitch, pANDBits, MONOPITCH, w, h, MYBMP_FLOW_UP, - RGB2Pixel (HDC_SCREEN_SYS, 0, 0, 0), - RGB2Pixel (HDC_SCREEN_SYS, 0xFF, 0xFF, 0xFF)); - Expand16CBitmap (HDC_SCREEN_SYS, pcsr->XorBits, __mg_csrimgpitch, - pXORBits, MONOPITCH*4, w, h, MYBMP_FLOW_UP, NULL); + RGBA2Pixel (HDC_SCREEN_SYS, 0, 0, 0, 0xFF), + RGBA2Pixel (HDC_SCREEN_SYS, 0xFF, 0xFF, 0xFF, 0xFF)); + Expand16CBitmapEx (HDC_SCREEN_SYS, pcsr->XorBits, __mg_csrimgpitch, + pXORBits, MONOPITCH*4, w, h, MYBMP_FLOW_UP, NULL, FALSE, 0x00); } return (HCURSOR)pcsr; @@ -568,12 +568,6 @@ static void showcursor (void) } #endif - /* restore alpha of the box */ - if (__gal_screen->format->Amask) { - _dc_restore_alpha_in_bitmap (__gal_screen->format, - cursorbits, __mg_csrimgsize); - } - csr_bmp.bmBits = cursorbits; GAL_PutBox (__gal_screen, &csr_rect, &csr_bmp); GAL_UpdateRects (__gal_screen, 1, &csr_rect); diff --git a/src/kernel/cursor-sa.c b/src/kernel/cursor-sa.c index 0cc8bd58..86027cdb 100644 --- a/src/kernel/cursor-sa.c +++ b/src/kernel/cursor-sa.c @@ -218,20 +218,20 @@ HCURSOR GUIAPI CreateCursor(int xhotspot, int yhotspot, int w, int h, if (colornum == 1) { ExpandMonoBitmap (HDC_SCREEN_SYS, pcsr->AndBits, csrimgpitch, pANDBits, MONOPITCH, w, h, MYBMP_FLOW_UP, - RGB2Pixel (HDC_SCREEN_SYS, 0, 0, 0), - RGB2Pixel (HDC_SCREEN_SYS, 0xFF, 0xFF, 0xFF)); + RGBA2Pixel (HDC_SCREEN_SYS, 0, 0, 0, 0xFF), + RGBA2Pixel (HDC_SCREEN_SYS, 0xFF, 0xFF, 0xFF, 0xFF)); ExpandMonoBitmap (HDC_SCREEN_SYS, pcsr->XorBits, csrimgpitch, pXORBits, MONOPITCH, w, h, MYBMP_FLOW_UP, - RGB2Pixel (HDC_SCREEN_SYS, 0, 0, 0), - RGB2Pixel (HDC_SCREEN_SYS, 0xFF, 0xFF, 0xFF)); + RGBA2Pixel (HDC_SCREEN_SYS, 0, 0, 0, 0x00), + RGBA2Pixel (HDC_SCREEN_SYS, 0xFF, 0xFF, 0xFF, 0x00)); } else if (colornum == 4) { ExpandMonoBitmap (HDC_SCREEN_SYS, pcsr->AndBits, csrimgpitch, pANDBits, MONOPITCH, w, h, MYBMP_FLOW_UP, - RGB2Pixel (HDC_SCREEN_SYS, 0, 0, 0), - RGB2Pixel (HDC_SCREEN_SYS, 0xFF, 0xFF, 0xFF)); - Expand16CBitmap (HDC_SCREEN_SYS, pcsr->XorBits, csrimgpitch, - pXORBits, MONOPITCH*4, w, h, MYBMP_FLOW_UP, NULL); + RGBA2Pixel (HDC_SCREEN_SYS, 0, 0, 0, 0xFF), + RGBA2Pixel (HDC_SCREEN_SYS, 0xFF, 0xFF, 0xFF, 0xFF)); + Expand16CBitmapEx (HDC_SCREEN_SYS, pcsr->XorBits, csrimgpitch, + pXORBits, MONOPITCH*4, w, h, MYBMP_FLOW_UP, NULL, FALSE, 0x00); } return (HCURSOR)pcsr; @@ -448,12 +448,6 @@ static void showcursor (void) } #endif - /* restore alpha of the box */ - if (__gal_screen->format->Amask) { - _dc_restore_alpha_in_bitmap (__gal_screen->format, - cursorbits, csrimgsize); - } - csr_bmp.bmBits = cursorbits; GAL_PutBox (__gal_screen, &csr_rect, &csr_bmp); GAL_UpdateRects (__gal_screen, 1, &csr_rect); diff --git a/src/kernel/cursor.c b/src/kernel/cursor.c index 962baead..e6fb84d7 100644 --- a/src/kernel/cursor.c +++ b/src/kernel/cursor.c @@ -250,22 +250,22 @@ HCURSOR GUIAPI CreateCursor(int xhotspot, int yhotspot, int w, int h, if (colornum == 1) { ExpandMonoBitmap (HDC_SCREEN_SYS, pcsr->AndBits, csrimgpitch, pANDBits, MONOPITCH, w, h, MYBMP_FLOW_UP, - RGB2Pixel (HDC_SCREEN_SYS, 0, 0, 0), - RGB2Pixel (HDC_SCREEN_SYS, 0xFF, 0xFF, 0xFF)); + RGBA2Pixel (HDC_SCREEN_SYS, 0, 0, 0, 0xFF), + RGBA2Pixel (HDC_SCREEN_SYS, 0xFF, 0xFF, 0xFF, 0xFF)); ExpandMonoBitmap (HDC_SCREEN_SYS, pcsr->XorBits, csrimgpitch, pXORBits, MONOPITCH, w, h, MYBMP_FLOW_UP, - RGB2Pixel (HDC_SCREEN_SYS, 0, 0, 0), - RGB2Pixel (HDC_SCREEN_SYS, 0xFF, 0xFF, 0xFF)); + RGBA2Pixel (HDC_SCREEN_SYS, 0, 0, 0, 0x00), + RGBA2Pixel (HDC_SCREEN_SYS, 0xFF, 0xFF, 0xFF, 0x00)); } else if (colornum == 4) { ExpandMonoBitmap (HDC_SCREEN_SYS, pcsr->AndBits, csrimgpitch, pANDBits, MONOPITCH, w, h, MYBMP_FLOW_UP, - RGB2Pixel (HDC_SCREEN_SYS, 0, 0, 0), - RGB2Pixel (HDC_SCREEN_SYS, 0xFF, 0xFF, 0xFF)); - Expand16CBitmap (HDC_SCREEN_SYS, pcsr->XorBits, csrimgpitch, pXORBits, - MONOPITCH*4, w, h, MYBMP_FLOW_UP, NULL); + RGBA2Pixel (HDC_SCREEN_SYS, 0, 0, 0, 0xFF), + RGBA2Pixel (HDC_SCREEN_SYS, 0xFF, 0xFF, 0xFF, 0xFF)); + Expand16CBitmapEx (HDC_SCREEN_SYS, pcsr->XorBits, csrimgpitch, pXORBits, + MONOPITCH*4, w, h, MYBMP_FLOW_UP, NULL, FALSE, 0x00); } return (HCURSOR)pcsr; @@ -501,12 +501,6 @@ static void showcursor (void) } #endif - /* restore alpha of the box */ - if (__gal_screen->format->Amask) { - _dc_restore_alpha_in_bitmap (__gal_screen->format, - cursorbits, csrimgsize); - } - csr_bmp.bmBits = cursorbits; GAL_PutBox (__gal_screen, &csr_rect, &csr_bmp); GAL_UpdateRects (__gal_screen, 1, &csr_rect); @@ -650,6 +644,7 @@ BOOL mg_InitCursor (void) __mg_cursor_x=0, __mg_cursor_y=0; oldx = -1, oldy=-1; memset(&cliprc,0,sizeof(RECT)); +#ifdef _MGHAVE_CURSOR oldboxleft = -100, oldboxtop = -100; nShowCount = 0; pCurCsr = NULL; @@ -657,6 +652,7 @@ BOOL mg_InitCursor (void) csr_rect.x = csr_rect.y = 0; csr_rect.w = CURSORWIDTH; csr_rect.h = CURSORHEIGHT; +#endif pthread_mutex_init (&__mg_mouselock, NULL); #ifdef _MGHAVE_CURSOR diff --git a/src/kernel/desktop-comm.c b/src/kernel/desktop-comm.c index 5edf085b..5a1eddef 100644 --- a/src/kernel/desktop-comm.c +++ b/src/kernel/desktop-comm.c @@ -186,6 +186,12 @@ static int dskAddNewMainWindow (PMAINWIN pWin) if (pWin->dwExStyle & WS_EX_AUTOSECONDARYDC) pWin->secondaryDC = CreateSecondaryDC ((HWND)pWin); + if (pWin->secondaryDC == HDC_INVALID) { + /* remove the flag of WS_EX_AUTOSECONDARYDC */ + pWin->dwExStyle = pWin->dwExStyle | WS_EX_AUTOSECONDARYDC; + pWin->secondaryDC = 0; + } + /* Create private client dc. */ if (pWin->dwExStyle & WS_EX_USEPRIVATECDC) { if (pWin->dwExStyle & WS_EX_AUTOSECONDARYDC) @@ -1930,6 +1936,12 @@ void GUIAPI DesktopUpdateAllWindow(void) SendMessage(HWND_DESKTOP, MSG_PAINT, 0, 0); } +#ifndef _MG_ENABLE_SCREENSAVER +# define HAS_NO_MAINWINDOW() ((__mg_zorder_info->nr_normals + __mg_zorder_info->nr_topmosts) == 0) +#else + /* The screensaver occupys one znode */ +# define HAS_NO_MAINWINDOW() ((__mg_zorder_info->nr_normals + __mg_zorder_info->nr_topmosts) == 1) +#endif int DesktopWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) { @@ -2048,11 +2060,14 @@ int DesktopWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) break; case MSG_ENDSESSION: - if ((__mg_zorder_info->nr_normals + __mg_zorder_info->nr_topmosts) == 0 + if ( + HAS_NO_MAINWINDOW() #ifdef _MGRM_THREADS && __mg_enter_terminategui #endif ) { + screensaver_destroy(); + if (hDesktopDC) ReleaseDC (hDesktopDC); hDesktopDC = 0; @@ -2234,7 +2249,7 @@ int DesktopWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) } if (__mg_quiting_stage > _MG_QUITING_STAGE_DESKTOP - && (__mg_zorder_info->nr_normals + __mg_zorder_info->nr_topmosts) == 0 + && HAS_NO_MAINWINDOW() && __mg_enter_terminategui /* Let Desktop wait for MiniGUIMain() */ ) { __mg_quiting_stage = _MG_QUITING_STAGE_DESKTOP; diff --git a/src/kernel/desktop-procs.c b/src/kernel/desktop-procs.c index 65599b39..7996d4d8 100644 --- a/src/kernel/desktop-procs.c +++ b/src/kernel/desktop-procs.c @@ -39,6 +39,13 @@ #include "drawsemop.h" #include "devfont.h" +#ifndef _MG_ENABLE_SCREENSAVER +# define SERVER_HAS_NO_MAINWINDOW() (nr_of_all_znodes() == 0) +#else + /* The screensaver occupys one znode */ +# define SERVER_HAS_NO_MAINWINDOW() (nr_of_all_znodes() == 1) +#endif +# define CLIENT_HAS_NO_MAINWINDOW() (znodes_of_this_client() == 0) /******************************* global data *********************************/ MSGQUEUE __mg_desktop_msg_queue; @@ -1411,6 +1418,12 @@ static int dskAddNewMainWindow (PMAINWIN pWin) if (pWin->dwExStyle & WS_EX_AUTOSECONDARYDC) pWin->secondaryDC = CreateSecondaryDC ((HWND)pWin); + if (pWin->secondaryDC == HDC_INVALID) { + /* remove the flag of WS_EX_AUTOSECONDARYDC */ + pWin->dwExStyle = pWin->dwExStyle | WS_EX_AUTOSECONDARYDC; + pWin->secondaryDC = 0; + } + /* Create private client dc. */ if (pWin->dwExStyle & WS_EX_USEPRIVATECDC) { if (pWin->dwExStyle & WS_EX_AUTOSECONDARYDC) @@ -2961,13 +2974,7 @@ static int srvDesktopCommand (int id) unlock_zi_for_read (__mg_zorder_info); } else if (id == IDM_ENDSESSION) { - if ( -#ifdef _MG_ENABLE_SCREENSAVER - nr_of_all_znodes () <= 1 /* There is a window for screensaver */ -#else - nr_of_all_znodes () <= 0 -#endif - ){ + if ( SERVER_HAS_NO_MAINWINDOW() ){ ExitGUISafely (-1); } } @@ -3082,7 +3089,7 @@ static int cliSesseionMessageHandler (int message, WPARAM wParam, LPARAM lParam) break; case MSG_ENDSESSION: - if (znodes_of_this_client () == 0) { + if (CLIENT_HAS_NO_MAINWINDOW()) { PostQuitMessage (HWND_DESKTOP); return 1; } @@ -3392,13 +3399,9 @@ static int srvSesseionMessageHandler (int message, WPARAM wParam, LPARAM lParam) break; case MSG_ENDSESSION: - if ( -#ifdef _MG_ENABLE_SCREENSAVER - nr_of_all_znodes () <= 1 /* There is a window for screensaver */ -#else - nr_of_all_znodes () <= 0 -#endif - ) { + if (SERVER_HAS_NO_MAINWINDOW()) { + screensaver_destroy(); + if (hDesktopDC) { ReleaseDC (hDesktopDC); hDesktopDC = 0; @@ -3642,7 +3645,7 @@ int DesktopWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) } if (__mg_quiting_stage > _MG_QUITING_STAGE_DESKTOP - && (__mg_zorder_info->nr_normals + __mg_zorder_info->nr_topmosts) == 0) { + && (mgIsServer ? SERVER_HAS_NO_MAINWINDOW() : CLIENT_HAS_NO_MAINWINDOW())) { __mg_quiting_stage = _MG_QUITING_STAGE_DESKTOP; }else if (__mg_quiting_stage <= _MG_QUITING_STAGE_DESKTOP) { PostMessage (HWND_DESKTOP, MSG_ENDSESSION, 0, 0); @@ -3657,4 +3660,3 @@ int DesktopWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) } #endif - diff --git a/src/kernel/event.c b/src/kernel/event.c index 114d891a..589eb552 100644 --- a/src/kernel/event.c +++ b/src/kernel/event.c @@ -302,8 +302,6 @@ BOOL kernel_GetLWEvent (int event, PLWEVENT lwe) if (!IAL_UpdateMouse ()) return 0; - license_on_input(); - lwe->type = LWETYPE_MOUSE; if (kernel_RefreshCursor(&me->x, &me->y, &button)) { me->event = ME_MOVED; @@ -317,24 +315,23 @@ BOOL kernel_GetLWEvent (int event, PLWEVENT lwe) if ( !(oldbutton & IAL_MOUSE_LEFTBUTTON) && (button & IAL_MOUSE_LEFTBUTTON) ) { - if (time1) { - interval = __mg_timer_counter - time1; - if (interval <= dblclicktime) - me->event = ME_LEFTDBLCLICK; - else - me->event = ME_LEFTDOWN; - time1 = 0; - } - else { - time1 = __mg_timer_counter; + license_on_input(); + + interval = __mg_timer_counter - time1; + if (interval <= dblclicktime) + me->event = ME_LEFTDBLCLICK; + else me->event = ME_LEFTDOWN; - } + time1 = __mg_timer_counter; + goto mouseret; } if ( (oldbutton & IAL_MOUSE_LEFTBUTTON) && !(button & IAL_MOUSE_LEFTBUTTON) ) { + license_on_input(); + me->event = ME_LEFTUP; goto mouseret; } @@ -342,18 +339,13 @@ BOOL kernel_GetLWEvent (int event, PLWEVENT lwe) if ( !(oldbutton & IAL_MOUSE_RIGHTBUTTON) && (button & IAL_MOUSE_RIGHTBUTTON) ) { - if (time2) { - interval = __mg_timer_counter - time2; - if (interval <= dblclicktime) - me->event = ME_RIGHTDBLCLICK; - else - me->event = ME_RIGHTDOWN; - time2 = 0; - } - else { - time2 = __mg_timer_counter; + interval = __mg_timer_counter - time2; + if (interval <= dblclicktime) + me->event = ME_RIGHTDBLCLICK; + else me->event = ME_RIGHTDOWN; - } + time2 = __mg_timer_counter; + goto mouseret; } @@ -572,15 +564,15 @@ BOOL kernel_GetLWEvent (int event, PLWEVENT lwe) return 1; } + old_lwe.type = 0; + return 0; } timeout_count = 0; /* There was an event occurred. */ if (event & IAL_MOUSEEVENT) { - license_on_input(); - lwe->type = LWETYPE_MOUSE; if (kernel_RefreshCursor(&me->x, &me->y, &button)) { @@ -596,24 +588,23 @@ BOOL kernel_GetLWEvent (int event, PLWEVENT lwe) if ( !(oldbutton & IAL_MOUSE_LEFTBUTTON) && (button & IAL_MOUSE_LEFTBUTTON) ) { - if (time1) { - interval = __mg_timer_counter - time1; - if (interval <= dblclicktime) - me->event = ME_LEFTDBLCLICK; - else - me->event = ME_LEFTDOWN; - time1 = 0; - } - else { - time1 = __mg_timer_counter; + license_on_input(); + + interval = __mg_timer_counter - time1; + if (interval <= dblclicktime) + me->event = ME_LEFTDBLCLICK; + else me->event = ME_LEFTDOWN; - } + time1 = __mg_timer_counter; + goto mouseret; } if ( (oldbutton & IAL_MOUSE_LEFTBUTTON) && !(button & IAL_MOUSE_LEFTBUTTON) ) { + license_on_input(); + me->event = ME_LEFTUP; goto mouseret; } @@ -621,18 +612,13 @@ BOOL kernel_GetLWEvent (int event, PLWEVENT lwe) if ( !(oldbutton & IAL_MOUSE_RIGHTBUTTON) && (button & IAL_MOUSE_RIGHTBUTTON) ) { - if (time2) { - interval = __mg_timer_counter - time2; - if (interval <= dblclicktime) - me->event = ME_RIGHTDBLCLICK; - else - me->event = ME_RIGHTDOWN; - time2 = 0; - } - else { - time2 = __mg_timer_counter; + interval = __mg_timer_counter - time2; + if (interval <= dblclicktime) + me->event = ME_RIGHTDBLCLICK; + else me->event = ME_RIGHTDOWN; - } + time2 = __mg_timer_counter; + goto mouseret; } diff --git a/src/kernel/init-lite.c b/src/kernel/init-lite.c index 99209b03..b3177555 100644 --- a/src/kernel/init-lite.c +++ b/src/kernel/init-lite.c @@ -48,7 +48,7 @@ static struct termios savedtermio; #define err_message(step, message) fprintf (stderr, "KERNEL>InitGUI (step %d): %s\n", step, message) -static void segvsig_handler (int v) +static void sig_handler (int v) { ; } @@ -219,7 +219,7 @@ failure: #define err_message(step, message) fprintf (stderr, "KERNEL>InitGUI (step %d): %s\n", step, message) -static void segvsig_handler (int v) +static void sig_handler (int v) { if (v == SIGSEGV) { #ifdef WIN32 @@ -237,13 +237,13 @@ static void segvsig_handler (int v) static BOOL InstallSEGVHandler (void) { #ifdef WIN32 - signal(SIGSEGV, segvsig_handler); - signal(SIGTERM, segvsig_handler); - signal(SIGINT, segvsig_handler); + signal(SIGSEGV, sig_handler); + signal(SIGTERM, sig_handler); + signal(SIGINT, sig_handler); #else struct sigaction siga; - siga.sa_handler = segvsig_handler; + siga.sa_handler = sig_handler; siga.sa_flags = 0; memset (&siga.sa_mask, 0, sizeof (sigset_t)); @@ -473,8 +473,6 @@ void TerminateGUI (int rcByGUI) { /* printf("Quit from MiniGUIMain()\n"); */ - screensaver_destroy(); - DestroyDskMsgQueue (); mg_DestroyFreeQMSGList (); mg_TerminateAccel (); diff --git a/src/kernel/init.c b/src/kernel/init.c index 5913f2fc..065d160d 100644 --- a/src/kernel/init.c +++ b/src/kernel/init.c @@ -291,7 +291,7 @@ void* GUIAPI GetOriginalTermIO (void) return &savedtermio; } -static void segvsig_handler (int v) +static void sig_handler (int v) { if (v == SIGSEGV) { kill (getpid(), SIGABRT); /* cause core dump */ @@ -306,7 +306,7 @@ static BOOL InstallSEGVHandler (void) { struct sigaction siga; - siga.sa_handler = segvsig_handler; + siga.sa_handler = sig_handler; siga.sa_flags = 0; memset (&siga.sa_mask, 0, sizeof (sigset_t)); @@ -521,8 +521,6 @@ void GUIAPI TerminateGUI (int not_used) { /* printf("Quit from MiniGUIMain()\n"); */ - screensaver_destroy(); - __mg_enter_terminategui = 1; pthread_join (__mg_desktop, NULL); @@ -557,6 +555,9 @@ void GUIAPI TerminateGUI (int not_used) mg_TerminateLFManager (); mg_TerminateGAL (); + extern void mg_miFreeArcCache (void); + mg_miFreeArcCache (); + /* * Restore original termio *tcsetattr (0, TCSAFLUSH, &savedtermio); diff --git a/src/kernel/timer.c b/src/kernel/timer.c index dda4e398..f38783b1 100644 --- a/src/kernel/timer.c +++ b/src/kernel/timer.c @@ -51,6 +51,16 @@ static pthread_mutex_t timerLock; #define TIMER_UNLOCK() #endif +#ifdef _MGGAL_S3C6410 +# define _MG_USE_BETTER_TIMER +#endif /* __NOUNIX__ */ + +#ifdef _MG_USE_BETTER_TIMER +#include +static clock_t g_timer_started; +static clock_t g_last_tick; +#endif + /* timer action for minigui timers */ static void __mg_timer_action (void *data) { @@ -61,7 +71,11 @@ static void __mg_timer_action (void *data) #if defined(__uClinux__) && defined(_MGRM_STANDALONE) __mg_timer_counter += 10; #else +# ifdef _MG_USE_BETTER_TIMER + __mg_timer_counter = times(NULL) - g_timer_started; +# else /* _MG_USE_BETTER_TIMER */ __mg_timer_counter ++; +# endif /* _MG_USE_BETTER_TIMER */ #endif #endif @@ -86,6 +100,11 @@ static void* TimerEntry (void* data) { sem_post ((sem_t*)data); +#ifdef _MG_USE_BETTER_TIMER + g_timer_started = times(NULL); + g_last_tick = 0; +#endif /* _MG_USE_BETTER_TIMER */ + while (__mg_quiting_stage > _MG_QUITING_STAGE_TIMER) { __mg_os_time_delay (10); __mg_timer_action (NULL); @@ -239,6 +258,13 @@ void mg_dispatch_timer_message (unsigned int inter) { int i; +#ifdef _MG_USE_BETTER_TIMER + clock_t now = __mg_timer_counter; + + inter = now - g_last_tick; + g_last_tick = now; +#endif /* _MG_USE_BETTER_TIMER */ + TIMER_LOCK (); for (i=0; i--- pStackBase, pTcb + * |//// 16 bytes ////| (16 bytes clobbered during objFree() + * | | in taskDestroy are not accounted for) + * | | + * | TASK STACK | + * | | + * | | + * -------------------->--- pTaskMem + * - LOW MEMORY - + *.CE + * + * + * For _STACK_GROWS_UP: + * + *.CS + * - HIGH MEMORY - + * --------------------- + * | | + * | | + * | TASK STACK | + * | | + * | | + * -------------------->--- pStackBase + * | | + * | WIND_TCB | + * | | + * -------------------->--- pTcb + * |//// 16 bytes ////| (16 bytes clobbered during objFree() of taskDestroy) + * -------------------->--- pTaskMem + * - LOW MEMORY - + *.CE + * + */ + +#if (_STACK_DIR == _STACK_GROWS_DOWN) + stacksize -= (STACK_ROUND_DOWN(sizeof(pthread_info))); + stackbase += stacksize; + nthread = (pthread_info *)stackbase; +#else + //16 bytes clobbered during objFree() in taskDestroy are not accounted for. + nthread = (pthread_info *)(stackbase + 16); + stackbase += STACK_ROUND_UP(16 + sizeof(pthread_info)); + stacksize -= STACK_ROUND_UP(16 + sizeof(pthread_info)); +#endif - stackbase += sizeof(pthread_info); - stacksize -= sizeof(pthread_info); - thread_table [thread_next] = nthread; // Set new next index @@ -426,7 +475,7 @@ int pthread_create (pthread_t *thread, nthread->cancelbuffer = NULL; nthread->cancelpending = FALSE; - nthread->thread_data = NULL; + memset(nthread->thread_data, 0, PTHREAD_KEYS_MAX); /* Initialize the joiner event flag */ nthread->joiner = semBCreate (SEM_Q_PRIORITY, SEM_FULL); @@ -439,9 +488,8 @@ int pthread_create (pthread_t *thread, /* create the underlying VxWorks task */ vx_ret = taskInit (&nthread->tcb, nthread->name, use_attr.schedparam.priority, - 0, /* options, FIXME */ - /* FIXME, stack down or up depends on the target architecture */ - stackbase+stacksize, stacksize, pthread_entry, + VX_NO_STACK_FILL, + stackbase, stacksize, pthread_entry, (int)nthread, 0, 0, 0, 0, 0, 0, 0, 0, 0); if (vx_ret == ERROR) { @@ -1249,16 +1297,6 @@ int pthread_setspecific (pthread_key_t key, const void *pointer) self = pthread_self_info (); - if (self->thread_data == NULL) { - int i; - // Allocate the per-thread data table - self->thread_data = (void **)(self->stackmem + sizeof (pthread_info)); - - // Clear out all entries - for (i = 0; i < PTHREAD_KEYS_MAX; i++) - self->thread_data[i] = NULL; - } - self->thread_data[key] = (void *)pointer; PTHREAD_RETURN (0); diff --git a/src/misc/license.c b/src/misc/license.c index 39330cb7..8967e0d0 100644 --- a/src/misc/license.c +++ b/src/misc/license.c @@ -31,6 +31,24 @@ defined(_MG_ENABLE_WATERMARK) BITMAP g_license_bitmaps[LICENSE_BITMAP_NR]; +#ifndef _MG_LICENSE_SCREENSAVER_TIMEOUT +#define _MG_LICENSE_SCREENSAVER_TIMEOUT (10*100) +#endif + +#ifndef _MG_LICENSE_SCREENSAVER_UPDATE_TIME +#define _MG_LICENSE_SCREENSAVER_UPDATE_TIME (2*100) +#endif + +/* step of splash */ +#ifndef _MG_LICENSE_SPLASH_STEP +#define _MG_LICENSE_SPLASH_STEP (25) +#endif + +/* one frame */ +#ifndef _MG_LICENSE_SPLASH_MSEC +#define _MG_LICENSE_SPLASH_MSEC (40) +#endif + #if defined(_MG_ENABLE_SCREENSAVER) || \ defined(_MG_ENABLE_WATERMARK) static int s_tick_last_input; @@ -120,14 +138,14 @@ static void watermark_init(void) #ifdef _MG_ENABLE_SCREENSAVER static int s_screensaver_node; -static void screensaver_show(void) +void screensaver_show(void) { - dskSetTopForEver(0, s_screensaver_node, TRUE); + dskSetTopForEver(0, s_screensaver_node, TRUE); } -static void screensaver_hide(void) +void screensaver_hide(void) { - dskSetTopForEver(0, s_screensaver_node, FALSE); + dskSetTopForEver(0, s_screensaver_node, FALSE); } void screensaver_create(void) @@ -298,9 +316,12 @@ void splash_progress (void) void splash_delay (void) { int i; - for(i = 0; __mg_quiting_stage>0 && i < 10*5; i++) { + + for (i = 0; + __mg_quiting_stage > 0 && i < _MG_LICENSE_SPLASH_STEP; + i++) { splash_progress(); - __mg_os_time_delay(50); + __mg_os_time_delay (_MG_LICENSE_SPLASH_MSEC); } } @@ -394,9 +415,11 @@ char *LICENSE_ENCRYPTED_CONST_STRING(unsigned char *src, int len){ static unsigned char calc_sum(int len, const unsigned char *data) { unsigned char sum; int i; + for (i=0, sum=0; i FRAGMENT_SIZE - sizeof(unsigned char)) ? (FRAGMENT_SIZE - sizeof(unsigned char)) : (in_len - i); RC4(key, n, &in[i], &in[out_len]); + if (calc_sum(n, &in[out_len]) != sum) { assert(0); return -1; } + i += n; out_len += n; } @@ -437,7 +462,7 @@ void license_create(void) { unsigned char *data; int len; #ifdef ENCRYPTED - RC4_KEY rc4key; + RC4_KEY rc4key; #endif data = (unsigned char *)malloc(__mg_splash_splash_inner_res[i].data_len); @@ -472,22 +497,36 @@ void license_on_input(void) { s_tick_last_input = GetTickCount(); - if (screensaver_running == TRUE){ + if (screensaver_running == TRUE) { screensaver_running = FALSE; - screensaver_hide(); + #if defined(_MGRM_THREADS) - SendNotifyMessage (HWND_DESKTOP, MSG_PAINT, 0, 0); -#elif defined(_MGRM_PROCESSES) + { + HWND activeWnd = GetActiveWindow(); + if (activeWnd) { + SendNotifyMessage(activeWnd, MSG_CANCELSCREENSAVER, 0, 0); + } else { + screensaver_hide(); + SendNotifyMessage (HWND_DESKTOP, MSG_PAINT, 0, 0); + } + } +#else + screensaver_hide(); +#if defined(_MGRM_PROCESSES) dskRefreshAllClient (&g_rcScr); #elif defined(_MGRM_STANDALONE) SendNotifyMessage (HWND_DESKTOP, MSG_PAINT, 0, 0); #else # error #endif + +#endif + } } -void license_on_timeout(void) { +void license_on_timeout(void) +{ static unsigned int old_tick_count; unsigned int current_tick_count; @@ -499,16 +538,15 @@ void license_on_timeout(void) { current_tick_count = GetTickCount(); - if (screensaver_running == TRUE) - { + if (screensaver_running == TRUE) { /* screensaver is running, update the picture */ - if ((current_tick_count - old_tick_count) > 2 * 100) { + if ((current_tick_count - old_tick_count) > _MG_LICENSE_SCREENSAVER_UPDATE_TIME) { old_tick_count = current_tick_count; screensaver_update(); } } else { /* screensaver is not running, show it */ - if ((current_tick_count - s_tick_last_input) > 10 * 100) { + if ((current_tick_count - s_tick_last_input) > _MG_LICENSE_SCREENSAVER_TIMEOUT) { screensaver_running = TRUE; screensaver_show(); } diff --git a/src/misc/listenfd.c b/src/misc/listenfd.c index 46a528fa..40b08f36 100644 --- a/src/misc/listenfd.c +++ b/src/misc/listenfd.c @@ -26,6 +26,7 @@ #include "minigui.h" #include "ourhdr.h" +#include "mgsock.h" LISTEN_FD mg_listen_fds [MAX_NR_LISTEN_FD]; static fd_set _wfdset, _efdset; @@ -52,23 +53,23 @@ BOOL GUIAPI RegisterListenFD (int fd, int type, HWND hwnd, void* context) mg_listen_fds [i].context = context; switch (type) { case POLLIN: - FD_SET (fd, &mg_rfdset); + mg_fd_set (fd, &mg_rfdset); break; case POLLOUT: if (mg_wfdset == NULL) { mg_wfdset = &_wfdset; - FD_ZERO (mg_wfdset); + mg_fd_zero (mg_wfdset); } - FD_SET (fd, mg_wfdset); + mg_fd_set (fd, mg_wfdset); break; case POLLERR: if (mg_efdset == NULL) { mg_efdset = &_efdset; - FD_ZERO (mg_efdset); + mg_fd_zero (mg_efdset); } - FD_SET (fd, mg_efdset); + mg_fd_set (fd, mg_efdset); break; } @@ -90,19 +91,19 @@ BOOL GUIAPI UnregisterListenFD (int fd) mg_listen_fds [i].fd = 0; switch (mg_listen_fds [i].type) { case POLLIN: - FD_CLR (fd, &mg_rfdset); + mg_fd_clr (fd, &mg_rfdset); break; case POLLOUT: if (mg_wfdset == NULL) return FALSE; - FD_CLR (fd, mg_wfdset); + mg_fd_clr (fd, mg_wfdset); break; case POLLERR: if (mg_efdset == NULL) return FALSE; - FD_CLR (fd, mg_efdset); + mg_fd_clr (fd, mg_efdset); break; } diff --git a/src/mybmp/png.c b/src/mybmp/png.c index 0d3d294d..abb37063 100644 --- a/src/mybmp/png.c +++ b/src/mybmp/png.c @@ -16,6 +16,9 @@ #include #include #include +#ifdef WIN32 +# include +#endif #include "common.h" #include "gdi.h" @@ -192,8 +195,13 @@ void * __mg_init_png(MG_RWops * fp, MYBITMAP * mybmp, RGB * pal) png_set_packing(*png_ptr); /* Expand grayscale images to the full 8 bits from 1, 2, or 4 bits/pixel */ - if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) + if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) { +#ifdef WIN32 + assert(0); /* XXX: */ +#else png_set_gray_1_2_4_to_8(*png_ptr); +#endif + } /* Expand paletted colors into true RGB triplets */ if (color_type == PNG_COLOR_TYPE_PALETTE) diff --git a/src/mybmp/winbmp.c b/src/mybmp/winbmp.c index 97a13b3f..c3e0f949 100644 --- a/src/mybmp/winbmp.c +++ b/src/mybmp/winbmp.c @@ -382,13 +382,18 @@ void * __mg_init_bmp (MG_RWops* fp, MYBITMAP * bmp, RGB * pal) MGUI_RWseek (fp, biSize - WININFOHEADERSIZE, SEEK_CUR); ncol = (fileheader.bfOffBits - biSize - 14) / 4; - read_bmicolors(ncol, pal, fp, 1); + + /* there only 1,4,8 bit read color panel data */ + if (infoheader.biBitCount <= 8) + read_bmicolors(ncol, pal, fp, 1); } else if (biSize == OS2INFOHEADERSIZE) { if (read_os2_bminfoheader (fp, &infoheader) != 0) goto err; ncol = (fileheader.bfOffBits - 26) / 3; - read_bmicolors (ncol, pal, fp, 0); + + if (infoheader.biBitCount <= 8) + read_bmicolors (ncol, pal, fp, 0); } else goto err; @@ -436,7 +441,6 @@ int __mg_load_bmp(MG_RWops* fp, void* init_info, MYBITMAP *bmp, CB_ONE_SCANLINE switch (info->biCompression) { case BI_BITFIELDS: - MGUI_RWseek (fp, -16, SEEK_CUR); info->rmask = fp_igetl(fp); info->gmask = fp_igetl(fp); info->bmask = fp_igetl(fp); @@ -463,6 +467,7 @@ int __mg_load_bmp(MG_RWops* fp, void* init_info, MYBITMAP *bmp, CB_ONE_SCANLINE bits = bmp->bits + (bmp->h - 1) * pitch; for (i = bmp->h - 1; i >= 0; i--, bits -= pitch) { switch (info->biCompression) { + case BI_BITFIELDS: case BI_RGB: if (info->biBitCount == 16) read_16bit_image(fp, bits, bmp->pitch, bmp->w, info->gmask); diff --git a/src/newgal/CMakeLists.txt b/src/newgal/CMakeLists.txt index 54f69d8a..23838feb 100644 --- a/src/newgal/CMakeLists.txt +++ b/src/newgal/CMakeLists.txt @@ -1,29 +1,38 @@ # add sub dirs -mg_add_sub_dir_with_condition (dummy _MGGAL_DUMMY) mg_add_sub_dir_with_condition (fbcon _MGGAL_FBCON) + +mg_add_sub_dir_with_condition (dfb _MGGAL_DFB) + +mg_add_sub_dir_with_condition (dummy _MGGAL_DUMMY) mg_add_sub_dir_with_condition (qvfb _MGGAL_QVFB) mg_add_sub_dir_with_condition (wvfb _MGGAL_WVFB) -mg_add_sub_dir_with_condition (em85xxyuv _MGGAL_EM85XXYUV) -mg_add_sub_dir_with_condition (svpxxosd _MGGAL_SVPXXOSD) -mg_add_sub_dir_with_condition (bf533 _MGGAL_BF533) -mg_add_sub_dir_with_condition (utpmc _MGGAL_UTPMC) -mg_add_sub_dir_with_condition (mb93493 _MGGAL_MB93493) mg_add_sub_dir_with_condition (commlcd _MGGAL_COMMLCD) mg_add_sub_dir_with_condition (shadow _MGGAL_SHADOW) mg_add_sub_dir_with_condition (mlshadow _MGGAL_MLSHADOW) -mg_add_sub_dir_with_condition (dfb _MGGAL_DFB) +mg_add_sub_dir_with_condition (em85xxosd _MGGAL_EM85XXOSD) +mg_add_sub_dir_with_condition (em85xxyuv _MGGAL_EM85XXYUV) mg_add_sub_dir_with_condition (em86gfx _MGGAL_EM86GFX) -mg_add_sub_dir_with_condition (rtos_xvfb _MGGAL_RTOSXVFB) -mg_add_sub_dir_with_condition (pcxvfb _MGGAL_PCXVFB) +mg_add_sub_dir_with_condition (svpxxosd _MGGAL_SVPXXOSD) +mg_add_sub_dir_with_condition (bf533 _MGGAL_BF533) +mg_add_sub_dir_with_condition (mb93493 _MGGAL_MB93493) +mg_add_sub_dir_with_condition (utpmc _MGGAL_UTPMC) mg_add_sub_dir_with_condition (nexus _MGGAL_NEXUS) mg_add_sub_dir_with_condition (s3c6410 _MGGAL_S3C6410) +#mg_add_sub_dir_with_condition (customgal _MGGAL_CUSTOMGAL) mg_add_sub_dir_with_condition (sigma8654 _MGGAL_SIGMA8654) mg_add_sub_dir_with_condition (mstar _MGGAL_MSTAR) +mg_add_sub_dir_with_condition (hisi _MGGAL_HI3560A) mg_add_sub_dir_with_condition (gdl _MGGAL_GDL) +mg_add_sub_dir_with_condition (dfb _MGGAL_ST7167) +mg_add_sub_dir_with_condition (stgfb _MGGAL_STGFB) + +mg_add_sub_dir_with_condition (pcxvfb _MGGAL_PCXVFB) +mg_add_sub_dir_with_condition (rtos_xvfb _MGGAL_RTOSXVFB) + if (_MGGAL_HI3560 OR _MGGAL_HI3510) mg_add_sub_source_dirs (hisi) -endif (_MGGAL_HI3560 OR _MGGAL_HI3510 ) +endif (_MGGAL_HI3560 OR _MGGAL_HI3510) # add all current sources list (APPEND newgal_sources diff --git a/src/newgal/mlshadow/mlshadow-ths.c b/src/newgal/mlshadow/mlshadow-ths.c index 4d31e9bd..ec7f994b 100644 --- a/src/newgal/mlshadow/mlshadow-ths.c +++ b/src/newgal/mlshadow/mlshadow-ths.c @@ -638,7 +638,7 @@ static void refresh_surface (_THIS, RECT* updaterect) * paint the cache surface to real surface... */ if(this->hidden->swap_surface && !IsRectEmpty(&updatecache_rect)){ - static int cc = 0; + //static int cc = 0; GAL_Rect rect = {0}; rect.x = updatecache_rect.left; rect.y = updatecache_rect.top; diff --git a/src/newgal/pcxvfb/pcxvfb-winfb.c b/src/newgal/pcxvfb/pcxvfb-winfb.c index e4e5c59b..0b081e86 100644 --- a/src/newgal/pcxvfb/pcxvfb-winfb.c +++ b/src/newgal/pcxvfb/pcxvfb-winfb.c @@ -56,7 +56,7 @@ void win_PCXVFbUnlock (void) } -static char *_map_file = "C:\\WVFBScreenMap-"; +static char *_map_file = "WVFBScreenMap-"; static g_map_file[128]; HANDLE g_map_file_handle; @@ -120,15 +120,14 @@ void* win_PCXVFbInit (char* execl_file, char* etc_param, const char *skin) listen((SOCKET)__mg_pcxvfb_server_sockfd, 3); memset (cmdline, 0, sizeof (cmdline)); - //sprintf(cmdline,"wvfb %d %s %dx%d-%dbpp", pid, caption, width, height, depth); + /* sprintf(cmdline,"wvfb %d %s %dx%d-%dbpp", pid, caption, width, height, depth); */ if (skin && skin[0]) { sprintf(cmdline,"%s %d %s %dx%d-%dbpp %s", execl_file, pid, caption, width, height, depth, skin); }else{ sprintf(cmdline,"%s %d %s %dx%d-%dbpp", execl_file, pid, caption, width, height, depth); } - // start wvfb2.exe ...... - //if (!CreateProcess(execl_file, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) { + /* start wvfb2.exe ...... */ if (!CreateProcess(NULL, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) { printf("cannot CreateProcess %s (%d).\n", execl_file, GetLastError()); return 0; @@ -140,7 +139,11 @@ void* win_PCXVFbInit (char* execl_file, char* etc_param, const char *skin) (struct sockaddr *)&c_addr, &client_len); datalen = pitch * height + color_num * sizeof(XVFBPalEntry) + sizeof(XVFBHeader); - sprintf(g_map_file, "%s-%d", _map_file, pid); + { + char tmp[MAX_PATH]; + GetTempPath(sizeof(tmp)/sizeof(tmp[0]), tmp); + sprintf (g_map_file, "%s/%s-%d", tmp, _map_file, pid); + } g_map_file_handle = CreateFile(g_map_file, GENERIC_READ | GENERIC_WRITE, diff --git a/src/newgal/pcxvfb/pcxvfb.c b/src/newgal/pcxvfb/pcxvfb.c index 41bca1e3..d4c27f05 100644 --- a/src/newgal/pcxvfb/pcxvfb.c +++ b/src/newgal/pcxvfb/pcxvfb.c @@ -39,6 +39,8 @@ typedef int key_t; #include #include #include +#include + #else /* win32 */ #include "pcxvfb-winfb.h" @@ -269,6 +271,47 @@ VideoBootStrap PCXVFB_bootstrap = { PCXVFB_Available, PCXVFB_CreateDevice }; +#ifndef WIN32 +static int my_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout) { + struct timeval _tv, *tv; + struct timeval start, now; + int ret; + + if (timeout) { + gettimeofday(&start, NULL); + memcpy(&_tv, timeout, sizeof(_tv)); + tv = &_tv; + }else{ + tv = NULL; + } + + for (;;) { + ret = select(nfds, readfds, writefds, exceptfds, tv); + if (ret == -1 && errno == EINTR) { + if (timeout) { + gettimeofday(&now, NULL); + ret = (timeout->tv_sec * 1000000 + timeout->tv_usec) + - ((now.tv_sec - start.tv_sec) * 1000000 + (now.tv_usec - start.tv_usec)); + if (ret <= 0) { + return 0; /* Timeout */ + }else{ + _tv.tv_sec = ret / 1000000; + _tv.tv_usec = ret % 1000000; + continue; + } + }else{ + continue; + } + }else{ + return ret; + } + } + + /* XXX: Never reach here */ + return -1; +} +#endif + static int PCXVFB_VideoInit (_THIS, GAL_PixelFormat *vformat) { int i; @@ -398,7 +441,7 @@ static int PCXVFB_VideoInit (_THIS, GAL_PixelFormat *vformat) char socket_file [50]; int shmid; -#ifndef _MGRM_THREADS +#ifdef _MGRM_PROCESSES FILE *fp; #endif @@ -426,6 +469,9 @@ static int PCXVFB_VideoInit (_THIS, GAL_PixelFormat *vformat) }else if (pid > 0) { ;/* do nothing */ }else { + if (setpgid(getpid(), 0) < 0) { + fprintf(stderr, "Warning: Failed to change the group id of the VFB process.\n"); + } if (execl_pcxvfb() == ERR_CONFIG_FILE) fprintf(stderr, "PCXVFB GAL: Reading configuration failure!\n"); @@ -437,10 +483,39 @@ static int PCXVFB_VideoInit (_THIS, GAL_PixelFormat *vformat) if (GetMgEtcIntValue ("qvfb", "display", &display) < 0) display = 0; + { + fd_set rset; + struct timeval tv; + + FD_ZERO(&rset); + FD_SET(__mg_pcxvfb_server_sockfd, &rset); + tv.tv_sec = 2; + tv.tv_usec = 0; + if (my_select(__mg_pcxvfb_server_sockfd + 1, &rset, NULL, NULL, &tv) != 1) { + GAL_SetError ("NEWGAL>PCXVFB: Wait too long for CLIENT.\n"); + close(__mg_pcxvfb_server_sockfd); + return -1; + } + } __mg_pcxvfb_client_sockfd = accept (__mg_pcxvfb_server_sockfd, (struct sockaddr *)&client_address, &client_len); + { + fd_set rset; + struct timeval tv; + + FD_ZERO(&rset); + FD_SET(__mg_pcxvfb_client_sockfd, &rset); + tv.tv_sec = 2; + tv.tv_usec = 0; + if (my_select(__mg_pcxvfb_client_sockfd + 1, &rset, NULL, NULL, &tv) != 1) { + GAL_SetError ("NEWGAL>PCXVFB: Wait too long for SHMID.\n"); + close(__mg_pcxvfb_client_sockfd); + close(__mg_pcxvfb_server_sockfd); + return -1; + } + } read(__mg_pcxvfb_client_sockfd, &shmid, sizeof(int)); if (shmid != -1) { diff --git a/src/newgal/pixels.c b/src/newgal/pixels.c index 00a29666..2f8bb8fc 100644 --- a/src/newgal/pixels.c +++ b/src/newgal/pixels.c @@ -628,8 +628,15 @@ int GAL_MapSurface (GAL_Surface *src, GAL_Surface *dst) break; default: /* BitField --> BitField */ - if ( FORMAT_EQUAL(srcfmt, dstfmt) ) + if ( +#ifdef _MGGAL_S3C6410 + (((src->flags & GAL_HWSURFACE) == GAL_HWSURFACE) && ((dst->flags & GAL_HWSURFACE) == GAL_HWSURFACE)) + || +#endif + FORMAT_EQUAL(srcfmt, dstfmt) + ) { map->identity = 1; + } break; } break; diff --git a/src/newgal/s3c6410/gal-s3c6410.c b/src/newgal/s3c6410/gal-s3c6410.c index ca0367c6..e333ad2b 100644 --- a/src/newgal/s3c6410/gal-s3c6410.c +++ b/src/newgal/s3c6410/gal-s3c6410.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "common.h" #include "minigui.h" @@ -42,6 +43,57 @@ # define ISSERVER (1) #endif +int s3c6410_size_table[48] = { + 290, /* speed: 4775 */ + 370, /* speed: 4688 */ + 220, /* speed: 5125 */ + 240, /* speed: 3925 */ + 210, /* speed: 3856 */ + 170, /* speed: 3968 */ + 170, /* speed: 3461 */ + 140, /* speed: 3861 */ + 130, /* speed: 3616 */ + 120, /* speed: 3413 */ + 110, /* speed: 3530 */ + 100, /* speed: 3584 */ + 90, /* speed: 3530 */ + 80, /* speed: 3664 */ + 90, /* speed: 3285 */ + 80, /* speed: 3552 */ + 80, /* speed: 3184 */ + 80, /* speed: 3088 */ + 70, /* speed: 3306 */ + 70, /* speed: 3200 */ + 70, /* speed: 3061 */ + 60, /* speed: 3280 */ + 60, /* speed: 3189 */ + 50, /* speed: 3733 */ + 70, /* speed: 2698 */ + 50, /* speed: 3296 */ + 40, /* speed: 3813 */ + 50, /* speed: 3194 */ + 50, /* speed: 3082 */ + 70, /* speed: 2330 */ + 40, /* speed: 3477 */ + 30, /* speed: 4458 */ + 50, /* speed: 2810 */ + 30, /* speed: 3957 */ + 40, /* speed: 3168 */ + 50, /* speed: 2656 */ + 40, /* speed: 3061 */ + 30, /* speed: 3658 */ + 30, /* speed: 3610 */ + 40, /* speed: 3061 */ + 30, /* speed: ? */ + 30, /* speed: ? */ + 30, /* speed: ? */ + 30, /* speed: ? */ + 20, /* speed: ? */ + 20, /* speed: ? */ + 20, /* speed: ? */ + 20, /* speed: ? */ +}; + /* Initialization/Query functions */ static int S3C6410_VideoInit(_THIS, GAL_PixelFormat *vformat); static GAL_Rect **S3C6410_ListModes(_THIS, GAL_PixelFormat *format, Uint32 flags); @@ -186,7 +238,7 @@ static int S3C6410_VideoInit(_THIS, GAL_PixelFormat *vformat) video_info->blit_fill = 0; video_info->blit_hw = 1; video_info->blit_hw_CC = 0; - video_info->blit_hw_A = 0; + video_info->blit_hw_A = 1; } return(0); @@ -269,7 +321,71 @@ S3C6410_CheckHWBlit(_THIS, GAL_Surface * src, GAL_Surface * dst) return 0; } -static void setup_param(GAL_Surface *src, GAL_Surface *dst, s3c_g2d_params *param) { +static unsigned int get_colormode(GAL_Surface *surface) { + GAL_PixelFormat *format = surface->format; + switch (format->BytesPerPixel) { + case 2: + if (1 + && format->Amask == 0x0000 + && format->Rmask == 0xF800 + && format->Gmask == 0x07E0 + && format->Bmask == 0x001F) { + return S3C_G2D_COLOR_RGB_565; + }else if (1 + && format->Rmask == 0x7C00 + && format->Gmask == 0x03E0 + && format->Bmask == 0x001F + ) { + if ((surface->flags & GAL_SRCPIXELALPHA) && format->Amask == 0x8000){ + return S3C_G2D_COLOR_ARGB_1555; + }else{ + break; + } + }else if (1 + && format->Rmask == 0xF800 + && format->Gmask == 0x07C0 + && format->Bmask == 0x003E){ + if ((surface->flags & GAL_SRCPIXELALPHA) && format->Amask == 0x0001) { + return S3C_G2D_COLOR_RGBA_5551; + }else{ + break; + } + }else{ + break; + } + case 4: + if (1 + && format->Rmask == 0x00FF0000 + && format->Gmask == 0x0000FF00 + && format->Bmask == 0x000000FF){ + if ((surface->flags & GAL_SRCPIXELALPHA) && format->Amask == 0xFF000000) { + return S3C_G2D_COLOR_ARGB_8888; + }else{ + return S3C_G2D_COLOR_XRGB_8888; + } + }else if (1 + && format->Rmask == 0xFF000000 + && format->Gmask == 0x00FF0000 + && format->Bmask == 0x0000FF00){ + if ((surface->flags & GAL_SRCPIXELALPHA) && format->Amask == 0x000000FF) { + return S3C_G2D_COLOR_RGBA_8888; + }else{ + return S3C_G2D_COLOR_RGBX_8888; + } + }else{ + break; + } + default: + break; + } + fprintf(stderr, "Format(Bpp:%d A:%08x R:%08x G:%08x B:%08x) not supported\n", + format->BytesPerPixel, format->Amask, format->Rmask, format->Gmask, format->Bmask); + assert(0); + return (unsigned int)-1; +} + +static int setup_param(GAL_Surface *src, GAL_Surface *dst, s3c_g2d_params *param) +{ param->src_base_addr = src->hwdata->addr_phy; //Base address of the source image param->src_full_width = src->w; //source screen full width param->src_full_height = src->h; //source screen full heiht @@ -277,6 +393,7 @@ static void setup_param(GAL_Surface *src, GAL_Surface *dst, s3c_g2d_params *para param->src_start_y = 0; //coordinate start y of source image param->src_work_width = 0; //source image width for work param->src_work_height = 0; //source image height for work + param->src_colormode = get_colormode(src); param->dst_base_addr = dst->hwdata->addr_phy; //Base address of the destination image param->dst_full_width = dst->w; //destination screen full width @@ -285,6 +402,14 @@ static void setup_param(GAL_Surface *src, GAL_Surface *dst, s3c_g2d_params *para param->dst_start_y = 0; //coordinate start y of destination screen param->dst_work_width = 0; //destination screen width for work param->dst_work_height = 0; //destination screen height for work + param->dst_colormode = get_colormode(dst); + + // cos + if (param->dst_colormode == S3C_G2D_COLOR_ARGB_8888) { + param->dst_colormode = S3C_G2D_COLOR_XRGB_8888; + }else if (param->dst_colormode == S3C_G2D_COLOR_RGBA_8888) { + param->dst_colormode = S3C_G2D_COLOR_RGBX_8888; + } /* XXX: clip window */ param->cw_x1 = 0; @@ -295,32 +420,74 @@ static void setup_param(GAL_Surface *src, GAL_Surface *dst, s3c_g2d_params *para param->color_val[G2D_BLACK] = 0; param->color_val[G2D_WHITE] = 0xffffffff; param->color_val[G2D_BLUE] = 0x77777777; // TODO: - param->bpp = RGB16; - param->alpha_mode = 0; //true : enable, false : disable + param->alpha_mode = 0; param->alpha_val = 0; + param->color_key_mode = 0; //true : enable, false : disable param->color_key_val = 0; //transparent color value + + if ((src->flags & GAL_SRCPIXELALPHA)) { + param->alpha_mode |= S3C_G2D_ROP_REG_ABM_SRC_BITMAP; + //param->alpha_mode |= S3C_G2D_ROP_REG_ABM_NO_BLENDING; + } + if ((src->flags & GAL_SRCALPHA)) { + param->alpha_mode |= S3C_G2D_ROP_REG_ABM_REGISTER; + param->alpha_val = src->format->alpha; + } + + if (param->src_colormode == (unsigned int)-1 || param->dst_colormode == (unsigned int)-1) { + return -1; + }else{ + return 0; + } } static int S3C6410_HWAccelBlit(GAL_Surface *src, GAL_Rect *srcrect, GAL_Surface *dst, GAL_Rect *dstrect) { + int ret; s3c_g2d_params param; // TODO: alpha, alpha channel, colorkey - setup_param(src, dst, ¶m); + if (dstrect->w == 0 || dstrect->h == 0) { + return -1; + } + + if (setup_param(src, dst, ¶m) < 0) { + return -1; + } param.src_start_x = srcrect->x; param.src_start_y = srcrect->y; param.src_work_width = srcrect->w; param.src_work_height = srcrect->h; - + param.dst_start_x = dstrect->x; param.dst_start_y = dstrect->y; param.dst_work_width = dstrect->w; param.dst_work_height = dstrect->h; - return ioctl(src->hwdata->fd_g2d, S3C_G2D_ROTATOR_0, ¶m); + /* only for driver's bug */ + param.src_work_width--; + param.src_work_height--; + param.dst_work_width--; + param.dst_work_height--; + + clock_t start, end; + static int n; + static int t0; + start = times(NULL); + if (n++ == 0) { + t0 = start; + } + // printf("%d x %d = %d\n", srcrect->w, srcrect->h, srcrect->w * srcrect->h); + ret = ioctl (src->hwdata->fd_g2d, S3C_G2D_ROTATOR_0, ¶m); + end = times(NULL); + if (end - start >= 2) { + printf("[%d] %ld %ld ret=%d\n", n, end-t0, end-start, ret); + n = 0; + } + return ret; } #ifdef _MGRM_PROCESSES @@ -328,7 +495,6 @@ static void S3C6410_RequestHWSurface (_THIS, const REQ_HWSURFACE* request, REP_H gal_vmblock_t *block; if (request->bucket == NULL) { /* alloc */ - dbg(); block = gal_vmbucket_alloc(&this->hidden->vmbucket, request->pitch, request->h); if (block) { reply->offset = block->offset; @@ -338,8 +504,6 @@ static void S3C6410_RequestHWSurface (_THIS, const REQ_HWSURFACE* request, REP_H reply->bucket = NULL; } }else{ /* free */ - dbg(); - printf("on request free: %d, %d, %p\n", request->offset, request->pitch, request->bucket); if (request->offset != -1) { gal_vmbucket_free(&this->hidden->vmbucket, (gal_vmblock_t *)request->bucket); } @@ -354,12 +518,24 @@ static int S3C6410_AllocHWSurface(_THIS, GAL_Surface *surface) struct GAL_PrivateVideoData *hidden = this->hidden; gal_vmblock_t *block; - if (surface->format->BytesPerPixel != 2){ - surface->flags &= ~GAL_HWSURFACE; - return -1; + if (surface->w !=1 || surface->h != 1) { /* 1X1 is a reference DC */ + int H = surface->h / 10; + if (H >= sizeof(s3c6410_size_table)/sizeof(s3c6410_size_table[0])) { + H = sizeof(s3c6410_size_table)/sizeof(s3c6410_size_table[0]) - 1; + } + if (surface->w/10 < s3c6410_size_table[H]) { + surface->flags &= ~GAL_HWSURFACE; + return -1; + } } if (ISSERVER) { + /* force 4-byte align */ + if (surface->format->BytesPerPixel != 4) { + surface->w = (surface->w + 1) & ~1; + surface->pitch = surface->w * surface->format->BytesPerPixel; + } + block = gal_vmbucket_alloc(&hidden->vmbucket, surface->pitch, surface->h); if (block) { offset = block->offset; @@ -408,11 +584,9 @@ static void S3C6410_FreeHWSurface(_THIS, GAL_Surface *surface) if (hwdata->vmblock) { if (ISSERVER) { - dbg(); gal_vmbucket_free(&hidden->vmbucket, hwdata->vmblock); #ifdef _MGRM_PROCESSES }else{ - dbg(); REQ_HWSURFACE request = {surface->w, surface->h, surface->pitch, -1, surface->hwdata->vmblock}; REP_HWSURFACE reply = {0, 0}; diff --git a/src/newgal/s3c6410/gal-s3c6410.h b/src/newgal/s3c6410/gal-s3c6410.h index 891796fd..be35b72d 100644 --- a/src/newgal/s3c6410/gal-s3c6410.h +++ b/src/newgal/s3c6410/gal-s3c6410.h @@ -37,6 +37,7 @@ struct private_hwdata { /* for GAL_SURFACE */ int fd_g2d; }; +extern int s3c6410_size_table[48]; /****************************************************************** * copy from g2d driver @@ -58,7 +59,8 @@ typedef struct u32 src_start_x; //coordinate start x of source image u32 src_start_y; //coordinate start y of source image u32 src_work_width; //source image width for work - u32 src_work_height; //source image height for work + u32 src_work_height; //source image height for work + u32 src_colormode; u32 dst_base_addr; //Base address of the destination image u32 dst_full_width; //destination screen full width @@ -66,14 +68,14 @@ typedef struct u32 dst_start_x; //coordinate start x of destination screen u32 dst_start_y; //coordinate start y of destination screen u32 dst_work_width; //destination screen width for work - u32 dst_work_height; //destination screen height for work + u32 dst_work_height; //destination screen height for work + u32 dst_colormode; // Coordinate (X, Y) of clipping window u32 cw_x1, cw_y1; u32 cw_x2, cw_y2; u32 color_val[8]; - G2D_COLOR_SPACE bpp; u32 alpha_mode; //true : enable, false : disable u32 alpha_val; @@ -89,6 +91,20 @@ typedef enum #define G2D_IOCTL_MAGIC 'G' +#define S3C_G2D_COLOR_RGB_565 (0x0<<0) +#define S3C_G2D_COLOR_RGBA_5551 (0x1<<0) +#define S3C_G2D_COLOR_ARGB_1555 (0x2<<0) +#define S3C_G2D_COLOR_RGBA_8888 (0x3<<0) +#define S3C_G2D_COLOR_ARGB_8888 (0x4<<0) +#define S3C_G2D_COLOR_XRGB_8888 (0x5<<0) +#define S3C_G2D_COLOR_RGBX_8888 (0x6<<0) + +/* Alpha Blending Mode */ +#define S3C_G2D_ROP_REG_ABM_NO_BLENDING (0<<10) +#define S3C_G2D_ROP_REG_ABM_SRC_BITMAP (1<<10) +#define S3C_G2D_ROP_REG_ABM_REGISTER (2<<10) +#define S3C_G2D_ROP_REG_ABM_FADING (4<<10) + #define S3C_G2D_ROTATOR_0 _IO(G2D_IOCTL_MAGIC,0) #define S3C_G2D_ROTATOR_90 _IO(G2D_IOCTL_MAGIC,1) #define S3C_G2D_ROTATOR_180 _IO(G2D_IOCTL_MAGIC,2) diff --git a/src/newgal/shadow/shadow.c b/src/newgal/shadow/shadow.c index 9a438a98..c4388912 100644 --- a/src/newgal/shadow/shadow.c +++ b/src/newgal/shadow/shadow.c @@ -110,6 +110,10 @@ static void SHADOW_VideoQuit (_THIS); static int SHADOW_AllocHWSurface (_THIS, GAL_Surface *surface); static void SHADOW_FreeHWSurface (_THIS, GAL_Surface *surface); +/* for task_do_update */ +static int run_flag = 0; +static int end_flag = 0; + #ifdef _MGRM_PROCESSES static int shmid; /* Down/up a semaphore uninterruptablly. */ @@ -446,8 +450,22 @@ static void* task_do_update (void* data) real_device = this->hidden->realfb_info->real_device; - while (_shadowfbheader) - { + /* waiting for __gal_screen */ + for (;;) { + if (__gal_screen !=NULL) { + break; + } + } + + for (;;) { + if (run_flag != 1) { + break; + } + + if (_shadowfbheader == NULL) { + break; + } + if (_shadowfbheader->dirty || _shadowfbheader->palette_changed) { #ifdef _MGRM_PROCESSES @@ -456,20 +474,18 @@ static void* task_do_update (void* data) pthread_mutex_lock (&this->hidden->update_lock); #endif - if (_shadowfbheader->palette_changed) - { - real_device->SetColors (real_device, _shadowfbheader->firstcolor, - _shadowfbheader->ncolors, - (GAL_Color*)((char*)_shadowfbheader + _shadowfbheader->palette_offset)); - SetRect (&_shadowfbheader->dirty_rect, 0, 0, - _shadowfbheader->width, _shadowfbheader->height); - } + if (real_device) { + if (_shadowfbheader->palette_changed) { + real_device->SetColors (real_device, _shadowfbheader->firstcolor, + _shadowfbheader->ncolors, + (GAL_Color*)((char*)_shadowfbheader + _shadowfbheader->palette_offset)); + SetRect (&_shadowfbheader->dirty_rect, 0, 0, + _shadowfbheader->width, _shadowfbheader->height); + } - __mg_shadow_fb_ops->refresh (_shadowfbheader, - this->hidden->realfb_info, &(_shadowfbheader->dirty_rect)); + __mg_shadow_fb_ops->refresh (_shadowfbheader, + this->hidden->realfb_info, &(_shadowfbheader->dirty_rect)); - if (real_device) - { if (this->hidden->realfb_info->flags & _ROT_DIR_CW) { _get_dst_rect_cw (&qvfb_rect, &(_shadowfbheader->dirty_rect), this->hidden->realfb_info); @@ -498,6 +514,7 @@ static void* task_do_update (void* data) if (real_device->UpdateRects) real_device->UpdateRects(real_device, 1, &dirty_rect); } + SetRect (&_shadowfbheader->dirty_rect, 0, 0, 0, 0); _shadowfbheader->dirty = FALSE; _shadowfbheader->palette_changed = FALSE; @@ -510,6 +527,9 @@ static void* task_do_update (void* data) } __mg_shadow_fb_ops->sleep (); } + + end_flag = 1; + return NULL; } @@ -655,6 +675,10 @@ static GAL_Surface *SHADOW_SetVideoMode(_THIS, GAL_Surface *current, { pthread_attr_t new_attr; + + run_flag = 1; + end_flag = 0; + pthread_attr_init (&new_attr); #ifndef __LINUX__ pthread_attr_setstacksize (&new_attr, 512); @@ -671,8 +695,17 @@ static GAL_Surface *SHADOW_SetVideoMode(_THIS, GAL_Surface *current, static void SHADOW_VideoQuit (_THIS) { - _shadowfbheader->dirty = FALSE; + run_flag = 0; + + /* waiting task_do_update end */ + for (;;) { + if (end_flag != 0) { + break; + } + } + if (_shadowfbheader) { + _shadowfbheader->dirty = FALSE; free(_shadowfbheader); _shadowfbheader = NULL; } @@ -702,6 +735,7 @@ static GAL_Surface *SHADOW_SetVideoMode(_THIS, GAL_Surface *current, size = 0; ret = 0; + printf ("SHADOW_SetVideoMode\n"); if (mgIsServer) { ShadowFBHeader shadowfbheader; @@ -818,6 +852,10 @@ static GAL_Surface *SHADOW_SetVideoMode(_THIS, GAL_Surface *current, if (mgIsServer) { pthread_attr_t new_attr; + + run_flag = 1; + end_flag = 0; + pthread_attr_init (&new_attr); #ifndef __LINUX__ pthread_attr_setstacksize (&new_attr, 512); @@ -826,12 +864,13 @@ static GAL_Surface *SHADOW_SetVideoMode(_THIS, GAL_Surface *current, ret = pthread_create (&this->hidden->update_th, &new_attr, task_do_update, this); pthread_attr_destroy (&new_attr); + + if (ret != 0) { + fprintf (stderr, "NEWGAL>SHADOW: Couldn't start updater\n"); + } } - if (ret != 0) { - fprintf (stderr, "NEWGAL>SHADOW: Couldn't start updater\n"); - } - + printf ("SHADOW_SetVideoMode\n"); /* We're done */ return (current); } @@ -839,6 +878,8 @@ static GAL_Surface *SHADOW_SetVideoMode(_THIS, GAL_Surface *current, static void SHADOW_VideoQuit (_THIS) { ShadowFBHeader* tmp; + union semun ignored; + if (!mgIsServer){ _shadowfbheader->dirty = FALSE; if (this->screen->pixels) { @@ -847,8 +888,6 @@ static void SHADOW_VideoQuit (_THIS) } } else { - union semun ignored; - tmp = _shadowfbheader; _shadowfbheader = NULL; shmdt (tmp); diff --git a/src/newgal/stgfb/stgfb_video.c b/src/newgal/stgfb/stgfb_video.c index 61aa2ec9..47a61a60 100644 --- a/src/newgal/stgfb/stgfb_video.c +++ b/src/newgal/stgfb/stgfb_video.c @@ -404,11 +404,25 @@ static int STAPI_FillRectangle (_THIS, int fd, GAL_Surface* dst, GAL_Rect* dstre /* note: the alpha range is [0, 128] */ if (dst->flags & GAL_SRCALPHA) { Command.Params.Blit.Context.AluMode = STBLIT_ALU_ALPHA_BLEND; - Command.Params.Blit.Context.GlobalAlpha = (dst->format->alpha+1)/2; + if ( STGXOBJ_COLOR_TYPE_ARGB8888_255 == st_bitmap->ColorType + || STGXOBJ_COLOR_TYPE_ARGB8565_255 == st_bitmap->ColorType + || STGXOBJ_COLOR_TYPE_ACLUT88_255 == st_bitmap->ColorType + || STGXOBJ_COLOR_TYPE_ALPHA8_255 == st_bitmap->ColorType + ) + Command.Params.Blit.Context.GlobalAlpha = dst->format->alpha; + else + Command.Params.Blit.Context.GlobalAlpha = (dst->format->alpha+1)/2; } else { Command.Params.Blit.Context.AluMode = STBLIT_ALU_COPY; - Command.Params.Blit.Context.GlobalAlpha = 128; + if ( STGXOBJ_COLOR_TYPE_ARGB8888_255 == st_bitmap->ColorType + || STGXOBJ_COLOR_TYPE_ARGB8565_255 == st_bitmap->ColorType + || STGXOBJ_COLOR_TYPE_ACLUT88_255 == st_bitmap->ColorType + || STGXOBJ_COLOR_TYPE_ALPHA8_255 == st_bitmap->ColorType + ) + Command.Params.Blit.Context.GlobalAlpha = 255; + else + Command.Params.Blit.Context.GlobalAlpha = 128; } /* set the fill color */ @@ -428,6 +442,14 @@ static int STAPI_FillRectangle (_THIS, int fd, GAL_Surface* dst, GAL_Rect* dstre Command.Params.Blit.Context.AluMode = STBLIT_ALU_ALPHA_BLEND; break; + case STGXOBJ_COLOR_TYPE_ARGB8888: + stgxobj_color.Value.ARGB8888.Alpha = color->a; + stgxobj_color.Value.ARGB8888.R = color->r; + stgxobj_color.Value.ARGB8888.G = color->g; + stgxobj_color.Value.ARGB8888.B = color->b; + Command.Params.Blit.Context.AluMode = STBLIT_ALU_ALPHA_BLEND; + break; + default: fprintf(stderr, "STAPI_FillRect >> color type: [%d] not supported !\n", stgxobj_color.Type); @@ -593,7 +615,7 @@ static int STAPI_Blit (_THIS, int fd, GAL_Surface* src, GAL_Rect* srcrect, /* set the colorkey */ if (src->flags & GAL_SRCCOLORKEY) { - STAPI_Colorkey2ST(src->format->colorkey, src->hwdata->st_bitmap.ColorType, + STAPI_Colorkey2ST(src->format->colorkey, src_st_bitmap->ColorType, STGXOBJ_COLOR_KEY_TYPE_RGB888, FALSE, &Command.Params.Blit.Context.ColorKey); Command.Params.Blit.Context.ColorKeyCopyMode = STBLIT_COLOR_KEY_MODE_SRC; } @@ -604,11 +626,25 @@ static int STAPI_Blit (_THIS, int fd, GAL_Surface* src, GAL_Rect* srcrect, /* note: the alpha range is [0, 128] */ if (src->flags & GAL_SRCALPHA) { Command.Params.Blit.Context.AluMode = STBLIT_ALU_ALPHA_BLEND; - Command.Params.Blit.Context.GlobalAlpha = (src->format->alpha+1)/2; + if ( STGXOBJ_COLOR_TYPE_ARGB8888_255 == src_st_bitmap->ColorType + || STGXOBJ_COLOR_TYPE_ARGB8565_255 == src_st_bitmap->ColorType + || STGXOBJ_COLOR_TYPE_ACLUT88_255 == src_st_bitmap->ColorType + || STGXOBJ_COLOR_TYPE_ALPHA8_255 == src_st_bitmap->ColorType + ) + Command.Params.Blit.Context.GlobalAlpha = src->format->alpha; + else + Command.Params.Blit.Context.GlobalAlpha = (src->format->alpha+1)/2; } else { Command.Params.Blit.Context.AluMode = STBLIT_ALU_COPY; - Command.Params.Blit.Context.GlobalAlpha = 128; + if ( STGXOBJ_COLOR_TYPE_ARGB8888_255 == src_st_bitmap->ColorType + || STGXOBJ_COLOR_TYPE_ARGB8565_255 == src_st_bitmap->ColorType + || STGXOBJ_COLOR_TYPE_ACLUT88_255 == src_st_bitmap->ColorType + || STGXOBJ_COLOR_TYPE_ALPHA8_255 == src_st_bitmap->ColorType + ) + Command.Params.Blit.Context.GlobalAlpha = 255; + else + Command.Params.Blit.Context.GlobalAlpha = 128; } /* set blit operation to blit */ @@ -906,6 +942,7 @@ static GAL_Surface *STGFB_SetVideoMode (_THIS, GAL_Surface *current, break; case STGXOBJ_COLOR_TYPE_ARGB8888: + case STGXOBJ_COLOR_TYPE_ARGB8888_255: depth = 32; Amask = 0xFF000000; Rmask = 0x00FF0000; diff --git a/src/newgal/surface.c b/src/newgal/surface.c index ffb97cda..f1409ce5 100644 --- a/src/newgal/surface.c +++ b/src/newgal/surface.c @@ -68,6 +68,11 @@ GAL_Surface * GAL_CreateRGBSurface (Uint32 flags, surface->flags = GAL_SWSURFACE; + /* 2011-03-04 WanZheng, + * make it able to create a hardware surface + * with different color format against the screen surface + */ +#if 0 if ( (flags & GAL_HWSURFACE) == GAL_HWSURFACE ) { depth = screen->format->BitsPerPixel; Rmask = screen->format->Rmask; @@ -75,6 +80,7 @@ GAL_Surface * GAL_CreateRGBSurface (Uint32 flags, Bmask = screen->format->Bmask; Amask = screen->format->Amask; } +#endif if (Amask){ surface->flags |= GAL_SRCPIXELALPHA; } @@ -495,11 +501,48 @@ int GAL_LowerBlit (GAL_Surface *src, GAL_Rect *srcrect, } else { do_blit = src->map->sw_blit; } + +#ifdef _MGGAL_S3C6410 + { + extern int s3c6410_size_table[48]; + int H = src->h / 10; + if (H >= sizeof(s3c6410_size_table)/sizeof(s3c6410_size_table[0])) { + H = sizeof(s3c6410_size_table)/sizeof(s3c6410_size_table[0]) - 1; + } + if (src->w/10 < s3c6410_size_table[H]) { + do_blit = src->map->sw_blit; + } + } +#endif + #ifdef MG_CONFIG_USE_OWN_OVERLAPPED_BITBLIT ret = own_overlapped_bitblit(do_blit, src, srcrect, dst, dstrect); #else ret = do_blit(src, srcrect, dst, dstrect); #endif + +#if 0 + { + static int n_sw=0, n_hw=0; + if ((src->flags & GAL_HWACCEL) == GAL_HWACCEL) + { + n_hw ++; + } + else + { + n_sw ++; + } + printf("[%06u] hw/blit=%d/%d %c size=%dX%d src=(%d %d),%p dst=(%d %d),%p\n", + times(NULL) % 1000000, + n_hw, n_hw+n_sw, + do_blit == src->map->sw_blit ? 'S':'H', + srcrect->w, srcrect->h, + srcrect->x, srcrect->y, src, + dstrect->x, dstrect->y, dst + ); + } +#endif + return ret; } @@ -801,6 +844,7 @@ int GAL_GetBox (GAL_Surface *src, const GAL_Rect *rect, BITMAP* box) box->bmWidth = rect->w; box->bmHeight = rect->h; box->bmAlphaMask = NULL; + box->bmAlphaPitch = 0; dst_x = rect->x; dst_y = rect->y; @@ -905,8 +949,8 @@ slow_copy: do { \ int x = (srcrow - (box)->bmBits) % (box)->bmPitch; \ int y = (srcrow - (box)->bmBits) / (box)->bmPitch; \ - pitch = ((box)->bmWidth + 3) & ~3; \ - row = (y * pitch) + (x / (box)->bmBytesPerPixel); \ + (pitch) = (box)->bmAlphaPitch; \ + (row) = (y * (pitch)) + (x / (box)->bmBytesPerPixel); \ } while(0) static int _PutBoxAlphaChannelEx (GAL_Surface* dst, BYTE* dstrow, BYTE* srcrow, Uint32 w, Uint32 h, BITMAP* box) diff --git a/src/newgal/videomem-bucket.c b/src/newgal/videomem-bucket.c index 6d46a440..2dfa5359 100644 --- a/src/newgal/videomem-bucket.c +++ b/src/newgal/videomem-bucket.c @@ -5,25 +5,63 @@ #include "videomem-bucket.h" -//#define MY_DEBUG -#ifdef MY_DEBUG +/*#define GAL_VMBUCKET_DEBUG*/ + +#define TEST_BIT(a, bit) ((a) & (bit)) +#define SET_BIT(a, bit) ((a) |= (bit)) +#define UNSET_BIT(a, bit) ((a) &= ~(bit)) +#define BLOCK_SIZE(block) ((block)->height * (block)->pitch) + + +#ifdef GAL_VMBUCKET_DEBUG static void gal_vmbucket_print(const gal_vmbucket_t *bucket) { struct list_head *i; + int unused_total = 0; + int unused_max = 0; + int used_max = 0; + int used_total = 0; + char bit_flags[32] = ""; - printf( "Bucket:\n" + printf( "\n---- GAL Video Memory Bucket -------\n" " start=%p\n" " size=%d\n", bucket->start, bucket->size); list_for_each(i, &bucket->block_head) { gal_vmblock_t *block = (gal_vmblock_t *)i; + + if (TEST_BIT(block->flag, VMBLOCK_FLAG_USED)) { + used_total++; + used_max = used_max > (block->height * block->pitch) ? used_max : (block->height * block->pitch); + sprintf(bit_flags, " "); + } + else { + unused_total++; + unused_max = unused_max > (block->height * block->pitch) ? unused_max : (block->height * block->pitch); + sprintf(bit_flags, "\t\t"); + } + printf( " block:\n" - " offset=%d\n" - " height=%d\n" - " pitch=%d\n" - " flag=%d\n", - block->offset, block->height, block->pitch, block->flag); + " %soffset=%d\n" + " %sheight=%d\n" + " %spitch=%d\n" + " %sflag=%d\n" + " %ssize=%d\n", + bit_flags, block->offset, + bit_flags, block->height, + bit_flags, block->pitch, + bit_flags, block->flag, + bit_flags, block->height*block->pitch); } + + printf( "---------- Total Result -------------\n" + "unused: count=%d, max_block:%d\n" + "used : count=%d, max_block:%d\n" + "total : count=%d\n" + "-------------------------------------\n\n", + unused_total, unused_max, + used_total, used_max, + unused_total+used_total); } #else # define gal_vmbucket_print(x) /* NULL */ @@ -54,11 +92,6 @@ void gal_vmbucket_destroy(gal_vmbucket_t *bucket) { } } -#define TEST_BIT(a, bit) ((a) & (bit)) -#define SET_BIT(a, bit) ((a) |= (bit)) -#define UNSET_BIT(a, bit) ((a) &= ~(bit)) -#define BLOCK_SIZE(block) ((block)->height * (block)->pitch) - gal_vmblock_t *gal_vmbucket_alloc(gal_vmbucket_t *bucket, int pitch, int height) { struct list_head *i; int required_size = height * pitch; @@ -85,6 +118,8 @@ gal_vmblock_t *gal_vmbucket_alloc(gal_vmbucket_t *bucket, int pitch, int height) return block; } } + fprintf(stderr, "videomem-bucket: Failed to alloc hardware surface(request_size=%d)\n", required_size); + return NULL; } diff --git a/src/newgdi/bitmap.c b/src/newgdi/bitmap.c index 6624f5c4..97ba7a5e 100644 --- a/src/newgdi/bitmap.c +++ b/src/newgdi/bitmap.c @@ -255,9 +255,11 @@ static void _line_scaled_fillbox (void* context, const void* line, int y) tmp_bmp.bmBits = (Uint8*)line; if (tmp_bmp.bmType & BMP_TYPE_ALPHA_MASK) { tmp_bmp.bmAlphaMask = (Uint8*)info->line_alpha_buff; + tmp_bmp.bmAlphaPitch = (tmp_bmp.bmWidth + 3) & (~3); } else { tmp_bmp.bmAlphaMask = NULL; + tmp_bmp.bmAlphaPitch = 0; } cliprect = info->pdc->cur_ban; @@ -770,7 +772,7 @@ int GUIAPI EncodeRleBitmap(HDC hdc, PBITMAP bmp) } /* Save alpha mask data */ - alpha_pitch = (bmp->bmWidth +3) & (~3); + alpha_pitch = bmp->bmAlphaPitch; size = alpha_pitch * bmp->bmHeight; src_alpha_mask = calloc(1, size); if (src_alpha_mask == NULL) { @@ -880,9 +882,11 @@ static void _line_scaled_fillboxpart (void* context, const void* line, int y) tmp_bmp.bmBits += GAL_BytesPerPixel (info->pdc->surface) * info->off_x; if (tmp_bmp.bmType & BMP_TYPE_ALPHA_MASK) { tmp_bmp.bmAlphaMask = (Uint8*)info->line_alpha_buff + info->off_x; + tmp_bmp.bmAlphaPitch = (tmp_bmp.bmWidth + 3) & (~3); } else { tmp_bmp.bmAlphaMask = NULL; + tmp_bmp.bmAlphaPitch = 0; } cliprect = info->pdc->cur_ban; @@ -1000,7 +1004,7 @@ BOOL GUIAPI FillBoxWithBitmapPart (HDC hdc, int x, int y, int w, int h, if (xo != 0 || yo != 0) { part.bmBits += part.bmPitch * yo + xo * GAL_BytesPerPixel (pdc->surface); - part.bmAlphaMask += yo * ((part.bmWidth + 3) & ~3)+ xo; + part.bmAlphaMask += yo * part.bmAlphaPitch + xo; } _dc_fillbox_bmp_clip (pdc, &rect, &part); } @@ -1631,8 +1635,7 @@ static void inline get_alpha_with_alphamask (BYTE *src, const BITMAP* src_bmp, U { int x = (src - src_bmp->bmBits) % src_bmp->bmPitch; int y = (src - src_bmp->bmBits) / src_bmp->bmPitch; - int pitch = (src_bmp->bmWidth + 3) & (~3); - *pa = src_bmp->bmAlphaMask[y * pitch + x / src_bmp->bmBytesPerPixel]; + *pa = src_bmp->bmAlphaMask[y * src_bmp->bmAlphaPitch + x / src_bmp->bmBytesPerPixel]; } /* @@ -1873,7 +1876,7 @@ BOOL BitmapDDAScalerEx (void* context, const BITMAP* src_bmp, } dp1 = src_bmp->bmBits + (sy >> 16) * src_bmp->bmPitch; if (src_bmp->bmType & BMP_TYPE_ALPHA_MASK) { - dp3 = src_bmp->bmAlphaMask + (sy >> 16) * ((src_bmp->bmWidth + 3) & ~3); + dp3 = src_bmp->bmAlphaMask + (sy >> 16) * src_bmp->bmAlphaPitch; } } } @@ -1914,7 +1917,7 @@ BOOL BitmapDDAScalerEx (void* context, const BITMAP* src_bmp, } dp1 = src_bmp->bmBits + (sy >> 16) * src_bmp->bmPitch; if (dp4 && src_bmp->bmType & BMP_TYPE_ALPHA_MASK) { - dp3 = src_bmp->bmAlphaMask + (sy >> 16) * ((src_bmp->bmWidth + 3) & ~3); + dp3 = src_bmp->bmAlphaMask + (sy >> 16) * src_bmp->bmAlphaPitch; } } } @@ -1962,7 +1965,7 @@ BOOL BitmapDDAScalerEx (void* context, const BITMAP* src_bmp, } dp1 = src_bmp->bmBits + (sy >> 16) * src_bmp->bmPitch; if (dp4 && src_bmp->bmType & BMP_TYPE_ALPHA_MASK) { - dp3 = src_bmp->bmAlphaMask + (sy >> 16) * ((src_bmp->bmWidth + 3) & ~3); + dp3 = src_bmp->bmAlphaMask + (sy >> 16) * src_bmp->bmAlphaPitch; } } } @@ -2003,7 +2006,7 @@ BOOL BitmapDDAScalerEx (void* context, const BITMAP* src_bmp, } dp1 = src_bmp->bmBits + (sy >> 16) * src_bmp->bmPitch; if (dp4 && src_bmp->bmType & BMP_TYPE_ALPHA_MASK) { - dp3 = src_bmp->bmAlphaMask + (sy >> 16) * ((src_bmp->bmWidth + 3) & ~3); + dp3 = src_bmp->bmAlphaMask + (sy >> 16) * src_bmp->bmAlphaPitch; } } } @@ -2085,7 +2088,7 @@ BOOL BitmapDDAScaler2 (void* context, const BITMAP* src_bmp, int dst_w, int dst_ } dp1 = src_bits - (sy >> 16) * src_bmp->bmPitch; if (dp4 && src_bmp->bmType & BMP_TYPE_ALPHA_MASK) { - dp3 = src_bmp->bmAlphaMask + (sy >> 16) * ((src_bmp->bmWidth + 3) & ~3); + dp3 = src_bmp->bmAlphaMask + (sy >> 16) * src_bmp->bmAlphaPitch; } } } @@ -2126,7 +2129,7 @@ BOOL BitmapDDAScaler2 (void* context, const BITMAP* src_bmp, int dst_w, int dst_ } dp1 = src_bits - (sy >> 16) * src_bmp->bmPitch; if (dp4 && src_bmp->bmType & BMP_TYPE_ALPHA_MASK) { - dp3 = src_bmp->bmAlphaMask + (sy >> 16) * ((src_bmp->bmWidth + 3) & ~3); + dp3 = src_bmp->bmAlphaMask + (sy >> 16) * src_bmp->bmAlphaPitch; } } } @@ -2174,7 +2177,7 @@ BOOL BitmapDDAScaler2 (void* context, const BITMAP* src_bmp, int dst_w, int dst_ } dp1 = src_bits - (sy >> 16) * src_bmp->bmPitch; if (dp4 && src_bmp->bmType & BMP_TYPE_ALPHA_MASK) { - dp3 = src_bmp->bmAlphaMask + (sy >> 16) * ((src_bmp->bmWidth + 3) & ~3); + dp3 = src_bmp->bmAlphaMask + (sy >> 16) * src_bmp->bmAlphaPitch; } } } @@ -2215,7 +2218,7 @@ BOOL BitmapDDAScaler2 (void* context, const BITMAP* src_bmp, int dst_w, int dst_ } dp1 = src_bits - (sy >> 16) * src_bmp->bmPitch; if (dp4 && src_bmp->bmType & BMP_TYPE_ALPHA_MASK) { - dp3 = src_bmp->bmAlphaMask + (sy >> 16) * ((src_bmp->bmWidth + 3) & ~3); + dp3 = src_bmp->bmAlphaMask + (sy >> 16) * src_bmp->bmAlphaPitch; } } } @@ -2243,8 +2246,8 @@ static void* _get_line_buff_scalebitmap (void* context, int y, void** alpha_line if ((info->dst->bmType & BMP_TYPE_ALPHA_MASK) && info->dst->bmAlphaMask) { - int pitch = (info->dst->bmWidth + 3) & ~3; - *(BYTE**)alpha_line_mask = info->dst->bmAlphaMask + pitch * y; + int alpha_pitch = info->dst->bmAlphaPitch; + *(BYTE**)alpha_line_mask = info->dst->bmAlphaMask + alpha_pitch * y; } return line; } @@ -2328,8 +2331,8 @@ gal_pixel GUIAPI GetPixelInBitmapEx (const BITMAP* bmp, int x, int y, Uint8* alp return 0; if (alpha && bmp->bmAlphaMask) { - int pitch = (bmp->bmWidth + 3) & (~3); - *alpha = bmp->bmAlphaMask[y*pitch + x]; + int alpha_pitch = bmp->bmAlphaPitch; + *alpha = bmp->bmAlphaMask[y*alpha_pitch + x]; } dst = bmp->bmBits + y * bmp->bmPitch + x * bmp->bmBytesPerPixel; @@ -2345,8 +2348,8 @@ BOOL GUIAPI SetPixelInBitmapEx (const BITMAP* bmp, int x, int y, return FALSE; if (alpha && bmp->bmAlphaMask) { - int pitch = (bmp->bmWidth + 3) & (~3); - bmp->bmAlphaMask[y*pitch + x] = *alpha; + int alpha_pitch = bmp->bmAlphaPitch; + bmp->bmAlphaMask[y*alpha_pitch + x] = *alpha; } dst = bmp->bmBits + y * bmp->bmPitch + x * bmp->bmBytesPerPixel; @@ -2474,8 +2477,9 @@ static const RGB WindowsStdColor [] = { #ifdef _FILL_MYBITMAP /* This function expand 16-color bitmap. */ -void GUIAPI ExpandPart16CBitmap (HDC hdc, BYTE* bits, Uint32 pitch, const BYTE* my_bits, - Uint32 my_pitch, Uint32 w, Uint32 h, DWORD flags, const RGB* pal, +void GUIAPI ExpandPart16CBitmapEx (HDC hdc, BYTE* bits, Uint32 pitch, const BYTE* my_bits, + Uint32 my_pitch, Uint32 w, Uint32 h, DWORD flags, + const RGB* pal, BYTE use_pal_alpha, BYTE alpha, int stepx, CB_DRAW_PIXEL cb_draw, MYBITMAP_CONTXT* mybmp) { PDC pdc; @@ -2518,13 +2522,15 @@ void GUIAPI ExpandPart16CBitmap (HDC hdc, BYTE* bits, Uint32 pitch, const BYTE* } if (pal) - pixel = GAL_MapRGB (pdc->surface->format, - pal[index].r, pal[index].g, pal[index].b); + pixel = GAL_MapRGBA (pdc->surface->format, + pal[index].r, pal[index].g, pal[index].b, + use_pal_alpha?pal[index].a:0xFF); else - pixel = GAL_MapRGB (pdc->surface->format, + pixel = GAL_MapRGBA (pdc->surface->format, WindowsStdColor[index].r, WindowsStdColor[index].g, - WindowsStdColor[index].b); + WindowsStdColor[index].b, + alpha); if(cb_draw) cb_draw(hdc,mybmp,pixel,dst); @@ -2543,8 +2549,10 @@ void GUIAPI ExpandPart16CBitmap (HDC hdc, BYTE* bits, Uint32 pitch, const BYTE* #endif /* This function expand 16-color bitmap. */ -void GUIAPI Expand16CBitmap (HDC hdc, BYTE* bits, Uint32 pitch, const BYTE* my_bits, Uint32 my_pitch, - Uint32 w, Uint32 h, DWORD flags, const RGB* pal) +void GUIAPI Expand16CBitmapEx (HDC hdc, BYTE* bits, Uint32 pitch, + const BYTE* my_bits, Uint32 my_pitch, + Uint32 w, Uint32 h, DWORD flags, + const RGB* pal, BYTE use_pal_alpha, BYTE alpha) { PDC pdc; Uint32 x, y; @@ -2575,13 +2583,15 @@ void GUIAPI Expand16CBitmap (HDC hdc, BYTE* bits, Uint32 pitch, const BYTE* my_b index = byte & 0x0f; if (pal) - pixel = GAL_MapRGB (pdc->surface->format, - pal[index].r, pal[index].g, pal[index].b); + pixel = GAL_MapRGBA (pdc->surface->format, + pal[index].r, pal[index].g, pal[index].b, + use_pal_alpha?pal[index].a:0xFF); else - pixel = GAL_MapRGB (pdc->surface->format, + pixel = GAL_MapRGBA (pdc->surface->format, WindowsStdColor[index].r, WindowsStdColor[index].g, - WindowsStdColor[index].b); + WindowsStdColor[index].b, + alpha); dst = _mem_set_pixel (dst, bpp, pixel); } @@ -2596,9 +2606,10 @@ void GUIAPI Expand16CBitmap (HDC hdc, BYTE* bits, Uint32 pitch, const BYTE* my_b } /* This function expands 256-color bitmap. */ -void GUIAPI Expand256CBitmap (HDC hdc, BYTE* bits, Uint32 pitch, +void GUIAPI Expand256CBitmapEx (HDC hdc, BYTE* bits, Uint32 pitch, const BYTE* my_bits, Uint32 my_pitch, - Uint32 w, Uint32 h, DWORD flags, const RGB* pal, + Uint32 w, Uint32 h, DWORD flags, + const RGB* pal, BYTE use_pal_alpha, BYTE alpha, CB_DRAW_PIXEL cb_draw, MYBITMAP_CONTXT* mybmp) { PDC pdc; @@ -2625,8 +2636,9 @@ void GUIAPI Expand256CBitmap (HDC hdc, BYTE* bits, Uint32 pitch, byte = *src++; if (pal) - pixel = GAL_MapRGB (pdc->surface->format, - pal[byte].r, pal[byte].g, pal[byte].b); + pixel = GAL_MapRGBA (pdc->surface->format, + pal[byte].r, pal[byte].g, pal[byte].b, + use_pal_alpha?pal[byte].a:0xFF); else if (bpp == 1) /* * Assume that the palette of the bitmap is the same as @@ -2637,13 +2649,14 @@ void GUIAPI Expand256CBitmap (HDC hdc, BYTE* bits, Uint32 pitch, /* * Treat the bitmap uses the dithered colorful palette. */ - pixel = GAL_MapRGB (pdc->surface->format, + pixel = GAL_MapRGBA (pdc->surface->format, (byte >> 5) & 0x07, (byte >> 2) & 0x07, - byte & 0x03); + byte & 0x03, + alpha); - if(cb_draw) - cb_draw(hdc,mybmp,pixel,dst); + if (cb_draw) + cb_draw (hdc, mybmp, pixel, dst); else dst = _mem_set_pixel (dst, bpp, pixel); } @@ -2889,7 +2902,7 @@ void GUIAPI HFlipBitmap (BITMAP* bmp, unsigned char* inter_buff) gal_pixel pixel; if (bmp->bmType & BMP_TYPE_ALPHA_MASK) { - int alpha_pitch = (bmp->bmWidth + 3) & ~3; + int alpha_pitch = bmp->bmAlphaPitch; unsigned char* alpha_inter_buff = (unsigned char*)malloc(sizeof(char) * alpha_pitch); sline = bmp->bmAlphaMask; @@ -2936,7 +2949,7 @@ void GUIAPI VFlipBitmap (BITMAP* bmp, unsigned char* inter_buff) unsigned char* sline, *dline; if (bmp->bmType & BMP_TYPE_ALPHA_MASK) { - int alpha_pitch = (bmp->bmWidth + 3) & ~3; + int alpha_pitch = bmp->bmAlphaPitch; unsigned char* alpha_inter_buff = (unsigned char*)malloc(sizeof(char) * alpha_pitch); dline = bmp->bmAlphaMask + alpha_pitch * bmp->bmHeight; diff --git a/src/newgdi/clip.c b/src/newgdi/clip.c index 08882be3..120c5b5b 100644 --- a/src/newgdi/clip.c +++ b/src/newgdi/clip.c @@ -227,6 +227,7 @@ BOOL GUIAPI RectVisible (HDC hdc, const RECT* pRect) int GUIAPI GetClipBox (HDC hdc, RECT* clipbox) { PDC pdc; + RECT rc; pdc = dc_HDC2PDC (hdc); @@ -238,6 +239,13 @@ int GUIAPI GetClipBox (HDC hdc, RECT* clipbox) else *clipbox = pdc->lcrgn.rcBound; + /* make the DevRC coordinate same as the lcrgn */ + SetRect(&rc, 0, 0, pdc->DevRC.right, pdc->DevRC.bottom); + rc.right -= pdc->DevRC.left; + rc.bottom -= pdc->DevRC.top; + //IntersectRect(clipbox, clipbox, &pdc->DevRC); + IntersectRect(clipbox, clipbox, &rc); + return pdc->lcrgn.type; } diff --git a/src/newgdi/drawtext.c b/src/newgdi/drawtext.c index b3ecb69a..5f680cd5 100644 --- a/src/newgdi/drawtext.c +++ b/src/newgdi/drawtext.c @@ -480,14 +480,20 @@ int DrawTextEx2 (HDC hdc, const char* pText, int nCount, line_len = __mg_substrlen (pdc->pLogFont, pText, nCount, '\n', &nr_delim_newline); - if(line_len == 0 || (nFormat & DT_SINGLELINE)) - line_len = nCount; - pline = (const unsigned char*) pText; + /* line_len == 0 means the first char is '\n' */ + if(nFormat & DT_SINGLELINE) { + line_len = nCount; + } + else if (line_len == 0) { + y += ctxt.line_height; + nLines += 1; + } + + pline = (const unsigned char*) pText; nCount -= line_len + nr_delim_newline; pText = pText + line_len + nr_delim_newline; - while(line_len){ if (nLines == 0) { line_x = indent; diff --git a/src/newgdi/gdi.c b/src/newgdi/gdi.c index 5ff67b64..5616cec1 100644 --- a/src/newgdi/gdi.c +++ b/src/newgdi/gdi.c @@ -83,6 +83,7 @@ BLOCKHEAP __mg_FreeClipRectList; /************************* static functions declaration **********************/ static void dc_InitClipRgnInfo (void); +static void dc_DeinitClipRgnInfo(void); static void dc_InitDC (PDC pdc, HWND hWnd, BOOL bIsClient); static void dc_InitMemDCFrom (PDC pdc, const PDC pdc_ref); static void dc_InitScreenDC (PDC pdc, GAL_Surface* surface); @@ -181,6 +182,8 @@ void mg_TerminateScreenDC (void) if (__mg_screen_sys_dc.alpha_pixel_format) free (__mg_screen_sys_dc.alpha_pixel_format); + dc_DeinitClipRgnInfo(); + DESTROY_LOCK (&__mg_gdilock); DESTROY_LOCK (&dcslot); /* [2010/06/02] DongJunJie : fix a dead-lock bug of mgncs. */ @@ -396,6 +399,17 @@ static void dc_InitClipRgnInfo(void) } } +static void dc_DeinitClipRgnInfo(void) +{ + int i; + + for (i=0; iDevRC); parent_height = RECTH (pdc_parent->DevRC); - if (off_x < 0 ) off_x = 0; + if (off_x < 0 && pdc_parent->DCType != TYPE_MEMDC) off_x = 0; else if(off_x > parent_width) off_x = parent_width; - if (off_y < 0) off_y = 0; + if (off_y < 0 && pdc_parent->DCType != TYPE_MEMDC) off_y = 0; else if(off_y > parent_height) off_y = parent_height; if (width < 0) width = 0; if (height < 0) height = 0; @@ -2163,8 +2177,8 @@ HDC GUIAPI GetSubDC (HDC hdc, int off_x, int off_y, int width, int height) parent_width = RECTW (pdc_parent->DevRC); parent_height = RECTH (pdc_parent->DevRC); - if (off_x < 0 || off_x >= parent_width - || off_y < 0 || off_y >= parent_height || width <= 0 || height <= 0) + if ((off_x < 0 && pdc_parent->DCType != TYPE_MEMDC) || off_x >= parent_width + || (off_y < 0 && pdc_parent->DCType != TYPE_MEMDC) || off_y >= parent_height || width <= 0 || height <= 0) return HDC_INVALID; if (off_x + width > parent_width) @@ -2294,13 +2308,6 @@ HDC GUIAPI CreateSecondaryDC(HWND hwnd) hdc = CreateCompatibleDCEx (hdc_ref, 128, 128); } else { - /* houhh 20090522, max_value is g_rcScr.*/ - if (width > RECTW(g_rcScr)) { - width = RECTW(g_rcScr); - } - if (height > RECTH(g_rcScr)) { - height = RECTW(g_rcScr); - } hdc = CreateCompatibleDCEx (hdc_ref, width, height); } @@ -2640,8 +2647,10 @@ HDC GetSecondarySubDC (HDC secondary_dc, HWND hwnd_child, BOOL client) pdc->pGCRInfo = NULL; pdc->oldage = 0; + EmptyClipRgn (&pdc->lcrgn); InitClipRgn (&pdc->lcrgn, &__mg_FreeClipRectList); MAKE_REGION_INFINITE(&pdc->lcrgn); + EmptyClipRgn (&pdc->ecrgn); InitClipRgn (&pdc->ecrgn, &__mg_FreeClipRectList); CopyRegion (&pdc->ecrgn, &pdc_parent->ecrgn); @@ -2912,6 +2921,7 @@ HDC GUIAPI CreateCompatibleDCEx (HDC hdc, int width, int height) MAKE_REGION_INFINITE(&pmem_dc->lcrgn); InitClipRgn (&pmem_dc->ecrgn, &__mg_FreeClipRectList); SetClipRgn (&pmem_dc->ecrgn, &pmem_dc->DevRC); + IntersectClipRect(&pmem_dc->lcrgn, &pmem_dc->DevRC); return (HDC)pmem_dc; } @@ -2985,6 +2995,7 @@ HDC GUIAPI CreateMemDCEx (int width, int height, int depth, DWORD flags, pmem_dc->DevRC.bottom = height; SetClipRgn (&pmem_dc->ecrgn, &pmem_dc->DevRC); + IntersectClipRect(&pmem_dc->lcrgn, &pmem_dc->DevRC); return (HDC)pmem_dc; } @@ -3459,14 +3470,8 @@ int GUIAPI SaveDC (HDC hdc) sizeof (GAL_Color) * dc_state->pal.ncolors); } - if (dc_IsGeneralDC (pdc)) { - if (!ClipRgnCopy (&dc_state->lcrgn, &pdc->lcrgn)) - goto fail; - } - else { - if (!ClipRgnCopy (&dc_state->lcrgn, &pdc->ecrgn)) - goto fail; - } + if (!ClipRgnCopy (&dc_state->lcrgn, &pdc->lcrgn)) + goto fail; GAL_GetRGBA (pdc->bkcolor, pdc->surface->format, &dc_state->bkcolor.r, &dc_state->bkcolor.g, @@ -3568,13 +3573,8 @@ BOOL GUIAPI RestoreDC (HDC hdc, int saved_dc) sizeof (GAL_Color) * dc_state->pal.ncolors); } - if (dc_IsGeneralDC (pdc)) { - EmptyClipRgn (&pdc->lcrgn); - pdc->lcrgn = dc_state->lcrgn; - } else { - EmptyClipRgn (&pdc->ecrgn); - pdc->ecrgn = dc_state->lcrgn; - } + EmptyClipRgn (&pdc->lcrgn); + pdc->lcrgn = dc_state->lcrgn; pdc->bkcolor = GAL_MapRGBA (pdc->surface->format, dc_state->bkcolor.r, dc_state->bkcolor.g, @@ -3626,7 +3626,7 @@ BOOL GUIAPI RestoreDC (HDC hdc, int saved_dc) UNLOCK_GCRINFO (pdc); } else { - IntersectClipRect (&pdc->ecrgn, &pdc->DevRC); + dc_GenerateMemDCECRgn(pdc, TRUE); } dc_state_stack = dc_state->prev; diff --git a/src/newgdi/glyph.c b/src/newgdi/glyph.c index 90e7e96c..58e49ce0 100644 --- a/src/newgdi/glyph.c +++ b/src/newgdi/glyph.c @@ -2450,8 +2450,14 @@ static void _dc_bookgrey_scan_line (PDC pdc, int xpos, int ypos, for (x = 0; x < ctxt->bmp_w; x++) { b = *(ctxt->line_bits + x); +#ifdef _MGFONT_TTF_GRAYADJUST + if (b != 0) b += _MGFONT_TTF_GRAYADJUST_VALUE; + if (b >= 255) b = 16; + else b >>= 4; +#else if (b == 255) b = 16; else b >>= 4; +#endif if (b == 0) continue; diff --git a/src/newgdi/miarc.c b/src/newgdi/miarc.c index 358cff23..e36ff4db 100644 --- a/src/newgdi/miarc.c +++ b/src/newgdi/miarc.c @@ -415,6 +415,21 @@ int miFreeArcCache (void* data, unsigned int id) } #endif +void mg_miFreeArcCache (void){ + int k; + arcCacheRec *cent; + + for (k = CACHESIZE, cent = &arcCache[0]; --k >= 0; cent++) { + if (cent->spdata) { + cent->lrustamp = 0; + cent->lw = 0; + free(cent->spdata); + cent->spdata = NULL; + } + } + lrustamp = 0; +} + static void miComputeCircleSpans (int lw, miArc *parc, miArcSpanData *spdata) { register miArcSpan *span; diff --git a/src/newgdi/mifillarc.h b/src/newgdi/mifillarc.h index 0ddc3030..ffd990bc 100644 --- a/src/newgdi/mifillarc.h +++ b/src/newgdi/mifillarc.h @@ -175,7 +175,8 @@ typedef struct _miArcSlice { #define miFillInArcLower(slw) (((iny + dy) != 0) && \ ((slw > 1) || (ine != inxk))) -extern int miFreeArcCache (void* data, unsigned int id); +/* extern int miFreeArcCache (void* data, unsigned int id); */ +extern void mg_miFreeArcCache (void); extern struct finalSpan *realAllocSpan (void); extern void miFillArcSetup (register miArc* arc, register miFillArcRec* info); extern void miFillArcDSetup (register miArc* arc, register miFillArcDRec* info); diff --git a/src/newgdi/pixel_ops.c b/src/newgdi/pixel_ops.c index 3cd1d41e..f19060fe 100644 --- a/src/newgdi/pixel_ops.c +++ b/src/newgdi/pixel_ops.c @@ -215,9 +215,6 @@ void _dc_draw_hline_clip (void* context, int x1, int x2, int y) PCLIPRECT cliprect; int top, w; - if (y < 0 || y >= g_rcScr.bottom) - return; - if (x1 == x2) { if (!(x1 % pdc->step)) _dc_set_pixel_clip (pdc, x1, y); @@ -486,9 +483,6 @@ void _dc_fill_hline_clip (void* context, int x1, int x2, int y) PCLIPRECT cliprect; int top, w; - if (y < 0 || y >= g_rcScr.bottom) - return; - if (x1 > x2) { int tmp = x2; x2 = x1; diff --git a/src/newgdi/readbmp.c b/src/newgdi/readbmp.c index fe775ea7..a64931e3 100644 --- a/src/newgdi/readbmp.c +++ b/src/newgdi/readbmp.c @@ -64,6 +64,7 @@ BOOL GUIAPI InitBitmap (HDC hdc, Uint32 w, Uint32 h, Uint32 pitch, BYTE* bits, bmp->bmBitsPerPixel = pdc->surface->format->BitsPerPixel; bmp->bmBytesPerPixel = pdc->surface->format->BytesPerPixel; bmp->bmAlphaMask = NULL; + bmp->bmAlphaPitch = 0; return TRUE; } @@ -86,7 +87,8 @@ BOOL GUIAPI InitBitmapPixelFormat (HDC hdc, PBITMAP bmp) } bmp->bmType |= BMP_TYPE_ALPHA_MASK; - bmp->bmAlphaMask = calloc(1, bmp->bmHeight * (bmp->bmWidth + 3) & (~3)); + bmp->bmAlphaPitch = (bmp->bmWidth + 3) & (~3); + bmp->bmAlphaMask = calloc(1, bmp->bmHeight * bmp->bmAlphaPitch); } return TRUE; } @@ -166,6 +168,7 @@ static int init_bitmap_from_mybmp (HDC hdc, PBITMAP bmp, { int ret = ERR_BMP_OK; unsigned int size; + Uint32 alpha_pitch; PDC pdc; pdc = dc_HDC2PDC (hdc); @@ -173,6 +176,7 @@ static int init_bitmap_from_mybmp (HDC hdc, PBITMAP bmp, bmp->bmBitsPerPixel = pdc->surface->format->BitsPerPixel; bmp->bmBytesPerPixel = pdc->surface->format->BytesPerPixel; bmp->bmAlphaMask = NULL; + bmp->bmAlphaPitch = 0; size = GAL_GetBoxSize (pdc->surface, my_bmp->w, my_bmp->h, &bmp->bmPitch); @@ -224,13 +228,15 @@ static int init_bitmap_from_mybmp (HDC hdc, PBITMAP bmp, bmp->bmType |= BMP_TYPE_ALPHA; if (!device_has_alpha(hdc)) { bmp->bmType |= BMP_TYPE_ALPHA_MASK; + alpha_pitch = (bmp->bmWidth + 3) & (~3); if (alloc_all) { - size = bmp->bmHeight * ((bmp->bmWidth + 3) & (~3)); + size = bmp->bmHeight * alpha_pitch; } else { - size = (bmp->bmWidth + 3) & (~3); + size = alpha_pitch; } bmp->bmAlphaMask = calloc(1, size); + bmp->bmAlphaPitch = alpha_pitch; if (bmp->bmAlphaMask == NULL) { ret = ERR_BMP_MEM; @@ -410,8 +416,7 @@ static void cb_load_bitmap_sl (void* context, MYBITMAP* my_bmp, int y) dst_bits = info->bmp->bmBits + info->bmp->bmPitch * y; if (info->bmp->bmType & BMP_TYPE_ALPHA_MASK) { - Uint32 alpha_pitch = (info->bmp->bmWidth +3) & (~3); - dst_alpha_mask= info->bmp->bmAlphaMask + alpha_pitch * y; + dst_alpha_mask= info->bmp->bmAlphaMask + info->bmp->bmAlphaPitch * y; } else { dst_alpha_mask = NULL; } diff --git a/src/newgdi/rect.c b/src/newgdi/rect.c index 9e6c738b..77be5b49 100644 --- a/src/newgdi/rect.c +++ b/src/newgdi/rect.c @@ -161,11 +161,17 @@ void GUIAPI GetBoundRect (PRECT pdrc, const RECT* psrc1, const RECT* psrc2) NormalizeRect(&src1); NormalizeRect(&src2); - pdrc->left = (src1.left < src2.left) ? src1.left : src2.left; - pdrc->top = (src1.top < src2.top) ? src1.top : src2.top; - pdrc->right = (src1.right > src2.right) ? src1.right : src2.right; - pdrc->bottom = (src1.bottom > src2.bottom) - ? src1.bottom : src2.bottom; + if (IsRectEmpty(&src1)) { + CopyRect(pdrc, &src2); + }else if (IsRectEmpty(&src2)) { + CopyRect(pdrc, &src1); + }else{ + pdrc->left = (src1.left < src2.left) ? src1.left : src2.left; + pdrc->top = (src1.top < src2.top) ? src1.top : src2.top; + pdrc->right = (src1.right > src2.right) ? src1.right : src2.right; + pdrc->bottom = (src1.bottom > src2.bottom) + ? src1.bottom : src2.bottom; + } } int GUIAPI SubtractRect(RECT* rc, const RECT* psrc1, const RECT* psrc2) diff --git a/src/newgdi/rotatebmp.c b/src/newgdi/rotatebmp.c index 1de9c4b2..d0142771 100644 --- a/src/newgdi/rotatebmp.c +++ b/src/newgdi/rotatebmp.c @@ -44,7 +44,7 @@ static void _get_bmpdata_on_scanline (BITMAP *dstbmp, const BITMAP *srcbmp, fixed bmp_dx, fixed bmp_dy) { int i = 0, loop; - int alpha_pitch = (srcbmp->bmWidth + 3) & ~3; + int alpha_pitch = srcbmp->bmAlphaPitch; dstbmp->bmWidth = (dc_rx) - (dc_lx) + 1; loop = dstbmp->bmWidth; @@ -127,8 +127,13 @@ static void _init_bitmap_buffer(BITMAP *dst, const BITMAP *src, int size) #endif if (src->bmType & BMP_TYPE_ALPHA_MASK) { dst->bmAlphaMask = calloc(1, size * sizeof(char)); + dst->bmAlphaPitch = (size+3) & (~3); + } + else + { + dst->bmAlphaMask = NULL; + dst->bmAlphaPitch = 0; } - else dst->bmAlphaMask = NULL; dst->bmHeight = 1; dst->bmBits = malloc (size * src->bmBytesPerPixel); dst->bmWidth = size; diff --git a/src/standalone/standalone.c b/src/standalone/standalone.c index f5c6beef..68a2ff58 100644 --- a/src/standalone/standalone.c +++ b/src/standalone/standalone.c @@ -135,7 +135,7 @@ static void ParseEvent (PMSGQUEUE msg_que, int event) BOOL GUIAPI salone_StandAloneStartup (void) { - FD_ZERO (&mg_rfdset); + mg_fd_zero (&mg_rfdset); mg_maxfd = 0; #ifndef _MGGAL_BF533 @@ -255,7 +255,7 @@ BOOL salone_IdleHandler4StandAlone (PMSGQUEUE msg_queue) break; } - if (temp && FD_ISSET (mg_listen_fds [i].fd, temp)) { + if (temp && mg_fd_isset (mg_listen_fds [i].fd, temp)) { Msg.hwnd = (HWND)mg_listen_fds [i].hwnd; Msg.wParam = MAKELONG (mg_listen_fds [i].fd, type); Msg.lParam = (LPARAM)mg_listen_fds [i].context; diff --git a/src/sysres/CMakeLists.txt b/src/sysres/CMakeLists.txt index fd06c188..df2b7480 100644 --- a/src/sysres/CMakeLists.txt +++ b/src/sysres/CMakeLists.txt @@ -6,7 +6,12 @@ if (MG_MINIMALGDI) mgetc.c) else() list (APPEND sysres_sources - resource.c incoreres.c mgetc.c resmgr.c resmgr.h) + resource.c incoreres.c resmgr.c resmgr.h) + IF (WIN32) + LIST (APPEND sysres_sources mgetc_win32.c) + ELSE () + LIST (APPEND sysres_sources mgetc.c) + ENDIF (WIN32) endif(MG_MINIMALGDI) mg_add_source_files(${sysres_sources}) diff --git a/src/sysres/font/_font_inner_res.c b/src/sysres/font/_font_inner_res.c index 5ad43f2e..de358ea1 100644 --- a/src/sysres/font/_font_inner_res.c +++ b/src/sysres/font/_font_inner_res.c @@ -4,7 +4,7 @@ //declear arrays static INNER_RES __mgir_font_inner_res [] = { - {0} + { 0xfffffff, (void*)NULL, 0, 0} }; #endif // _MGINCORE_RES diff --git a/src/sysres/mgetc_win32.c b/src/sysres/mgetc_win32.c new file mode 100644 index 00000000..63259808 --- /dev/null +++ b/src/sysres/mgetc_win32.c @@ -0,0 +1,828 @@ +/************************************************* +* This is inside mode of system res configuation * +* It's generated by the mgcfg-trans, version 1.0 * +* author : dongjunjie in feynman * +* please donnot modify this file, if you want, * +* please change your input file and regenerate * +* this file * +*************************************************/ +#include +#include "common.h" +#include "minigui.h" + +#ifdef _MGINCORE_RES + +// This configuration file is for MiniGUI V3.0.x +// +// Copyright (C) 2002~2008 Feynman Software +// Copyright (C) 1998~2002 Wei Yongming. +// +// Web: http://www.minigui.com +// +// This configuration file must be installed in /etc, +// /usr/local/etc or your home directory. When you install it in your +// home directory, it should be named ".MiniGUI.cfg". +// +// The priority of above configruation files is ~/.MiniGUI.cfg, +// /usr/local/etc/MiniGUI.cfg, and then /etc/MiniGUI.cfg. +// +// If you change the install path of MiniGUI resource, you should +// modify this file to meet your configuration. +// +// NOTE: +// The format of this configuration file has changed since the last release. +// Please DONT forget to provide the latest MiniGUI.cfg file for your MiniGUI. +// +// Section: system +static char* _system_keys[]={ +// GAL engine and default options + "gal_engine", + "defaultmode", +// IAL engine + "ial_engine", + "mdev", + "mtype" +}; +static char* _system_values[]={ +// GAL engine and default options + "pc_xvfb", + "800x600-16bpp", +// IAL engine + "pc_xvfb", + "/dev/input/mice", + "IMPS2" +}; +// Section: fbcon +static char* _fbcon_keys[]={ + "defaultmode" +}; +static char* _fbcon_values[]={ + "1024x768-16bpp" +}; +// Section: qvfb +static char* _qvfb_keys[]={ + "defaultmode", + "display" +}; +static char* _qvfb_values[]={ + "640x480-16bpp", + "0" +}; +#ifdef _MGGAL_PCXVFB +// Section: pc_xvfb +static char* _pc_xvfb_keys[]={ + "defaultmode", + "window_caption", + "exec_file" +}; +static char* _pc_xvfb_values[]={ + "800x600-16bpp", + "XVFB-for-MiniGUI-3.0-(Gtk-Version)", + "gvfb" +}; +#endif +// Section: rtos_xvfb +static char* _rtos_xvfb_keys[]={ + "defaultmode" +}; +static char* _rtos_xvfb_values[]={ + "800x600-16bpp" +}; +#ifdef _MGGAL_SHADOW +// Section: shadow +static char* _shadow_keys[]={ + "real_engine", + "defaultmode", + "rotate_screen" +}; +static char* _shadow_values[]={ + "pc_xvfb", + "800x600-16bpp", + "normal" +}; +#endif +#ifdef _MGGAL_MLSHADOW +// Section: mlshadow +static char* _mlshadow_keys[]={ + "real_engine", + "defaultmode", + "def_bgcolor", + "double_buffer" +}; +static char* _mlshadow_values[]={ + "qvfb", + "800x600-16bpp", + "0x00FF00", + "enable" +}; +#endif +// The first system font must be a logical font using RBF device font. +// Section: systemfont +static char* _systemfont_keys[]={ + "font_number", + "font0", + "font1", + "font2", + "font3", + "font4", + "default", + "wchar_def", + "fixed", + "caption", + "menu", + "control" +}; +static char* _systemfont_values[]={ + "5", + "rbf-FixedSys-rrncnn-8-16-ISO8859-1", + "*-FixedSys-rrncnn-*-16-ISO8859-1", + "*-Courier-rrncnn-*-16-ISO8859-1", + "*-SansSerif-rrncnn-*-16-ISO8859-1", + "*-System-rrncnn-*-16-ISO8859-1", + "0", + "4", + "1", + "4", + "2", + "3" +}; +// Section: rawbitmapfonts +static char* _rawbitmapfonts_keys[]={ + "font_number" +}; +static char* _rawbitmapfonts_values[]={ + "0" +}; +// Section: varbitmapfonts +static char* _varbitmapfonts_keys[]={ + "font_number" +}; +static char* _varbitmapfonts_values[]={ + "0" +}; +// Section: upf +static char* _upf_keys[]={ + "font_number" +}; +static char* _upf_values[]={ + "0" +}; +// Section: qpf +static char* _qpf_keys[]={ + "font_number" +}; +static char* _qpf_values[]={ + "0" +}; +// Section: truetypefonts +static char* _truetypefonts_keys[]={ + "font_number" +}; +static char* _truetypefonts_values[]={ + "0" +}; +// Section: mouse +static char* _mouse_keys[]={ + "dblclicktime" +}; +static char* _mouse_values[]={ + "300" +}; +// Section: event +static char* _event_keys[]={ + "timeoutusec", + "repeatusec" +}; +static char* _event_values[]={ + "300000", + "50000" +}; +// Section: cursorinfo +static char* _cursorinfo_keys[]={ +// Edit following line to specify cursor files path + "cursorpath", + "cursornumber", + "cursor0", + "cursor1", + "cursor2", + "cursor3", + "cursor4", + "cursor5", + "cursor6", + "cursor7", + "cursor8", + "cursor9", + "cursor10", + "cursor11", + "cursor12", + "cursor13", + "cursor14", + "cursor15", + "cursor16", + "cursor17", + "cursor18", + "cursor19", + "cursor20", + "cursor21", + "cursor22" +}; +static char* _cursorinfo_values[]={ +// Edit following line to specify cursor files path + "/usr/local/share/minigui/res/cursor/", + "23", + "d_arrow.cur", + "d_beam.cur", + "d_pencil.cur", + "d_cross.cur", + "d_move.cur", + "d_sizenwse.cur", + "d_sizenesw.cur", + "d_sizewe.cur", + "d_sizens.cur", + "d_uparrow.cur", + "d_none.cur", + "d_help.cur", + "d_busy.cur", + "d_wait.cur", + "g_rarrow.cur", + "g_col.cur", + "g_row.cur", + "g_drag.cur", + "g_nodrop.cur", + "h_point.cur", + "h_select.cur", + "ho_split.cur", + "ve_split.cur" +}; +// Section: resinfo +static char* _resinfo_keys[]={ + "respath" +}; +static char* _resinfo_values[]={ + "/usr/local/share/minigui/res/" +}; +// Section: classic +static char* _classic_keys[]={ +// Note that max number defined in source code is 5. + "iconnumber", + "icon0", + "icon1", + "icon2", + "icon3", + "icon4", +// default icons for new OpenFileDialogBox + "dir", + "file", +// default icons for TreeView control + "treefold", + "treeunfold", +// bitmap used by BUTTON control + "radiobutton", + "checkbutton", +// background picture, use your favirate photo + "bgpicture", + "bgpicpos", +// bgpicpos=upleft +// bgpicpos=downleft +// bgpicpos=upright +// bgpicpos=downright +// bgpicpos=upcenter +// bgpicpos=downcenter +// bgpicpos=vcenterleft +// bgpicpos=vcenterright +// bgpicpos=none +//window element metrics + "caption", + "menu", + "border", + "scrollbar", +//window element colors + "fgc_active_caption", + "bgca_active_caption", + "bgcb_active_caption", + "fgc_menu", + "bgc_menu", + "fgc_msgbox", + "fgc_tip", + "bgc_tip", + "fgc_active_border", + "fgc_inactive_border", + "fgc_inactive_caption", + "bgca_inactive_caption", + "bgcb_inactive_caption", + "fgc_window", + "bgc_window", + "fgc_3dbox", + "mainc_3dbox", + "fgc_selected_item", + "bgc_selected_item", + "bgc_selected_lostfocus", + "fgc_disabled_item", + "bgc_disabled_item", + "fgc_hilight_item", + "bgc_hilight_item", + "fgc_significant_item", + "bgc_significant_item", + "bgc_desktop" +}; +static char* _classic_values[]={ +// Note that max number defined in source code is 5. + "5", + "form.ico", + "failed.ico", + "help.ico", + "warning.ico", + "excalmatory.ico", +// default icons for new OpenFileDialogBox + "folder.ico", + "textfile.ico", +// default icons for TreeView control + "fold.ico", + "unfold.ico", +// bitmap used by BUTTON control + "classic_radio_button.bmp", + "classic_check_button.bmp", +// background picture, use your favirate photo + "none", + "center", +// bgpicpos=upleft +// bgpicpos=downleft +// bgpicpos=upright +// bgpicpos=downright +// bgpicpos=upcenter +// bgpicpos=downcenter +// bgpicpos=vcenterleft +// bgpicpos=vcenterright +// bgpicpos=none +//window element metrics + "20", + "25", + "2", + "16", +//window element colors + "0xFFFFFFFF", + "0xFF6A240A", + "0xFF6A240A", + "0xFF000000", + "0xFFCED3D6", + "0xFF000000", + "0xFF000000", + "0xFFE7FFFF", + "0xFFCED3D6", + "0xFFCED3D6", + "0xFFC8D0D4", + "0xFF808080", + "0xFF808080", + "0xFF000000", + "0xFFFFFFFF", + "0xFF000000", + "0xFFCED3D6", + "0xFFFFFFFF", + "0xFF6B2408", + "0xFFBDA69C", + "0xFF848284", + "0xFFCED3D6", + "0xFFFFFFFF", + "0xFF6B2408", + "0xFFFFFFFF", + "0xFF6B2408", + "0xFFC08000" +}; +#ifdef _MGLF_RDR_FLAT +// Section: flat +static char* _flat_keys[]={ +// Note that max number defined in source code is 5. + "iconnumber", + "icon0", + "icon1", + "icon2", + "icon3", + "icon4", +// default icons for new OpenFileDialogBox + "dir", + "file", +// default icons for TreeView control + "treefold", + "treeunfold", +// bitmap used by BUTTON control + "radiobutton", + "checkbutton", +// background picture, use your favirate photo + "bgpicture", + "bgpicpos", +//window element metrics + "caption", + "menu", + "border", + "scrollbar", +//window element colors + "fgc_active_caption", + "bgca_active_caption", + "bgcb_active_caption", + "fgc_inactive_caption", + "bgca_inactive_caption", + "bgcb_inactive_caption", + "fgc_menu", + "bgc_menu", + "fgc_msgbox", + "fgc_tip", + "bgc_tip", + "fgc_active_border", + "fgc_inactive_border", + "fgc_window", + "bgc_window", + "fgc_3dbox", + "mainc_3dbox", + "fgc_selected_item", + "bgc_selected_item", + "bgc_selected_lostfocus", + "fgc_disabled_item", + "bgc_disabled_item", + "fgc_hilight_item", + "bgc_hilight_item", + "fgc_significant_item", + "bgc_significant_item", + "bgc_desktop", + "flat_tab_normal_color" +}; +static char* _flat_values[]={ +// Note that max number defined in source code is 5. + "5", + "form-flat.ico", + "failed-flat.ico", + "help-flat.ico", + "warning-flat.ico", + "excalmatory-flat.ico", +// default icons for new OpenFileDialogBox + "folder-flat.ico", + "textfile-flat.ico", +// default icons for TreeView control + "fold-flat.ico", + "unfold-flat.ico", +// bitmap used by BUTTON control + "flat_radio_button.bmp", + "flat_check_button.bmp", +// background picture, use your favirate photo + "none", + "center", +//window element metrics + "20", + "25", + "1", + "16", +//window element colors + "0xFFFFFFFFF", + "0xFF000000", + "0xFF000000", + "0xFF000000", + "0xFFFFFFFF", + "0xFFFFFFFF", + "0xFF000000", + "0xFFD8D8D8", + "0xFF000000", + "0xFF000000", + "0xFFE7FFFF", + "0xFF000000", + "0xFF848284", + "0xFF000000", + "0xFFFFFFFF", + "0xFF000000", + "0xFFFFFFFF", + "0xFFFFFFFF", + "0xFF000000", + "0xFFBDA69C", + "0xFF848284", + "0xFF000000", + "0xFFFFFFFF", + "0xFF664E4A", + "0xFFFFFFFF", + "0xFF000000", + "0xFFC08000", + "0xFFC6D2CF" +}; +#endif +#ifdef _MGLF_RDR_SKIN +// Section: skin +static char* _skin_keys[]={ +// Note that max number defined in source code is 5. + "iconnumber", + "icon0", + "icon1", + "icon2", + "icon3", + "icon4", +// default icons for new OpenFileDialogBox + "dir", + "file", +// default icons for TreeView control + "treefold", + "treeunfold", +// background picture, use your favirate photo + "bgpicture", + "bgpicpos", +//window element metrics + "caption", + "menu", + "border", + "scrollbar", + "fgc_active_caption", + "bgca_active_caption", + "bgcb_active_caption", + "fgc_menu", + "bgc_menu", + "fgc_msgbox", + "fgc_tip", + "bgc_tip", + "fgc_active_border", + "fgc_inactive_border", + "fgc_inactive_caption", + "bgca_inactive_caption", + "bgcb_inactive_caption", + "fgc_window", + "bgc_window", + "fgc_3dbox", + "mainc_3dbox", + "fgc_selected_item", + "bgc_selected_item", + "bgc_selected_lostfocus", + "fgc_disabled_item", + "bgc_disabled_item", + "fgc_hilight_item", + "bgc_hilight_item", + "fgc_significant_item", + "bgc_significant_item", + "bgc_desktop", + "skin_bkgnd", + "skin_caption", + "skin_caption_btn", +//for scrollbar + "skin_scrollbar_hshaft", + "skin_scrollbar_vshaft", + "skin_scrollbar_hthumb", + "skin_scrollbar_vthumb", + "skin_scrollbar_arrows", +//for border + "skin_tborder", + "skin_bborder", + "skin_lborder", + "skin_rborder", + "skin_arrows", + "skin_arrows_shell", + "skin_pushbtn", + "skin_radiobtn", + "skin_checkbtn", +//for treeview + "skin_tree", + "skin_header", + "skin_tab", +//for trackbar + "skin_tbslider_h", + "skin_tbslider_v", + "skin_trackbar_horz", + "skin_trackbar_vert", +//for progressbar + "skin_progressbar_htrack", + "skin_progressbar_vtrack", + "skin_progressbar_hchunk", + "skin_progressbar_vchunk" +}; +static char* _skin_values[]={ +// Note that max number defined in source code is 5. + "5", + "form.ico", + "failed.ico", + "help.ico", + "warning.ico", + "excalmatory.ico", +// default icons for new OpenFileDialogBox + "folder.ico", + "textfile.ico", +// default icons for TreeView control + "fold.ico", + "unfold.ico", +// background picture, use your favirate photo + "none", + "center", +//window element metrics + "25", + "25", + "1", + "17", + "0xFFFFFFFF", + "0xFFE35400", + "0xFF686868", + "0xFF000000", + "0xFFD4D6FF", + "0xFF000000", + "0xFF000000", + "0xFFFFFFFF", + "0xFFC8D0D4", + "0xFFC8D0D4", + "0xFFF8E4D8", + "0xFFDF967A", + "0xFF686868", + "0xFF000000", + "0xFFFFFFFF", + "0xFF000000", + "0xFFD8E9EC", + "0xFFFFFFFF", + "0xFFC56A31", + "0xFFD8E9EC", + "0xFF99A8AC", + "0xFFFFFFFF", + "0xFFFFFFFF", + "0xFFC56A31", + "0xFFFFFFFF", + "0xFFC56A31", + "0xFF984E00", + "skin_bkgnd.bmp", + "skin_caption.gif", + "skin_cpn_btn.gif", +//for scrollbar + "skin_sb_hshaft.bmp", + "skin_sb_vshaft.bmp", + "skin_sb_hthumb.bmp", + "skin_sb_vthumb.bmp", + "skin_sb_arrows.bmp", +//for border + "skin_tborder.bmp", + "skin_bborder.bmp", + "skin_lborder.bmp", + "skin_rborder.bmp", + "skin_arrows.gif", + "skin_arrows_shell.bmp", + "skin_pushbtn.gif", + "skin_radiobtn.gif", + "skin_checkbtn.bmp", +//for treeview + "skin_tree.bmp", + "skin_header.bmp", + "skin_tab.gif", +//for trackbar + "skin_tbslider_h.gif", + "skin_tbslider_v.gif", + "skin_tb_horz.gif", + "skin_tb_vert.gif", +//for progressbar + "skin_pb_htrack.gif", + "skin_pb_vtrack.gif", + "skin_pb_htruck.bmp", + "skin_pb_vtruck.bmp" +}; +#endif +// Section: fashion +static char* _fashion_keys[]={ +// Note that max number defined in source code is 5. + "iconnumber", + "icon0", + "icon1", + "icon2", + "icon3", + "icon4", +// default icons for new OpenFileDialogBox + "dir", + "file", +// default icons for TreeView control + "treefold", + "treeunfold", +// bitmap used by BUTTON control + "radiobutton", + "checkbutton", +// background picture, use your favirate photo + "bgpicture", + "bgpicpos", +//window element metrics + "caption", + "menu", + "border", + "scrollbar", + "fgc_active_caption", + "bgca_active_caption", + "bgcb_active_caption", + "fgc_menu", + "bgc_menu", + "fgc_msgbox", + "fgc_tip", + "bgc_tip", + "fgc_active_border", + "fgc_inactive_border", + "fgc_inactive_caption", + "bgca_inactive_caption", + "bgcb_inactive_caption", + "fgc_window", + "bgc_window", + "fgc_3dbox", + "mainc_3dbox", + "fgc_selected_item", + "bgc_selected_item", + "bgc_selected_lostfocus", + "fgc_disabled_item", + "bgc_disabled_item", + "fgc_hilight_item", + "bgc_hilight_item", + "fgc_significant_item", + "bgc_significant_item", + "bgc_desktop" +}; +static char* _fashion_values[]={ +// Note that max number defined in source code is 5. + "5", + "form.ico", + "failed.ico", + "mg_help.ico", + "warning.ico", + "excalmatory.ico", +// default icons for new OpenFileDialogBox + "folder.ico", + "textfile.ico", +// default icons for TreeView control + "fold.ico", + "unfold.ico", +// bitmap used by BUTTON control + "fashion_radio_btn.bmp", + "fashion_check_btn.bmp", +// background picture, use your favirate photo + "none", + "center", +//window element metrics + "25", + "25", + "1", + "17", + "0xFFFFFFFF", + "0xFFE35400", + "0xFFFF953D", + "0xFF000000", + "0xFFFFE4BF", + "0xFF000000", + "0xFF000000", + "0xFFFFFFFF", + "0xFFC8D0D4", + "0xFFC8D0D4", + "0xFFF8E4D8", + "0xFFDF967A", + "0xFFEBB99D", + "0xFF000000", + "0xFFEBB99D", + "0xFF000000", + "0xFFD8E9EC", + "0xFFFFFFFF", + "0xFFC56A31", + "0xFFD8E9EC", + "0xFF99A8AC", + "0xFFFFFFFF", + "0xFFFFFFFF", + "0xFFC56A31", + "0xFFFFFFFF", + "0xFFC56A31", + "0xFF984E00" +}; +static ETCSECTION _etc_sections [] = { + {0, 5, "system", _system_keys,_system_values }, + {0, 1, "fbcon", _fbcon_keys,_fbcon_values }, + {0, 2, "qvfb", _qvfb_keys,_qvfb_values }, +#ifdef _MGGAL_PCXVFB + {0, 3, "pc_xvfb", _pc_xvfb_keys,_pc_xvfb_values }, +#endif + {0, 1, "rtos_xvfb", _rtos_xvfb_keys,_rtos_xvfb_values }, +#ifdef _MGGAL_SHADOW + {0, 3, "shadow", _shadow_keys,_shadow_values }, +#endif +#ifdef _MGGAL_MLSHADOW + {0, 4, "mlshadow", _mlshadow_keys,_mlshadow_values }, +#endif + {0, 12, "systemfont", _systemfont_keys,_systemfont_values }, + {0, 1, "rawbitmapfonts", _rawbitmapfonts_keys,_rawbitmapfonts_values }, + {0, 1, "varbitmapfonts", _varbitmapfonts_keys,_varbitmapfonts_values }, + {0, 1, "upf", _upf_keys,_upf_values }, + {0, 1, "qpf", _qpf_keys,_qpf_values }, + {0, 1, "truetypefonts", _truetypefonts_keys,_truetypefonts_values }, + {0, 1, "mouse", _mouse_keys,_mouse_values }, + {0, 2, "event", _event_keys,_event_values }, + {0, 25, "cursorinfo", _cursorinfo_keys,_cursorinfo_values }, + {0, 1, "resinfo", _resinfo_keys,_resinfo_values }, + {0, 45, "classic", _classic_keys,_classic_values }, +#ifdef _MGLF_RDR_FLAT + {0, 46, "flat", _flat_keys,_flat_values }, +#endif +#ifdef _MGLF_RDR_SKIN + {0, 71, "skin", _skin_keys,_skin_values }, +#endif + {0, 45, "fashion", _fashion_keys,_fashion_values } +}; + +/////////////////////////////////////////////////// + +static ETC_S _ETC = { + 0, + sizeof(_etc_sections)/sizeof(ETCSECTION), + _etc_sections +}; + +GHANDLE __mg_get_mgetc (void) +{ + return (GHANDLE) &_ETC; +} + +#endif /* _MGINCORE_RES */ + diff --git a/src/sysres/mkinnerres.sh b/src/sysres/mkinnerres.sh new file mode 100755 index 00000000..207a5cca --- /dev/null +++ b/src/sysres/mkinnerres.sh @@ -0,0 +1,49 @@ +#!/bin/sh + +MGCFG_TRANS=mgcfg-trans #get it from svn+ssh://devsrv/home/projects/svn/mg-tools/trunk/mgcfg-trans/bin/windowsxp or bin/ubuntu10.04 +INNER_RES_TRANS=inner-res-trans # get it from svn+ssh://devsrv/home/projects/svn/mg-tools/trunk/inner-res-trans/bin/windowsxp or bin/ubuntu10.04 + +MINIGUI_CFG=./MiniGUI.cfg #MiniGUI.cfg's path + +MGETC_OUT=mgetc.c +FONT_OUTDIR=font +FONT_INDIR=/usr/local/share/minigui/res/ #same as MiniGUI.cfg [resinfo] respath 's value + +#change the font want to translate into font_list +#same as MiniGUI.cfg 's font seciton value +# e.g if MiniGUI.cfg 's upf section is: +#[upf] +#font_number=2 +#name0=upf-unifont-rrncnn-16-16-ISO8859-1,ISO8859-15,GB2312,BIG5, GBK,UTF-8, UTF-16LE, UTF-16BE +#fontfile0=font/unifont_160_50.upf +#name1=upf-times-rrncnn-5-10-ISO8859-1,ISO8859-15 +#fontfile1=font/smoothtimes_100_50.upf +# +#[qpf] +#font_number=1 +#name0=qpf-unifont-rrncnn-16-16-ISO8859-1,ISO8859-15,GB2312-0,GBK,BIG5 +#fontfile0=font/unifont_160_50.qpf +# -- +# the font_list should be +#font/unifont_160_50.upf upf-unifont-rrncnn-16-16-ISO8859-1,ISO8859-15,GB2312,BIG5, GBK,UTF-8, UTF-16LE, UTF-16BE +#font/smoothtimes_100_50.upf upf-times-rrncnn-5-10-ISO8859-1,ISO8859-15 +#font/unifont_160_50.qpf qpf-unifont-rrncnn-16-16-ISO8859-1,ISO8859-15,GB2312-0,GBK,BIG5 +#--- +# all the font section's value should be include one files +# +# +cat > font_list << __AEOF +font/song-12-gb2312.bin rbf-fixed-rrncnn-12-12-GB2312-0 +font/Courier-rr-8-13.vbf vbf-Courier-rrncnn-8-13-ISO8859-1 +font/smoothtimes_100_50.upf upf-times-rrncnn-5-10-ISO8859-1,ISO8859-15 +__AEOF + +mkdir -p $FONT_OUTDIR + +$MGCFG_TRANS -o $MGETC_OUT $MINIGUI_CFG +$INNER_RES_TRANS -l font_list -i $FONT_INDIR -o $FONT_OUTDIR -n _font_inner_res + +echo "Translate OK!" +echo "Now, cp $MGETC_OUT $FONT_OUTDIR minigui/src/sysres -a" + + diff --git a/src/sysres/resmgr.c b/src/sysres/resmgr.c index 0ad91a40..80351822 100644 --- a/src/sysres/resmgr.c +++ b/src/sysres/resmgr.c @@ -337,7 +337,7 @@ BOOL InitializeResManager(int hash_table_size) pwd_res_path = strdup("./"); //initialize paths -#ifndef __NOUNIX__ +#if !defined(__NOUNIX__) || defined(WIN32) if ((p = getenv ("MG_RES_PATH"))) { int len = strlen(p); if (p[len-1] == '/') @@ -604,7 +604,7 @@ static char* get_res_file(const char* res_name, char* filename) sprintf(filename,"%s/%s", res_paths[i], res_name); #ifndef __VXWORKS__ //in vxworks, don't support _access method. - if (_access(filename, 04) != -1) + if (_access(filename, 04) != -1) #endif #endif { diff --git a/src/textedit/mbtree.c b/src/textedit/mbtree.c index 89094ebd..38b9f0ea 100644 --- a/src/textedit/mbtree.c +++ b/src/textedit/mbtree.c @@ -485,7 +485,7 @@ static mCommBTreeNode* _get_left_leaf(mCommBTreeNode *node) static void mCommBTreeLeafIterator_construct(mCommBTreeLeafIterator* self, va_list va) { - ncsParseConstrcutParams(va, "pp", &self->tree, &self->current); + ncsParseConstructParams(va, "pp", &self->tree, &self->current); _SUPER(mObject, self, construct, 0); if(self->tree && !self->current) diff --git a/src/textedit/mtextedit.c b/src/textedit/mtextedit.c index 4d098510..93f79bda 100644 --- a/src/textedit/mtextedit.c +++ b/src/textedit/mtextedit.c @@ -88,6 +88,9 @@ static int get_first_char_len(PLOGFONT plogfont, const char* str, int len) int l; if(len <= 0) return 0; + /*[humingming for bug 5344]: don't process like this, + * on some borad may case some problem */ +#if 0 if(*str > 0) //is ascii code { return 1; @@ -96,6 +99,10 @@ static int get_first_char_len(PLOGFONT plogfont, const char* str, int len) l = GetFirstMCharLen(plogfont, str, len); if(l <= 1) return 0; +#endif + l = GetFirstMCharLen(plogfont, str, len); + if (l < 0) + return 1; return l; } @@ -158,7 +165,7 @@ static void mTextBuffer_construct(mTextBuffer* self, va_list va) int len = 0; Class(mObject).construct((mObject*)self, 0); - ncsParseConstrcutParams(va, "si", &title, &len); + ncsParseConstructParams(va, "si", &title, &len); if(title) { @@ -491,7 +498,7 @@ END_MINI_CLASS static void mTextIterator_construct(mTextIterator* self, va_list va) { Class(mObject).construct((mObject*)self, 0); - ncsParseConstrcutParams(va, "pi", &self->buffer, &self->index); + ncsParseConstructParams(va, "pi", &self->buffer, &self->index); } static void mTextIterator_nextChar(mTextIterator* self) @@ -1715,7 +1722,7 @@ static void mTextLayout_construct(mTextLayout* self, va_list va) { Class(mCommBTree).construct((mCommBTree*)self, 0); - ncsParseConstrcutParams(va, "pp", &self->text_buffer, &self->context); + ncsParseConstructParams(va, "pp", &self->text_buffer, &self->context); self->old_height = -1; } @@ -4589,16 +4596,28 @@ mTextEditor_onKeyDown(mTextEditor *self, int scancode, DWORD keyFlags) return 0; if (bCtrl) { - int inserting; + int inserting; + int begin_pos; char *txtBuffer; + DWORD dwStyle = GetWindowStyle(self->hwnd); inserting = GetClipBoardDataLen (CBNAME_TEXT); if (inserting > 0) { txtBuffer = FixStrAlloc (inserting); GetClipBoardData (CBNAME_TEXT, txtBuffer, inserting); + if(pTextLayout->sel_begin > pTextLayout->cursor) + begin_pos = pTextLayout->cursor; + else + begin_pos = pTextLayout->sel_begin; + _c(self)->insertText(self, txtBuffer, inserting); + if(dwStyle & NCSS_TE_UPPERCASE) + _c(pTextBuffer)->setCase(pTextBuffer, begin_pos, begin_pos+inserting, TRUE); + else if(dwStyle & NCSS_TE_LOWERCASE) + _c(pTextBuffer)->setCase(pTextBuffer, begin_pos, begin_pos+inserting, FALSE); + FreeFixStr(txtBuffer); } return inserting; @@ -4805,6 +4824,8 @@ static int mTextEditor_getTextLen(mTextEditor *self) static void mTextEditor_onSetFocus(mTextEditor *self, HWND oldActiveWnd, int lParam) { + int text_len = 0; + if (!self || self->hwnd == oldActiveWnd) return; @@ -4813,11 +4834,8 @@ static void mTextEditor_onSetFocus(mTextEditor *self, HWND oldActiveWnd, int lPa ncsNotifyParent (self, NCSN_TE_SETFOCUS); InvalidateRect (self->hwnd, NULL, TRUE); - int text_len = 0; - #ifdef _MGHAVE_TEXTEDITTITLE text_len = self->title_idx <= -1 ? 0: self->title_idx; - printf("title_idx:%d\n", text_len); #endif /*[bug5291]: when get focus don't auto move caret. @@ -5912,6 +5930,7 @@ static void _make_caret_visible(mTextEditor *self, BOOL refresh = FALSE; if (! mTextEditor_hasPainted(self)) { + pTextLayout->old_height = -1; /* Fix bug #5606 */ return; } diff --git a/src/textedit/object.c b/src/textedit/object.c index 8da74297..f631afc2 100644 --- a/src/textedit/object.c +++ b/src/textedit/object.c @@ -201,7 +201,7 @@ BOOL ncsInstanceOf(mObject *object, mObjectClass* clss) } -int ncsParseConstrcutParams(va_list args, const char* signature, ...) +int ncsParseConstructParams(va_list args, const char* signature, ...) { va_list params; int argc; diff --git a/src/textedit/object.h b/src/textedit/object.h index fda3183a..e661af11 100644 --- a/src/textedit/object.h +++ b/src/textedit/object.h @@ -17,7 +17,7 @@ extern "C"{ #ifdef __MINIGUI_LIB__ # define ncsInstanceOf _minigui_ncsInstanceOf -# define ncsParseConstrcutParams _minigui_ncsParseConstrcutParams +# define ncsParseConstructParams _minigui_ncsParseConstructParams # define ncsSafeCast _minigui_ncsSafeCast # define ncsSafeCastClass _minigui_ncsSafeCastClass #endif @@ -427,7 +427,7 @@ MGNCS_EXPORT mObjectClass *ncsSafeCastClass(mObjectClass* clss, mObjectClass* ca */ #define SAFE_CAST_CLASS(Clss, ClssCast) ((ClassType(ClssCast)*)(ncsSafeCastClass((mObjectClass*)Clss, (mObjectClass*)(void*)(&Class(ClssCast))))) -int ncsParseConstrcutParams(va_list args, const char* signature, ...); +int ncsParseConstructParams(va_list args, const char* signature, ...); /** @} end of global_object_funtions */