Skip to content

Commit

Permalink
1、librime更新至1.11
Browse files Browse the repository at this point in the history
2、修复一些同步梁梁代码时漏掉的内容
  • Loading branch information
Techince committed Apr 15, 2024
1 parent ffdd951 commit 355cafa
Show file tree
Hide file tree
Showing 24 changed files with 1,115 additions and 1,197 deletions.
4 changes: 2 additions & 2 deletions RimeWithWeasel/RimeWithWeasel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ bool RimeWithWeaselHandler::_Respond(RimeSessionId session_id, EatLine eat)
messages.emplace_back(std::format("status.disabled={}\n", status.is_disabled));
messages.emplace_back(std::format("status.full_shape={}\n", status.is_full_shape));
messages.emplace_back(std::format("status.ascii_punct={}\n", status.is_ascii_punct));
messages.emplace_back(std::format("status.prediction={}\n", status.is_predictable));
messages.emplace_back(std::format("status.prediction={}\n", RimeGetOption(session_id, "prediction")));
messages.emplace_back(std::format("status.schema_id={}\n", status.schema_id));
if (m_global_ascii_mode && (session_status.status.is_ascii_mode != status.is_ascii_mode))
{
Expand Down Expand Up @@ -1402,7 +1402,7 @@ void RimeWithWeaselHandler::_GetStatus(weasel::Status& stat, RimeSessionId sessi
stat.disabled = !!status.is_disabled;
stat.full_shape = !!status.is_full_shape;
stat.ascii_punct = !!status.is_ascii_punct;
stat.prediction = !!status.is_predictable;
stat.prediction = !!RimeGetOption(session_id, "prediction");
if (schema_id != m_last_schema_id)
{
m_session_status_map[session_id].__synced = false;
Expand Down
4 changes: 2 additions & 2 deletions WeaselTSF/CandidateListTSF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ void WeaselTSF::HandleUICallback(int* const sel, int* const hov, bool* const nex
{
_SelectCandidateOnCurrentPage(*sel);
}
if (hov)
else if (hov)
{
_HandleMouseHoverEvent(*hov);
}
if (next)
else if (next || scroll_next)
{
_HandleMousePageEvent(next, scroll_next);
}
Expand Down
15 changes: 15 additions & 0 deletions WeaselTSF/Composition.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "stdafx.h"
#include <WeaselCommon.h>
#include "cmath"
#include "test.h"
export module Composition;
import WeaselTSF;
import EditSession;
Expand Down Expand Up @@ -152,6 +153,10 @@ STDAPI CStartCompositionEditSession::DoEditSession(TfEditCookie ec)
tfSelection.style.ase = TF_AE_NONE;
tfSelection.style.fInterimChar = FALSE;
auto ret = _pContext->SetSelection(ec, 1, &tfSelection);
#ifdef TEST
std::wstring buffer{ std::format(L"From CStartCompositionEditSession::DoEditSessionn. ret = 0x{:X}\n", static_cast<unsigned>(ret)) };
_pTextService->WriteConsole(buffer);
#endif // TEST
}

return S_OK;
Expand All @@ -174,6 +179,10 @@ STDAPI CEndCompositionEditSession::DoEditSession(TfEditCookie ec)
}

auto hr = _pComposition->EndComposition(ec);
#ifdef TEST
std::wstring buffer{ std::format(L"From CEndCompositionEditSession::DoEditSessionn. hr = 0x{:X}\n", static_cast<unsigned>(hr)) };
_pTextService->WriteConsole(buffer);
#endif // TEST
_pTextService->_FinalizeComposition();
return hr;
}
Expand All @@ -198,6 +207,12 @@ STDAPI CGetTextExtentEditSession::DoEditSession(TfEditCookie ec)
_pContextView->GetScreenExt(&rcExt);
hr = _pContextView->GetTextExt(ec, pRange, &rc, &fClipped);

#ifdef TEST
std::wstring buffer{ std::format(L"From CGetTextExtentEditSession::DoEditSessionn. ret = 0x{:X}, rc = ({}, {}, {}, {})\n",
static_cast<unsigned>(hr), rc.left, rc.top, rc.right, rc.bottom) };
_pTextService->WriteConsole(buffer);
#endif // TEST

if ((hr == 0x80040057) ||
(hr == 0x80070057 && _pTextService->GetBit(WeaselFlag::AUTOCAD)))
{
Expand Down
2 changes: 1 addition & 1 deletion WeaselTSF/ThreadFocusSink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ STDMETHODIMP WeaselTSF::OnSetThreadFocus()
#endif // TEST
if (m_client.Echo())
{
m_client.ProcessKeyEvent(0);
POINT pt{};
::GetCursorPos(&pt);
RECT rc{ pt.x, pt.y, pt.x, pt.y };
m_client.UpdateInputPosition(rc);
m_client.ProcessKeyEvent(0);
weasel::ResponseParser parser(NULL, NULL, &_status, NULL, &_cand->style());
bool ok = m_client.GetResponseData(std::ref(parser));
if (ok) {
Expand Down
2 changes: 1 addition & 1 deletion WeaselUI/DirectWriteResources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ HRESULT DirectWriteResources::InitResources(std::wstring_view label_font_face, i
DWRITE_FONT_WEIGHT fontWeight = DWRITE_FONT_WEIGHT_NORMAL;
DWRITE_FONT_STYLE fontStyle = DWRITE_FONT_STYLE_NORMAL;
// setup font weight and font style by the first unit of font_face setting string
_ParseFontFace(fontFaceStrVector[0], fontWeight, fontStyle);
_ParseFontFace(font_face.data(), fontWeight, fontStyle);
fontFaceStrVector[0] = std::regex_replace(fontFaceStrVector[0], std::wregex(STYLEORWEIGHT, std::wregex::icase), L"");
hResult = pDWFactory->CreateTextFormat(_mainFontFace.data(), NULL,
fontWeight, fontStyle, DWRITE_FONT_STRETCH_NORMAL,
Expand Down
3 changes: 1 addition & 2 deletions WeaselUI/StandardLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,7 @@ void weasel::StandardLayout::_PrepareRoundInfo(CDCHandle& dc)
_textRoundInfo.Hemispherical = textHemispherical;
if ( _style.vertical_text_left_to_right && _style.layout_type == UIStyle::LAYOUT_VERTICAL_TEXT )
{
_textRoundInfo.IsTopLeftNeedToRound = !_textRoundInfo.IsTopLeftNeedToRound;
_textRoundInfo.IsTopRightNeedToRound = !_textRoundInfo.IsTopRightNeedToRound;
std::swap(_textRoundInfo.IsTopLeftNeedToRound, _textRoundInfo.IsTopRightNeedToRound);
}
}

Expand Down
56 changes: 42 additions & 14 deletions include/glog/log_severity.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2007, Google Inc.
// Copyright (c) 2024, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -30,6 +30,16 @@
#ifndef BASE_LOG_SEVERITY_H__
#define BASE_LOG_SEVERITY_H__

#if defined(GLOG_USE_GLOG_EXPORT)
# include "glog/export.h"
#endif

#if !defined(GLOG_EXPORT)
# error <glog/log_severity.h> was not included correctly. See the documention for how to consume the library.
#endif

namespace google {

// The recommended semantics of the log levels are as follows:
//
// INFO:
Expand All @@ -48,27 +58,43 @@
// Variables of type LogSeverity are widely taken to lie in the range
// [0, NUM_SEVERITIES-1]. Be careful to preserve this assumption if
// you ever need to change their values or add a new severity.
typedef int LogSeverity;

const int GLOG_INFO = 0, GLOG_WARNING = 1, GLOG_ERROR = 2, GLOG_FATAL = 3,
NUM_SEVERITIES = 4;
enum LogSeverity {
GLOG_INFO = 0,
GLOG_WARNING = 1,
GLOG_ERROR = 2,
GLOG_FATAL = 3,
#ifndef GLOG_NO_ABBREVIATED_SEVERITIES
# ifdef ERROR
# ifdef ERROR
# error ERROR macro is defined. Define GLOG_NO_ABBREVIATED_SEVERITIES before including logging.h. See the document for detail.
# endif
const int INFO = GLOG_INFO, WARNING = GLOG_WARNING,
ERROR = GLOG_ERROR, FATAL = GLOG_FATAL;
# endif
INFO = GLOG_INFO,
WARNING = GLOG_WARNING,
ERROR = GLOG_ERROR,
FATAL = GLOG_FATAL
#endif
};

#if defined(__cpp_inline_variables)
# if (__cpp_inline_variables >= 201606L)
# define GLOG_INLINE_VARIABLE inline
# endif // (__cpp_inline_variables >= 201606L)
#endif // defined(__cpp_inline_variables)

#if !defined(GLOG_INLINE_VARIABLE)
# define GLOG_INLINE_VARIABLE
#endif // !defined(GLOG_INLINE_VARIABLE)

GLOG_INLINE_VARIABLE
constexpr int NUM_SEVERITIES = 4;

// DFATAL is FATAL in debug mode, ERROR in normal mode
#ifdef NDEBUG
#define DFATAL_LEVEL ERROR
# define DFATAL_LEVEL ERROR
#else
#define DFATAL_LEVEL FATAL
# define DFATAL_LEVEL FATAL
#endif

extern GLOG_EXPORT const char* const LogSeverityNames[NUM_SEVERITIES];

// NDEBUG usage helpers related to (RAW_)DCHECK:
//
// DEBUG_MODE is for small !NDEBUG uses like
Expand All @@ -89,10 +115,12 @@ extern GLOG_EXPORT const char* const LogSeverityNames[NUM_SEVERITIES];
//
#ifdef NDEBUG
enum { DEBUG_MODE = 0 };
#define IF_DEBUG_MODE(x)
# define IF_DEBUG_MODE(x)
#else
enum { DEBUG_MODE = 1 };
#define IF_DEBUG_MODE(x) x
# define IF_DEBUG_MODE(x) x
#endif

} // namespace google

#endif // BASE_LOG_SEVERITY_H__
Loading

0 comments on commit 355cafa

Please sign in to comment.